-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPKG-INFO
300 lines (268 loc) · 15.1 KB
/
PKG-INFO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
Metadata-Version: 2.1
Name: PythonToolsKit
Version: 1.2.6
Summary: This package implements tools to build python package and tools.
Home-page: https://github.com/mauricelambert/PythonToolsKit
Author: Maurice Lambert
Author-email: mauricelambert434@gmail.com
Maintainer: Maurice Lambert
Maintainer-email: mauricelambert434@gmail.com
License: GPL-3.0 License
Project-URL: Documentation Timeout, https://mauricelambert.github.io/info/python/code/PythonToolsKit/Timeout.html
Project-URL: Documentation Terminal, https://mauricelambert.github.io/info/python/code/PythonToolsKit/Terminal.html
Project-URL: Documentation StringF, https://mauricelambert.github.io/info/python/code/PythonToolsKit/StringF.html
Project-URL: Documentation PrintF, https://mauricelambert.github.io/info/python/code/PythonToolsKit/PrintF.html
Project-URL: Documentation Process, https://mauricelambert.github.io/info/python/code/PythonToolsKit/Process.html
Project-URL: Documentation Logs, https://mauricelambert.github.io/info/python/code/PythonToolsKit/Logs.html
Project-URL: Documentation GetPass, https://mauricelambert.github.io/info/python/code/PythonToolsKit/GetPass.html
Project-URL: Documentation Encodings, https://mauricelambert.github.io/info/python/code/PythonToolsKit/Encodings.html
Project-URL: Documentation DictObject, https://mauricelambert.github.io/info/python/code/PythonToolsKit/DictObject.html
Project-URL: Documentation Report, https://mauricelambert.github.io/info/python/code/PythonToolsKit/Report.html
Project-URL: Documentation urlopen, https://mauricelambert.github.io/info/python/code/PythonToolsKit/urlopen.html
Project-URL: Documentation Dict, https://mauricelambert.github.io/info/python/code/PythonToolsKit/Dict.html
Project-URL: Documentation Tuple, https://mauricelambert.github.io/info/python/code/PythonToolsKit/Tuple.html
Project-URL: Documentation List, https://mauricelambert.github.io/info/python/code/PythonToolsKit/List.html
Project-URL: Documentation Function, https://mauricelambert.github.io/info/python/code/PythonToolsKit/Function.html
Project-URL: Documentation Arguments, https://mauricelambert.github.io/info/python/code/PythonToolsKit/Arguments.html
Project-URL: Documentation Thread, https://mauricelambert.github.io/info/python/code/PythonToolsKit/Thread.html
Project-URL: Documentation Import, https://mauricelambert.github.io/info/python/code/PythonToolsKit/Import.html
Project-URL: Documentation ScapyTools, https://mauricelambert.github.io/info/python/code/PythonToolsKit/ScapyTools.html
Project-URL: Documentation GetFile, https://mauricelambert.github.io/info/python/code/PythonToolsKit/GetFile.html
Project-URL: Documentation GetType, https://mauricelambert.github.io/info/python/code/PythonToolsKit/GetType.html
Project-URL: Documentation Random, https://mauricelambert.github.io/info/python/code/PythonToolsKit/Random.html
Project-URL: Documentation Json, https://mauricelambert.github.io/info/python/code/PythonToolsKit/Json.html
Project-URL: Documentation WindowsTerminal, https://mauricelambert.github.io/info/python/code/PythonToolsKit/WindowsTerminal.html
Project-URL: Documentation Colors, https://mauricelambert.github.io/info/python/code/PythonToolsKit/Colors.html
Project-URL: Documentation DataAnalysis, https://mauricelambert.github.io/info/python/code/PythonToolsKit/DataAnalysis.html
Project-URL: Documentation RecursionDebug, https://mauricelambert.github.io/info/python/code/PythonToolsKit/RecursionDebug.html
Project-URL: Documentation OrdDict, https://mauricelambert.github.io/info/python/code/PythonToolsKit/OrdDict.html
Project-URL: Documentation Characters, https://mauricelambert.github.io/info/python/code/PythonToolsKit/Characters.html
Project-URL: Executable Characters, https://mauricelambert.github.io/info/python/code/PythonToolsKit/Characters.pyz
Project-URL: Documentation DebugEncoding, https://mauricelambert.github.io/info/python/code/PythonToolsKit/DebugEncoding.html
Project-URL: Executable DebugEncoding, https://mauricelambert.github.io/info/python/code/PythonToolsKit/DebugEncoding.pyz
Keywords: Timeout,Terminal,Colors,Formatting,Print,Object,Process,CSV,Logs,Getpass,Password,Ask,*,Encodings,Report,Markdown,HTML,JSON,Arguments,Input,Output,Operator,List,Tuple,Dict,Function,Statistic,Logs,Characters,urllib,Thread,Import,Scapy,Statistics
Platform: Windows
Platform: Linux
Platform: MacOS
Classifier: Programming Language :: Python
Classifier: Development Status :: 5 - Production/Stable
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.9
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: MacOS
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE.txt

