elementals 1.3.1__tar.gz → 1.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {elementals-1.3.1 → elementals-1.3.2}/LICENSE +20 -20
  2. elementals-1.3.2/PKG-INFO +49 -0
  3. {elementals-1.3.1 → elementals-1.3.2}/README.md +0 -1
  4. {elementals-1.3.1 → elementals-1.3.2}/elementals/logger.py +48 -14
  5. {elementals-1.3.1 → elementals-1.3.2}/elementals/prompter.py +1 -1
  6. elementals-1.3.2/elementals.egg-info/PKG-INFO +49 -0
  7. {elementals-1.3.1 → elementals-1.3.2}/elementals.egg-info/not-zip-safe +1 -1
  8. {elementals-1.3.1 → elementals-1.3.2}/setup.cfg +12 -12
  9. {elementals-1.3.1 → elementals-1.3.2}/setup.py +2 -3
  10. {elementals-1.3.1 → elementals-1.3.2}/test/test_all.py +3 -2
  11. elementals-1.3.1/PKG-INFO +0 -44
  12. elementals-1.3.1/elementals.egg-info/PKG-INFO +0 -44
  13. {elementals-1.3.1 → elementals-1.3.2}/elementals/__init__.py +0 -0
  14. {elementals-1.3.1 → elementals-1.3.2}/elementals/anchor.py +0 -0
  15. {elementals-1.3.1 → elementals-1.3.2}/elementals/progress_bar.py +0 -0
  16. {elementals-1.3.1 → elementals-1.3.2}/elementals/status_bar.py +0 -0
  17. {elementals-1.3.1 → elementals-1.3.2}/elementals.egg-info/SOURCES.txt +0 -0
  18. {elementals-1.3.1 → elementals-1.3.2}/elementals.egg-info/dependency_links.txt +0 -0
  19. {elementals-1.3.1 → elementals-1.3.2}/elementals.egg-info/requires.txt +0 -0
  20. {elementals-1.3.1 → elementals-1.3.2}/elementals.egg-info/top_level.txt +0 -0
  21. {elementals-1.3.1 → elementals-1.3.2}/test/test_progress_bar.py +0 -0
  22. {elementals-1.3.1 → elementals-1.3.2}/test/test_prompter.py +0 -0
  23. {elementals-1.3.1 → elementals-1.3.2}/test/test_status_bar.py +0 -0
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 Eyal Itkin.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Eyal Itkin.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
@@ -0,0 +1,49 @@
1
+ Metadata-Version: 2.1
2
+ Name: elementals
3
+ Version: 1.3.2
4
+ Summary: Basic utilities for CTF (or exploit) scripts
5
+ Home-page: https://github.com/eyalitki/elementals
6
+ Author: Eyal Itkin
7
+ Author-email: eyal.itkin@gmail.com
8
+ License: MIT
9
+ Classifier: Programming Language :: Python
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: colorama
15
+ Requires-Dist: hexdump
16
+ Requires-Dist: pydocstyle
17
+ Requires-Dist: flake8
18
+ Requires-Dist: six
19
+
20
+ # elementals
21
+ Python package with basic utilities for CTF scripts (works well for exploit PoCs too).
22
+
23
+ ## Install
24
+ ```pip install elementals```
25
+
26
+ ## Read The Docs
27
+ https://elementals.readthedocs.io/
28
+
29
+ ## Github
30
+ https://github.com/eyalitki/elementals
31
+
32
+ ## Brief
33
+ The **elementals** python package is a utility package with handy tools for CTF scripts and PoC-style scripts. What was first implemented for personal use in small research scripts was now upgraded to be used by security researchers as a lightweight substitute to the famous pwntools package.
34
+
35
+ The features included in **elementals** are:
36
+ * **Logger:** Basic (logging based) logger - configured and ready to use
37
+ * **Prompter:** Metasploit based stdout wrapper for the logger
38
+ * **ProgressBar:** User-friendly graphical progress bar
39
+ * **StatusBar:** User-friendly graphical status bar
40
+ * **createAnchor:** Creates a time-stamped output directory for all script outputs
41
+ * **hexDump:** Stylized hex dump for binary blobs / strings
42
+
43
+ ## Used by
44
+ The **elementals** package is used in most of my scripts and also in my public Github projects:
45
+ * **Scout Debugger** - https://github.com/CheckPointSW/Scout
46
+ * **Karta (IDA Plugin)** - https://github.com/CheckPointSW/Karta
47
+
48
+ ## References
49
+ * E-mail: eyal dot itkin at gmail dot com
@@ -33,5 +33,4 @@ The **elementals** package is used in most of my scripts and also in my public G
33
33
  * **Karta (IDA Plugin)** - https://github.com/CheckPointSW/Karta
34
34
 
35
35
  ## References
36
- * Twitter: [@EyalItkin](https://twitter.com/EyalItkin)
37
36
  * E-mail: eyal dot itkin at gmail dot com
@@ -101,28 +101,62 @@ class Logger(logging.Logger):
101
101
  pass
102
102
 
103
103
  @staticmethod
104
- def _fixLines(message, prefix):
104
+ def _stripLine(line):
105
+ """Remove color escape codes from a (possibly) colored line.
106
+
107
+ Args:
108
+ line (str): log record line
109
+
110
+ Return Value:
111
+ stripped line.
112
+ """
113
+ if "\033" not in line:
114
+ return line
115
+ result = ''
116
+ for part in line.split("\033"):
117
+ if len(result) == '':
118
+ result += part
119
+ continue
120
+ if part.find('m') == -1:
121
+ result += part
122
+ continue
123
+ result += part[part.find('m')+1:]
124
+ return result
125
+
126
+ @staticmethod
127
+ def _fixLines(message, prefix, is_ui=False):
105
128
  """Update a (possibly) multiline record, to better print the prefix.
106
129
 
107
130
  Args:
108
- message (str): log record message
109
- prefix (str): string prefix to be added
131
+ message (str): log record message
132
+ prefix (str): string prefix to be added
133
+ is_ui (bool, optional): is a UI related (colored) formatter? (False by default)
110
134
 
111
135
  Return Value:
112
136
  styled to prefix (possibly multiline) message
113
137
  """
138
+ # Remove possible color coding
139
+ if not is_ui:
140
+ message = Logger._stripLine(message)
114
141
  if "\n" not in message:
115
142
  return prefix + message
116
- else:
117
- prefix_length = len(prefix)
118
- result = ''
119
- for line in message.split("\n"):
120
- if len(result) == 0:
121
- result += prefix + line + "\n"
122
- else:
123
- result += prefix_length * " " + line + "\n"
124
- # chop the last new line
125
- return result[:-1]
143
+ prefix_length = len(prefix)
144
+ result = ''
145
+ first_line = True
146
+ for line in message.split("\n"):
147
+ # If this isn't the first line, the handling is simple
148
+ if not first_line:
149
+ result += prefix_length * " " + line + "\n"
150
+ continue
151
+ first_line = False
152
+ # If the first line is empty and this is a UI prompt, don't print anything
153
+ if is_ui and len(line.strip()) == 0:
154
+ result += ""
155
+ else:
156
+ result += prefix + line + "\n"
157
+
158
+ # chop the last new line
159
+ return result[:-1]
126
160
 
127
161
  class ColorFormatter(logging.Formatter):
128
162
  """Custom color formatter to be used by the std output handler of the Logger class.
@@ -174,7 +208,7 @@ class ColorFormatter(logging.Formatter):
174
208
  prefix = super(ColorFormatter, self).format(record)
175
209
  record.msg = raw_msg
176
210
  record.args = msg_args
177
- return self._log_styles[record.levelno] + Logger._fixLines(super(ColorFormatter, self).format(record)[len(prefix):], prefix) + Style.RESET_ALL
211
+ return self._log_styles[record.levelno] + Logger._fixLines(super(ColorFormatter, self).format(record)[len(prefix):], prefix, is_ui=True) + Style.RESET_ALL
178
212
 
179
213
  class LinesFormatter(logging.Formatter):
180
214
  """Custom formatter to add support for multiline records."""
@@ -141,7 +141,7 @@ class PrompterFormatter(ColorFormatter):
141
141
  record.msg = raw_msg
142
142
  record.args = msg_args
143
143
  # avoid a double prefix
144
- record.msg = Logger._fixLines(super(ColorFormatter, self).format(record)[len(prefix) - len(self_prefix):], prefix)
144
+ record.msg = Logger._fixLines(super(ColorFormatter, self).format(record)[len(prefix) - len(self_prefix):], prefix, is_ui=True)
145
145
  record.args = []
146
146
  result = super(PrompterFormatter, self).format(record)
147
147
  record.msg = raw_msg
@@ -0,0 +1,49 @@
1
+ Metadata-Version: 2.1
2
+ Name: elementals
3
+ Version: 1.3.2
4
+ Summary: Basic utilities for CTF (or exploit) scripts
5
+ Home-page: https://github.com/eyalitki/elementals
6
+ Author: Eyal Itkin
7
+ Author-email: eyal.itkin@gmail.com
8
+ License: MIT
9
+ Classifier: Programming Language :: Python
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: colorama
15
+ Requires-Dist: hexdump
16
+ Requires-Dist: pydocstyle
17
+ Requires-Dist: flake8
18
+ Requires-Dist: six
19
+
20
+ # elementals
21
+ Python package with basic utilities for CTF scripts (works well for exploit PoCs too).
22
+
23
+ ## Install
24
+ ```pip install elementals```
25
+
26
+ ## Read The Docs
27
+ https://elementals.readthedocs.io/
28
+
29
+ ## Github
30
+ https://github.com/eyalitki/elementals
31
+
32
+ ## Brief
33
+ The **elementals** python package is a utility package with handy tools for CTF scripts and PoC-style scripts. What was first implemented for personal use in small research scripts was now upgraded to be used by security researchers as a lightweight substitute to the famous pwntools package.
34
+
35
+ The features included in **elementals** are:
36
+ * **Logger:** Basic (logging based) logger - configured and ready to use
37
+ * **Prompter:** Metasploit based stdout wrapper for the logger
38
+ * **ProgressBar:** User-friendly graphical progress bar
39
+ * **StatusBar:** User-friendly graphical status bar
40
+ * **createAnchor:** Creates a time-stamped output directory for all script outputs
41
+ * **hexDump:** Stylized hex dump for binary blobs / strings
42
+
43
+ ## Used by
44
+ The **elementals** package is used in most of my scripts and also in my public Github projects:
45
+ * **Scout Debugger** - https://github.com/CheckPointSW/Scout
46
+ * **Karta (IDA Plugin)** - https://github.com/CheckPointSW/Karta
47
+
48
+ ## References
49
+ * E-mail: eyal dot itkin at gmail dot com
@@ -1,12 +1,12 @@
1
- [bdist_wheel]
2
- universal = 1
3
-
4
- [flake8]
5
- exclude = .git,__init__.py
6
- max-line-length = 119
7
- ignore = E272, E501, E221, E302, E241, E126
8
-
9
- [egg_info]
10
- tag_build =
11
- tag_date = 0
12
-
1
+ [bdist_wheel]
2
+ universal = 1
3
+
4
+ [flake8]
5
+ exclude = .git,__init__.py
6
+ max-line-length = 119
7
+ ignore = E272, E501, E221, E302, E241, E126
8
+
9
+ [egg_info]
10
+ tag_build =
11
+ tag_date = 0
12
+
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
  from codecs import open
3
3
  from os import path
4
4
 
5
- # Different from the README.md, because PyPi struggles with shwoing PNG images
5
+ # Different from the README.md, because PyPi struggles with showing PNG images
6
6
  long_description = '''# elementals
7
7
  Python package with basic utilities for CTF scripts (works well for exploit PoCs too).
8
8
 
@@ -32,11 +32,10 @@ The **elementals** package is used in most of my scripts and also in my public G
32
32
  * **Karta (IDA Plugin)** - https://github.com/CheckPointSW/Karta
33
33
 
34
34
  ## References
35
- * Twitter: [@EyalItkin](https://twitter.com/EyalItkin)
36
35
  * E-mail: eyal dot itkin at gmail dot com'''
37
36
 
38
37
  setup(name='elementals',
39
- version='1.3.1',
38
+ version='1.3.2',
40
39
  description='Basic utilities for CTF (or exploit) scripts',
41
40
  author='Eyal Itkin',
42
41
  author_email='eyal.itkin@gmail.com',
@@ -17,6 +17,7 @@ prompt.info("Started the script")
17
17
  prompt.info("Phase #1 - collecting the data")
18
18
  prompt.addIndent()
19
19
  prompt.info("Searching for the tool")
20
+ prompt.debug("Search will take 10 seconds")
20
21
 
21
22
  s = StatusBar('Searching for the ELF\'s start', 30, time_format = "Elapsed %M:%S -")
22
23
  s.start()
@@ -42,9 +43,9 @@ time.sleep( 0.5 )
42
43
  p.advance( 200 )
43
44
  p.finish( )
44
45
 
45
- prompt.debug("The leaked data is:")
46
+ prompt.info('\033[36m' + "The leaked data is:" + '\033[0m')
46
47
  prompt.addIndent()
47
- prompt.debug(hexDump("".join(map(chr, range(250)))))
48
+ prompt.info('\n' + hexDump(b"".join(map(lambda x: chr(x).encode(), range(250)))))
48
49
  prompt.removeIndent()
49
50
 
50
51
  prompt.removeIndent()
elementals-1.3.1/PKG-INFO DELETED
@@ -1,44 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: elementals
3
- Version: 1.3.1
4
- Summary: Basic utilities for CTF (or exploit) scripts
5
- Home-page: https://github.com/eyalitki/elementals
6
- Author: Eyal Itkin
7
- Author-email: eyal.itkin@gmail.com
8
- License: MIT
9
- Description: # elementals
10
- Python package with basic utilities for CTF scripts (works well for exploit PoCs too).
11
-
12
- ## Install
13
- ```pip install elementals```
14
-
15
- ## Read The Docs
16
- https://elementals.readthedocs.io/
17
-
18
- ## Github
19
- https://github.com/eyalitki/elementals
20
-
21
- ## Brief
22
- The **elementals** python package is a utility package with handy tools for CTF scripts and PoC-style scripts. What was first implemented for personal use in small research scripts was now upgraded to be used by security researchers as a lightweight substitute to the famous pwntools package.
23
-
24
- The features included in **elementals** are:
25
- * **Logger:** Basic (logging based) logger - configured and ready to use
26
- * **Prompter:** Metasploit based stdout wrapper for the logger
27
- * **ProgressBar:** User-friendly graphical progress bar
28
- * **StatusBar:** User-friendly graphical status bar
29
- * **createAnchor:** Creates a time-stamped output directory for all script outputs
30
- * **hexDump:** Stylized hex dump for binary blobs / strings
31
-
32
- ## Used by
33
- The **elementals** package is used in most of my scripts and also in my public Github projects:
34
- * **Scout Debugger** - https://github.com/CheckPointSW/Scout
35
- * **Karta (IDA Plugin)** - https://github.com/CheckPointSW/Karta
36
-
37
- ## References
38
- * Twitter: [@EyalItkin](https://twitter.com/EyalItkin)
39
- * E-mail: eyal dot itkin at gmail dot com
40
- Platform: UNKNOWN
41
- Classifier: Programming Language :: Python
42
- Classifier: License :: OSI Approved :: MIT License
43
- Classifier: Operating System :: OS Independent
44
- Description-Content-Type: text/markdown
@@ -1,44 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: elementals
3
- Version: 1.3.1
4
- Summary: Basic utilities for CTF (or exploit) scripts
5
- Home-page: https://github.com/eyalitki/elementals
6
- Author: Eyal Itkin
7
- Author-email: eyal.itkin@gmail.com
8
- License: MIT
9
- Description: # elementals
10
- Python package with basic utilities for CTF scripts (works well for exploit PoCs too).
11
-
12
- ## Install
13
- ```pip install elementals```
14
-
15
- ## Read The Docs
16
- https://elementals.readthedocs.io/
17
-
18
- ## Github
19
- https://github.com/eyalitki/elementals
20
-
21
- ## Brief
22
- The **elementals** python package is a utility package with handy tools for CTF scripts and PoC-style scripts. What was first implemented for personal use in small research scripts was now upgraded to be used by security researchers as a lightweight substitute to the famous pwntools package.
23
-
24
- The features included in **elementals** are:
25
- * **Logger:** Basic (logging based) logger - configured and ready to use
26
- * **Prompter:** Metasploit based stdout wrapper for the logger
27
- * **ProgressBar:** User-friendly graphical progress bar
28
- * **StatusBar:** User-friendly graphical status bar
29
- * **createAnchor:** Creates a time-stamped output directory for all script outputs
30
- * **hexDump:** Stylized hex dump for binary blobs / strings
31
-
32
- ## Used by
33
- The **elementals** package is used in most of my scripts and also in my public Github projects:
34
- * **Scout Debugger** - https://github.com/CheckPointSW/Scout
35
- * **Karta (IDA Plugin)** - https://github.com/CheckPointSW/Karta
36
-
37
- ## References
38
- * Twitter: [@EyalItkin](https://twitter.com/EyalItkin)
39
- * E-mail: eyal dot itkin at gmail dot com
40
- Platform: UNKNOWN
41
- Classifier: Programming Language :: Python
42
- Classifier: License :: OSI Approved :: MIT License
43
- Classifier: Operating System :: OS Independent
44
- Description-Content-Type: text/markdown