# PythonToolsKit
## Description
This package implements useful tools and functions for producing python packages or tools implemented in python.
Features implemented:
- Timeout:
- Timeout decorator using MultiThreading
- Timeout decorator using MultiProcessing
- Timeout decorator using signal (UNIX only)
- Terminal: ANSI features for terminal (color, position of the cursor, style...)
- StringF:
- Format the strings length
- Make a table from Sequence of strings
- Make a table of Attribute/Value from python object
- PrintF:
- Print states of tasks/programs
- Print info, check OK/NOK, error... with prefix and color management
- Process: generator to read process output lines in real time
- Logs
- Default logger builder
- Decorator trace function (log the beginning and end of function execution)
- Colored logger (StreamHandler only)
- CSV formatter (logs in CSV format)
- Handler for compressed log file rotation and store indefinitely
- GetPass: a getpass function showing "\*"
- Encodings:
- Generator to obtain probable encodings
- Function to try to decode the data with probable encodings
- Fast Base64 functions (without types/regex checks)
- DictObject:
- Dynamic object (build from dict)
- JsonDeserializer
- CsvDeserializer
- Report:
- Report as text/markdown
- Report as CSV
- Report as JSON
- Report as HTML
- Statistics
- Sort and filter elements in the reports
- The frequency and percentage of filtered elements
- urlopen:
- New urlopen based on urllib.request with a easiest way to manage HTTP error code (using decorator)
- Dict:
- Clean dict (for example, after loading the API response, you want to keep only certain informations)
- Operator (some basic functions callable from operator)
- List:
- Operator (some basic functions callable from operator)
- Tuple:
- Operator (some basic functions callable from operator)
- Function:
- Operator (some basic functions callable from operator)
- Arguments:
- Password and password prompt
- Input file and stdin
- Output file and stdout
- Verbose mode
- Debug mode
- Thread:
- Join all
- Class SimpleThread
- Thread decorator
- Import:
- import from path/filename
- GetFile:
- Research an existant file from current directory and lib directory
- Open an existant file from current directory or lib directory
- ScapyTools:
- Command line arguments for scapy (ArgumentParser with an optional argument "interface" by default and iface research)
- GetType
- Type string value (None, bool, int, float, IP)
- Numbers (int, float) and IP/network generator from string
- Random: Get random strings (random length, generator, check for strong password, secure, urlsafe, ...)
- Json:
- Load invalid JSON
- Correct invalid JSON
- WindowsTerminal:
- Activate/desactivate temporary/persistent virtual terminal (colors, font, ...) on Windows
- Set temporary/persistent terminal transparency on Windows
- Colors:
- Build 8bits-color byte
- Get 3 bytes color from HTML/CSS colors (#HEX, rgb function and rgba function)
- Check and safe methods are available for all these features
- DataAnalysis:
- Data statistics
- frequences (pourcent)
- Keys
- Values
- Keys and values
- Keys and values counters
- averages
- variances
- deviations
- medians
- sum
- max
- min
- Data filtering
- Counter/getter
- Count/get values greater than
- Count/get values lesser than
- Count value equal to
- Count different values by key
- Sort
- Values
- Keys
- Values counters
- Values sum
- Generate chart (using matplotlib)
- statistictypes
- valuetypes (values)
- valuetypes (counters)
- Print data tables
- statistictypes
- dictionnaries
- valuetypes
- Group data by values
- RecursionDebug: Help you to debug RecursionError
- OrdDict: A fast and powerful *Ordered Dict*
- Characters: Returns integers, string (latin-1), binary and hexadecimal from integers, string (latin-1), binary or hexadecimal
- DebugEncoding: Found used encoding when you have encoding problems
## Requirements
This package require:
- python3
- python3 Standard Library
> To use `PythonToolsKit.ScapyTools` you need `Scapy`, but is not installed by default (because this is the only module that needs it), install it with `python3 -m pip install scapy`
> To use `PythonToolsKit.DataAnalysis.show_chart` you need `matplotlib`, but is not installed by default (because this is the only function that needs it), install it with `python3 -m pip install matplotlib`
## Installation
```bash
pip install PythonToolsKit
```
## Usages
Examples with responses (mode console) are available in HTML documentation.
Note for import: add `PythonToolsKit.<module>`
```python
from PythonToolsKit.Timeout import *
import PythonToolsKit.Timeout
```
### Tools
#### Characters
```bash
python3 Characters.pyz mystring
python3 -m PythonToolsKit.Characters integers 97,98,99
Characters string abc
Characters hexa 616263
Characters hexa '61-62-63'
Characters hexa '61 62 63'
Characters hexa '61:62:63'
Characters binary '1100001 1100010 1100011'
python3 DebugEncoding.pyz éêâ --bad-values "‚ˆƒ"
python3 -m PythonToolsKit.DebugEncoding éêâ --decoding cp1252 --bad-values "‚ˆƒ" --json
DebugEncoding éêâ
DebugEncoding éêâ --encoding cp437
```
## Unittests
For `GetType` and `Json`, `Encodings`, `Colors` and `WindowsTerminal` modules i use `doctest` (unittests in documentation) and `coverage`:
```bash
python3 GetType.py # run doctest with verbose mode
python3 -m doctest GetType.py # run doctest without verbose mode
coverage run GetType.py # Calcul coverage
coverage report # Report in console
coverage html # Report in HTML page
```
| Module | Coverage | Statements | missing |
|--------------------|-----------|------------|------------|
| GetType.py | 100% | 130 | 000 |
| Json.py | 100% | 046 | 000 |
| Encodings.py | 100% | 054 | 000 |
| WindowsTerminal.py | 094% | 096 | 006 |
| Colors.py | 100% | 176 | 000 |
| DataAnalysis.py | 100% | 290 | 000 |
| Report.py | 099% | 160 | 001 |
| StringF.py | 100% | 067 | 000 |
| OrdDict.py | 100% | 172 | 000 |
| Characters.py | 078% | 063 | 014 |
## Links
- [Github Page](https://github.com/mauricelambert/PythonToolsKit/)
- [Documentation Timeout](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Timeout.html)
- [Documentation Terminal](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Terminal.html)
- [Documentation StringF](https://mauricelambert.github.io/info/python/code/PythonToolsKit/StringF.html)
- [Documentation PrintF](https://mauricelambert.github.io/info/python/code/PythonToolsKit/PrintF.html)
- [Documentation Process](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Process.html)
- [Documentation Logs](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Logs.html)
- [Documentation GetPass](https://mauricelambert.github.io/info/python/code/PythonToolsKit/GetPass.html)
- [Documentation Encodings](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Encodings.html)
- [Documentation DictObject](https://mauricelambert.github.io/info/python/code/PythonToolsKit/DictObject.html)
- [Documentation Report](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Report.html)
- [Documentation urlopen](https://mauricelambert.github.io/info/python/code/PythonToolsKit/urlopen.html)
- [Documentation Dict](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Dict.html)
- [Documentation Arguments](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Arguments.html)
- [Documentation Tuple](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Tuple.html)
- [Documentation List](https://mauricelambert.github.io/info/python/code/PythonToolsKit/List.html)
- [Documentation Function](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Function.html)
- [Documentation Thread](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Thread.html)
- [Documentation Import](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Import.html)
- [Documentation ScapyTools](https://mauricelambert.github.io/info/python/code/PythonToolsKit/ScapyTools.html)
- [Documentation GetFile](https://mauricelambert.github.io/info/python/code/PythonToolsKit/GetFile.html)
- [Documentation GetType](https://mauricelambert.github.io/info/python/code/PythonToolsKit/GetType.html)
- [Documentation Random](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Random.html)
- [Documentation Json](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Json.html)
- [Documentation WindowsTerminal](https://mauricelambert.github.io/info/python/code/PythonToolsKit/WindowsTerminal.html)
- [Documentation Colors](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Colors.html)
- [Documentation DataAnalysis](https://mauricelambert.github.io/info/python/code/PythonToolsKit/DataAnalysis.html)
- [Documentation RecursionDebug](https://mauricelambert.github.io/info/python/code/PythonToolsKit/RecursionDebug.html)
- [Documentation OrdDict](https://mauricelambert.github.io/info/python/code/PythonToolsKit/OrdDict.html)
- [Documentation Characters](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Characters.html)
- [Executable Characters](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Characters.pyz)
- [Documentation DebugEncoding](https://mauricelambert.github.io/info/python/code/PythonToolsKit/DebugEncoding.html)
- [Executable DebugEncoding](https://mauricelambert.github.io/info/python/code/PythonToolsKit/DebugEncoding.pyz)
- [Pypi package](https://pypi.org/project/PythonToolsKit/)
## Licence
Licensed under the [GPL, version 3](https://www.gnu.org/licenses/).