ScriptCollection 3.4.56__py3-none-any.whl → 3.5.45__py3-none-any.whl
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.
- ScriptCollection/Executables.py +389 -353
- ScriptCollection/GeneralUtilities.py +54 -14
- ScriptCollection/ProcessesRunner.py +41 -0
- ScriptCollection/ProgramRunnerBase.py +47 -42
- ScriptCollection/ProgramRunnerEpew.py +122 -122
- ScriptCollection/ProgramRunnerPopen.py +51 -52
- ScriptCollection/RPStream.py +42 -0
- ScriptCollection/ScriptCollectionCore.py +1930 -1710
- ScriptCollection/TasksForCommonProjectStructure.py +2990 -2426
- ScriptCollection/UpdateCertificates.py +126 -128
- {ScriptCollection-3.4.56.dist-info → ScriptCollection-3.5.45.dist-info}/METADATA +22 -21
- ScriptCollection-3.5.45.dist-info/RECORD +16 -0
- {ScriptCollection-3.4.56.dist-info → ScriptCollection-3.5.45.dist-info}/WHEEL +1 -1
- {ScriptCollection-3.4.56.dist-info → ScriptCollection-3.5.45.dist-info}/entry_points.txt +3 -0
- ScriptCollection-3.4.56.dist-info/RECORD +0 -14
- {ScriptCollection-3.4.56.dist-info → ScriptCollection-3.5.45.dist-info}/top_level.txt +0 -0
ScriptCollection/Executables.py
CHANGED
|
@@ -1,353 +1,389 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import argparse
|
|
3
|
-
import time
|
|
4
|
-
import traceback
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
from .
|
|
8
|
-
from .
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
help='Prints column-titles in the name-mapping-csv-file')
|
|
17
|
-
parser.add_argument('--namemappingfile', default="NameMapping.csv", help='Specifies the file where the name-mapping will be written to')
|
|
18
|
-
parser.add_argument('--extensions', default="exe,py,sh",
|
|
19
|
-
help='Comma-separated list of file-extensions of files where this tool should be applied. Use "*" to obfuscate all')
|
|
20
|
-
parser.add_argument('--inputfolder', help='Specifies the foldere where the files are stored whose names should be obfuscated', required=True)
|
|
21
|
-
|
|
22
|
-
args = parser.parse_args()
|
|
23
|
-
ScriptCollectionCore().SCFilenameObfuscator(args.inputfolder, args.printtableheadline, args.namemappingfile, args.extensions)
|
|
24
|
-
return 0
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def CreateISOFileWithObfuscatedFiles() -> int:
|
|
28
|
-
parser = argparse.ArgumentParser(description='''Creates an iso file with the files in the given folder and changes their names and hash-values.
|
|
29
|
-
This script does not process subfolders transitively.''')
|
|
30
|
-
|
|
31
|
-
parser.add_argument('--inputfolder', help='Specifies the foldere where the files are stored which should be added to the iso-file', required=True)
|
|
32
|
-
parser.add_argument('--outputfile', default="files.iso", help='Specifies the output-iso-file and its location')
|
|
33
|
-
parser.add_argument('--printtableheadline', default=False, action='store_true', help='Prints column-titles in the name-mapping-csv-file')
|
|
34
|
-
parser.add_argument('--createnoisofile', default=False, action='store_true', help="Create no iso file")
|
|
35
|
-
parser.add_argument('--extensions', default="exe,py,sh", help='Comma-separated list of file-extensions of files where this tool should be applied. Use "*" to obfuscate all')
|
|
36
|
-
args = parser.parse_args()
|
|
37
|
-
|
|
38
|
-
ScriptCollectionCore().SCCreateISOFileWithObfuscatedFiles(args.inputfolder, args.outputfile, args.printtableheadline, not args.createnoisofile, args.extensions)
|
|
39
|
-
return 0
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def ChangeHashOfProgram() -> int:
|
|
43
|
-
parser = argparse.ArgumentParser(description='Changes the hash-value of arbitrary files by appending data at the end of the file.')
|
|
44
|
-
parser.add_argument('--inputfile', help='Specifies the script/executable-file whose hash-value should be changed', required=True)
|
|
45
|
-
args = parser.parse_args()
|
|
46
|
-
ScriptCollectionCore().SCChangeHashOfProgram(args.inputfile)
|
|
47
|
-
return 0
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def CalculateBitcoinBlockHash() -> int:
|
|
51
|
-
parser = argparse.ArgumentParser(description='Calculates the Hash of the header of a bitcoin-block.')
|
|
52
|
-
parser.add_argument('--version', help='Block-version', required=True)
|
|
53
|
-
parser.add_argument('--previousblockhash', help='Hash-value of the previous block', required=True)
|
|
54
|
-
parser.add_argument('--transactionsmerkleroot', help='Hashvalue of the merkle-root of the transactions which are contained in the block', required=True)
|
|
55
|
-
parser.add_argument('--timestamp', help='Timestamp of the block', required=True)
|
|
56
|
-
parser.add_argument('--target', help='difficulty', required=True)
|
|
57
|
-
parser.add_argument('--nonce', help='Arbitrary 32-bit-integer-value', required=True)
|
|
58
|
-
args = parser.parse_args()
|
|
59
|
-
|
|
60
|
-
args = parser.parse_args()
|
|
61
|
-
GeneralUtilities.write_message_to_stdout(ScriptCollectionCore().SCCalculateBitcoinBlockHash(args.version, args.previousblockhash,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
-
|
|
83
|
-
|
|
84
|
-
parser.
|
|
85
|
-
args
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
parser.add_argument('
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
args
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
parser.add_argument('
|
|
106
|
-
parser.add_argument('
|
|
107
|
-
parser.add_argument('
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
parser
|
|
119
|
-
parser.add_argument('
|
|
120
|
-
parser.add_argument('--
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
args
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
parser.add_argument('
|
|
132
|
-
parser.add_argument(
|
|
133
|
-
parser.add_argument("--
|
|
134
|
-
parser.add_argument("--
|
|
135
|
-
parser.add_argument("--
|
|
136
|
-
parser.add_argument(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
args
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
parser
|
|
155
|
-
parser.add_argument('
|
|
156
|
-
parser.add_argument('sourcebranch',
|
|
157
|
-
parser.add_argument('
|
|
158
|
-
parser.
|
|
159
|
-
parser.
|
|
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
|
-
parser
|
|
186
|
-
parser.add_argument('
|
|
187
|
-
parser.
|
|
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
|
-
return
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
parser.add_argument('--
|
|
243
|
-
|
|
244
|
-
parser.
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
parser =
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
parser =
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
parser =
|
|
300
|
-
parser.add_argument('--
|
|
301
|
-
parser.add_argument('--
|
|
302
|
-
parser.add_argument('--
|
|
303
|
-
parser.
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
parser =
|
|
315
|
-
parser.add_argument('--
|
|
316
|
-
parser.add_argument('--
|
|
317
|
-
parser.add_argument('--
|
|
318
|
-
parser.add_argument('--
|
|
319
|
-
parser.
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
parser =
|
|
332
|
-
parser.add_argument('--
|
|
333
|
-
parser.
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
1
|
+
import os
|
|
2
|
+
import argparse
|
|
3
|
+
import time
|
|
4
|
+
import traceback
|
|
5
|
+
import sys
|
|
6
|
+
import keyboard
|
|
7
|
+
from .TasksForCommonProjectStructure import TasksForCommonProjectStructure
|
|
8
|
+
from .ScriptCollectionCore import ScriptCollectionCore
|
|
9
|
+
from .GeneralUtilities import GeneralUtilities
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def FilenameObfuscator() -> int:
|
|
13
|
+
parser = argparse.ArgumentParser(description=''''Obfuscates the names of all files in the given folder.
|
|
14
|
+
Caution: This script can cause harm if you pass a wrong inputfolder-argument.''')
|
|
15
|
+
|
|
16
|
+
parser.add_argument('--printtableheadline', type=GeneralUtilities.string_to_boolean, const=True, default=True, nargs='?', help='Prints column-titles in the name-mapping-csv-file')
|
|
17
|
+
parser.add_argument('--namemappingfile', default="NameMapping.csv", help='Specifies the file where the name-mapping will be written to')
|
|
18
|
+
parser.add_argument('--extensions', default="exe,py,sh",
|
|
19
|
+
help='Comma-separated list of file-extensions of files where this tool should be applied. Use "*" to obfuscate all')
|
|
20
|
+
parser.add_argument('--inputfolder', help='Specifies the foldere where the files are stored whose names should be obfuscated', required=True)
|
|
21
|
+
|
|
22
|
+
args = parser.parse_args()
|
|
23
|
+
ScriptCollectionCore().SCFilenameObfuscator(args.inputfolder, args.printtableheadline, args.namemappingfile, args.extensions)
|
|
24
|
+
return 0
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def CreateISOFileWithObfuscatedFiles() -> int:
|
|
28
|
+
parser = argparse.ArgumentParser(description='''Creates an iso file with the files in the given folder and changes their names and hash-values.
|
|
29
|
+
This script does not process subfolders transitively.''')
|
|
30
|
+
|
|
31
|
+
parser.add_argument('--inputfolder', help='Specifies the foldere where the files are stored which should be added to the iso-file', required=True)
|
|
32
|
+
parser.add_argument('--outputfile', default="files.iso", help='Specifies the output-iso-file and its location')
|
|
33
|
+
parser.add_argument('--printtableheadline', default=False, action='store_true', help='Prints column-titles in the name-mapping-csv-file')
|
|
34
|
+
parser.add_argument('--createnoisofile', default=False, action='store_true', help="Create no iso file")
|
|
35
|
+
parser.add_argument('--extensions', default="exe,py,sh", help='Comma-separated list of file-extensions of files where this tool should be applied. Use "*" to obfuscate all')
|
|
36
|
+
args = parser.parse_args()
|
|
37
|
+
|
|
38
|
+
ScriptCollectionCore().SCCreateISOFileWithObfuscatedFiles(args.inputfolder, args.outputfile, args.printtableheadline, not args.createnoisofile, args.extensions)
|
|
39
|
+
return 0
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def ChangeHashOfProgram() -> int:
|
|
43
|
+
parser = argparse.ArgumentParser(description='Changes the hash-value of arbitrary files by appending data at the end of the file.')
|
|
44
|
+
parser.add_argument('--inputfile', help='Specifies the script/executable-file whose hash-value should be changed', required=True)
|
|
45
|
+
args = parser.parse_args()
|
|
46
|
+
ScriptCollectionCore().SCChangeHashOfProgram(args.inputfile)
|
|
47
|
+
return 0
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def CalculateBitcoinBlockHash() -> int:
|
|
51
|
+
parser = argparse.ArgumentParser(description='Calculates the Hash of the header of a bitcoin-block.')
|
|
52
|
+
parser.add_argument('--version', help='Block-version', required=True)
|
|
53
|
+
parser.add_argument('--previousblockhash', help='Hash-value of the previous block', required=True)
|
|
54
|
+
parser.add_argument('--transactionsmerkleroot', help='Hashvalue of the merkle-root of the transactions which are contained in the block', required=True)
|
|
55
|
+
parser.add_argument('--timestamp', help='Timestamp of the block', required=True)
|
|
56
|
+
parser.add_argument('--target', help='difficulty', required=True)
|
|
57
|
+
parser.add_argument('--nonce', help='Arbitrary 32-bit-integer-value', required=True)
|
|
58
|
+
args = parser.parse_args()
|
|
59
|
+
|
|
60
|
+
args = parser.parse_args()
|
|
61
|
+
GeneralUtilities.write_message_to_stdout(ScriptCollectionCore().SCCalculateBitcoinBlockHash(args.version, args.previousblockhash, args.transactionsmerkleroot, args.timestamp, args.target, args.nonce))
|
|
62
|
+
return 0
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def Show2FAAsQRCode():
|
|
66
|
+
|
|
67
|
+
parser = argparse.ArgumentParser(description="""Always when you use 2-factor-authentication you have the problem:
|
|
68
|
+
Where to backup the secret-key so that it is easy to re-setup them when you have a new phone?
|
|
69
|
+
Using this script is a solution. Always when you setup a 2fa you copy and store the secret in a csv-file.
|
|
70
|
+
It should be obviously that this csv-file must be stored encrypted!
|
|
71
|
+
Now if you want to move your 2fa-codes to a new phone you simply call "SCShow2FAAsQRCode 2FA.csv"
|
|
72
|
+
Then the qr-codes will be displayed in the console and you can scan them on your new phone.
|
|
73
|
+
This script does not saving the any data anywhere.
|
|
74
|
+
|
|
75
|
+
The structure of the csv-file can be viewd here:
|
|
76
|
+
Displayname;Website;Email-address;Secret;Period;
|
|
77
|
+
Amazon;Amazon.de;myemailaddress@example.com;QWERTY;30;
|
|
78
|
+
Google;Google.de;myemailaddress@example.com;ASDFGH;30;
|
|
79
|
+
|
|
80
|
+
Hints:
|
|
81
|
+
-Since the first line of the csv-file contains headlines the first line will always be ignored
|
|
82
|
+
-30 is the commonly used value for the period""")
|
|
83
|
+
parser.add_argument('csvfile', help='File where the 2fa-codes are stored')
|
|
84
|
+
args = parser.parse_args()
|
|
85
|
+
ScriptCollectionCore().SCShow2FAAsQRCode(args.csvfile)
|
|
86
|
+
return 0
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def SearchInFiles() -> int:
|
|
90
|
+
parser = argparse.ArgumentParser(description='''Searchs for the given searchstrings in the content of all files in the given folder.
|
|
91
|
+
This program prints all files where the given searchstring was found to the console''')
|
|
92
|
+
|
|
93
|
+
parser.add_argument('folder', help='Folder for search')
|
|
94
|
+
parser.add_argument('searchstring', help='string to look for')
|
|
95
|
+
|
|
96
|
+
args = parser.parse_args()
|
|
97
|
+
ScriptCollectionCore().SCSearchInFiles(args.folder, args.searchstring)
|
|
98
|
+
return 0
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def ReplaceSubstringsInFilenames() -> int:
|
|
102
|
+
parser = argparse.ArgumentParser(description='Replaces certain substrings in filenames. This program requires "pip install Send2Trash" in certain cases.')
|
|
103
|
+
|
|
104
|
+
parser.add_argument('folder', help='Folder where the files are stored which should be renamed')
|
|
105
|
+
parser.add_argument('substringInFilename', help='String to be replaced')
|
|
106
|
+
parser.add_argument('newSubstringInFilename', help='new string value for filename')
|
|
107
|
+
parser.add_argument('conflictResolveMode', help='''Set a method how to handle cases where a file with the new filename already exits and
|
|
108
|
+
the files have not the same content. Possible values are: ignore, preservenewest, merge''')
|
|
109
|
+
|
|
110
|
+
args = parser.parse_args()
|
|
111
|
+
|
|
112
|
+
ScriptCollectionCore().SCReplaceSubstringsInFilenames(args.folder, args.substringInFilename, args.newSubstringInFilename, args.conflictResolveMode)
|
|
113
|
+
return 0
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def GenerateSnkFiles() -> int:
|
|
117
|
+
parser = argparse.ArgumentParser(description='Generate multiple .snk-files')
|
|
118
|
+
parser.add_argument('outputfolder', help='Folder where the files are stored which should be hashed')
|
|
119
|
+
parser.add_argument('--keysize', default='4096')
|
|
120
|
+
parser.add_argument('--amountofkeys', default='10')
|
|
121
|
+
|
|
122
|
+
args = parser.parse_args()
|
|
123
|
+
ScriptCollectionCore().SCGenerateSnkFiles(args.outputfolder, args.keysize, args.amountofkeys)
|
|
124
|
+
return 0
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def OrganizeLinesInFile() -> int:
|
|
128
|
+
parser = argparse.ArgumentParser(description='Processes the lines of a file with the given commands')
|
|
129
|
+
|
|
130
|
+
parser.add_argument('file', help='File which should be transformed')
|
|
131
|
+
parser.add_argument('--encoding', default="utf-8", help='Encoding for the file which should be transformed')
|
|
132
|
+
parser.add_argument("--sort", help="Sort lines", action='store_true')
|
|
133
|
+
parser.add_argument("--remove_duplicated_lines", help="Remove duplicate lines", action='store_true')
|
|
134
|
+
parser.add_argument("--ignore_first_line", help="Ignores the first line in the file", action='store_true')
|
|
135
|
+
parser.add_argument("--remove_empty_lines", help="Removes lines which are empty or contains only whitespaces", action='store_true')
|
|
136
|
+
parser.add_argument('--ignored_start_character', default="", help='Characters which should not be considered at the begin of a line')
|
|
137
|
+
|
|
138
|
+
args = parser.parse_args()
|
|
139
|
+
return ScriptCollectionCore().sc_organize_lines_in_file(args.file, args.encoding, args.sort, args.remove_duplicated_lines, args.ignore_first_line, args.remove_empty_lines, list(args.ignored_start_character))
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def CreateHashOfAllFiles() -> int:
|
|
143
|
+
parser = argparse.ArgumentParser(description='Calculates the SHA-256-value of all files in the given folder and stores the hash-value in a file next to the hashed file.')
|
|
144
|
+
parser.add_argument('folder', help='Folder where the files are stored which should be hashed')
|
|
145
|
+
args = parser.parse_args()
|
|
146
|
+
ScriptCollectionCore().SCCreateHashOfAllFiles(args.folder)
|
|
147
|
+
return 0
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def CreateSimpleMergeWithoutRelease() -> int:
|
|
151
|
+
parser = argparse.ArgumentParser(description='TODO')
|
|
152
|
+
parser.add_argument('repository', help='TODO')
|
|
153
|
+
parser.add_argument('sourcebranch', default="stable", help='TODO')
|
|
154
|
+
parser.add_argument('targetbranch', default="master", help='TODO')
|
|
155
|
+
parser.add_argument('remotename', default=None, help='TODO')
|
|
156
|
+
parser.add_argument('--remove-sourcebranch', dest='removesourcebranch', action='store_true', help='TODO')
|
|
157
|
+
parser.add_argument('--no-remove-sourcebranch', dest='removesourcebranch', action='store_false', help='TODO')
|
|
158
|
+
parser.set_defaults(removesourcebranch=False)
|
|
159
|
+
args = parser.parse_args()
|
|
160
|
+
ScriptCollectionCore().SCCreateSimpleMergeWithoutRelease(args.repository, args.sourcebranch, args.targetbranch, args.remotename, args.removesourcebranch)
|
|
161
|
+
return 0
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def CreateEmptyFileWithSpecificSize() -> int:
|
|
165
|
+
parser = argparse.ArgumentParser(description='Creates a file with a specific size')
|
|
166
|
+
parser.add_argument('name', help='Specifies the name of the created file')
|
|
167
|
+
parser.add_argument('size', help='Specifies the size of the created file')
|
|
168
|
+
args = parser.parse_args()
|
|
169
|
+
return ScriptCollectionCore().SCCreateEmptyFileWithSpecificSize(args.name, args.size)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def ShowMissingFiles() -> int:
|
|
173
|
+
parser = argparse.ArgumentParser(description='Shows all files which are in folderA but not in folder B. This program does not do any content-comparisons.')
|
|
174
|
+
parser.add_argument('folderA')
|
|
175
|
+
parser.add_argument('folderB')
|
|
176
|
+
args = parser.parse_args()
|
|
177
|
+
ScriptCollectionCore().show_missing_files(args.folderA, args.folderB)
|
|
178
|
+
return 0
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def ExtractPDFPages() -> int:
|
|
182
|
+
parser = argparse.ArgumentParser(description='Extract pages from PDF-file')
|
|
183
|
+
parser.add_argument('file', help='Input file')
|
|
184
|
+
parser.add_argument('frompage', help='First page')
|
|
185
|
+
parser.add_argument('topage', help='Last page')
|
|
186
|
+
parser.add_argument('outputfile', help='File for the resulting PDF-document')
|
|
187
|
+
args = parser.parse_args()
|
|
188
|
+
ScriptCollectionCore().extract_pdf_pages(args.file, int(args.frompage), int(args.topage), args.outputfile)
|
|
189
|
+
return 0
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def MergePDFs() -> int:
|
|
193
|
+
parser = argparse.ArgumentParser(description='Merges PDF-files')
|
|
194
|
+
parser.add_argument('files', help='Comma-separated filenames')
|
|
195
|
+
parser.add_argument('outputfile', help='File for the resulting PDF-document')
|
|
196
|
+
args = parser.parse_args()
|
|
197
|
+
ScriptCollectionCore().merge_pdf_files(args.files.split(','), args.outputfile)
|
|
198
|
+
return 0
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def PDFToImage() -> int:
|
|
202
|
+
parser = argparse.ArgumentParser(description='Converts a PDF-document to an image')
|
|
203
|
+
parser.add_argument('file', help='Input-file')
|
|
204
|
+
parser.add_argument('outputfilename_without_extension', help='File for the resulting image')
|
|
205
|
+
args = parser.parse_args()
|
|
206
|
+
ScriptCollectionCore().pdf_to_image(args.file, args.outputfilename_without_extension)
|
|
207
|
+
return 0
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def KeyboardDiagnosis() -> None:
|
|
211
|
+
"""Caution: This function does usually never terminate"""
|
|
212
|
+
keyboard.hook(__keyhook)
|
|
213
|
+
while True:
|
|
214
|
+
time.sleep(10)
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
def __keyhook(self, event) -> None:
|
|
218
|
+
GeneralUtilities.write_message_to_stdout(str(event.name)+" "+event.event_type)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
def GenerateThumbnail() -> int:
|
|
222
|
+
parser = argparse.ArgumentParser(description='Generate thumpnails for video-files')
|
|
223
|
+
parser.add_argument('file', help='Input-videofile for thumbnail-generation')
|
|
224
|
+
parser.add_argument('framerate', help='', default="16")
|
|
225
|
+
args = parser.parse_args()
|
|
226
|
+
try:
|
|
227
|
+
ScriptCollectionCore().generate_thumbnail(args.file, args.framerate)
|
|
228
|
+
return 0
|
|
229
|
+
except Exception as exception:
|
|
230
|
+
GeneralUtilities.write_exception_to_stderr_with_traceback(exception, traceback)
|
|
231
|
+
return 1
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
def ObfuscateFilesFolder() -> int:
|
|
235
|
+
parser = argparse.ArgumentParser(description='''Changes the hash-value of the files in the given folder and renames them to obfuscated names.
|
|
236
|
+
This script does not process subfolders transitively.
|
|
237
|
+
Caution: This script can cause harm if you pass a wrong inputfolder-argument.''')
|
|
238
|
+
|
|
239
|
+
parser.add_argument('--printtableheadline', type=GeneralUtilities.string_to_boolean, const=True, default=True, nargs='?', help='Prints column-titles in the name-mapping-csv-file')
|
|
240
|
+
parser.add_argument('--namemappingfile', default="NameMapping.csv", help='Specifies the file where the name-mapping will be written to')
|
|
241
|
+
parser.add_argument('--extensions', default="exe,py,sh", help='Comma-separated list of file-extensions of files where this tool should be applied. Use "*" to obfuscate all')
|
|
242
|
+
parser.add_argument('--inputfolder', help='Specifies the folder where the files are stored whose names should be obfuscated', required=True)
|
|
243
|
+
|
|
244
|
+
args = parser.parse_args()
|
|
245
|
+
ScriptCollectionCore().SCObfuscateFilesFolder(args.inputfolder, args.printtableheadline, args.namemappingfile, args.extensions)
|
|
246
|
+
return 0
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
def HealthCheck() -> int:
|
|
250
|
+
parser = argparse.ArgumentParser()
|
|
251
|
+
parser.add_argument('--file', required=True)
|
|
252
|
+
args = parser.parse_args()
|
|
253
|
+
return ScriptCollectionCore().SCHealthcheck(args.file)
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
def BuildCodeUnit() -> int:
|
|
257
|
+
parser = argparse.ArgumentParser()
|
|
258
|
+
parser.add_argument('--codeunitfolder', required=False, default=".")
|
|
259
|
+
parser.add_argument('-v', '--verbosity', required=False, default=1)
|
|
260
|
+
parser.add_argument('--targetenvironment', required=False, default="QualityCheck")
|
|
261
|
+
parser.add_argument('--additionalargumentsfile', required=False, default=None)
|
|
262
|
+
parser.add_argument('--assume_dependent_codeunits_are_already_built', type=GeneralUtilities.string_to_boolean, const=True, default=False, nargs='?')
|
|
263
|
+
args = parser.parse_args()
|
|
264
|
+
TasksForCommonProjectStructure().build_codeunit(args.codeunitfolder, int(args.verbosity), args.targetenvironment, args.additionalargumentsfile, False, None, args.assume_dependent_codeunits_are_already_built, sys.argv)
|
|
265
|
+
return 0
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
def BuildCodeUnits() -> int:
|
|
269
|
+
parser = argparse.ArgumentParser()
|
|
270
|
+
parser.add_argument('--repositoryfolder', required=False, default=".")
|
|
271
|
+
parser.add_argument('-v', '--verbosity', required=False, default=1)
|
|
272
|
+
parser.add_argument('--targetenvironment', required=False, default="QualityCheck")
|
|
273
|
+
parser.add_argument('--additionalargumentsfile', required=False, default=None)
|
|
274
|
+
parser.add_argument('--removeuncommittedfiles', required=False, default=False, action='store_true')
|
|
275
|
+
args = parser.parse_args()
|
|
276
|
+
TasksForCommonProjectStructure().build_codeunits(args.repositoryfolder, int(args.verbosity), args.targetenvironment, args.additionalargumentsfile, False, None, sys.argv, args.removeuncommittedfiles)
|
|
277
|
+
return 0
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
def BuildCodeUnitsC() -> int:
|
|
281
|
+
parser = argparse.ArgumentParser()
|
|
282
|
+
parser.add_argument('--repositoryfolder', required=False, default=".")
|
|
283
|
+
parser.add_argument('-v', '--verbosity', required=False, default=1)
|
|
284
|
+
parser.add_argument('--targetenvironment', required=False, default="QualityCheck")
|
|
285
|
+
parser.add_argument('--additionalargumentsfile', required=False, default=None)
|
|
286
|
+
parser.add_argument('--image', required=False, default="scbuilder:latest")
|
|
287
|
+
args = parser.parse_args()
|
|
288
|
+
GeneralUtilities.reconfigure_standrd_input_and_outputs()
|
|
289
|
+
TasksForCommonProjectStructure().build_codeunitsC(args.repositoryfolder, args.image, int(args.verbosity), args.targetenvironment, args.additionalargumentsfile, sys.argv)
|
|
290
|
+
return 0
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
def GenerateCertificateAuthority() -> int:
|
|
294
|
+
parser = argparse.ArgumentParser()
|
|
295
|
+
parser.add_argument('--name', required=True)
|
|
296
|
+
parser.add_argument('--subj_c', required=True)
|
|
297
|
+
parser.add_argument('--subj_st', required=True)
|
|
298
|
+
parser.add_argument('--subj_l', required=True)
|
|
299
|
+
parser.add_argument('--subj_o', required=True)
|
|
300
|
+
parser.add_argument('--subj_ou', required=True)
|
|
301
|
+
parser.add_argument('--days_until_expire', required=False, default=None, type=int)
|
|
302
|
+
parser.add_argument('--password', required=False, default=None)
|
|
303
|
+
args = parser.parse_args()
|
|
304
|
+
ScriptCollectionCore().generate_certificate_authority(os.getcwd(), args.name, args.subj_c, args.subj_st, args.subj_l, args.subj_o, args.subj_ou, args.days_until_expire, args.password)
|
|
305
|
+
return 0
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
def GenerateCertificate() -> int:
|
|
309
|
+
parser = argparse.ArgumentParser()
|
|
310
|
+
parser.add_argument('--filename', required=True)
|
|
311
|
+
parser.add_argument('--domain', required=True)
|
|
312
|
+
parser.add_argument('--subj_c', required=True)
|
|
313
|
+
parser.add_argument('--subj_st', required=True)
|
|
314
|
+
parser.add_argument('--subj_l', required=True)
|
|
315
|
+
parser.add_argument('--subj_o', required=True)
|
|
316
|
+
parser.add_argument('--subj_ou', required=True)
|
|
317
|
+
parser.add_argument('--days_until_expire', required=False, default=None, type=int)
|
|
318
|
+
parser.add_argument('--password', required=False, default=None)
|
|
319
|
+
args = parser.parse_args()
|
|
320
|
+
ScriptCollectionCore().generate_certificate(os.getcwd(), args.domain, args.filename, args.subj_c, args.subj_st, args.subj_l, args.subj_o, args.subj_ou, args.days_until_expire, args.password)
|
|
321
|
+
return 0
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
def GenerateCertificateSignRequest() -> int:
|
|
325
|
+
parser = argparse.ArgumentParser()
|
|
326
|
+
parser.add_argument('--filename', required=True)
|
|
327
|
+
parser.add_argument('--domain', required=True)
|
|
328
|
+
parser.add_argument('--subj_c', required=True)
|
|
329
|
+
parser.add_argument('--subj_st', required=True)
|
|
330
|
+
parser.add_argument('--subj_l', required=True)
|
|
331
|
+
parser.add_argument('--subj_o', required=True)
|
|
332
|
+
parser.add_argument('--subj_ou', required=True)
|
|
333
|
+
args = parser.parse_args()
|
|
334
|
+
ScriptCollectionCore().generate_certificate_sign_request(os.getcwd(), args.domain, args.filename, args.subj_c, args.subj_st, args.subj_l, args.subj_o, args.sub_ou)
|
|
335
|
+
return 0
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
def SignCertificate() -> int:
|
|
339
|
+
parser = argparse.ArgumentParser()
|
|
340
|
+
parser.add_argument('--cafolder', required=True)
|
|
341
|
+
parser.add_argument('--caname', required=True)
|
|
342
|
+
parser.add_argument('--targetcertificate', required=True)
|
|
343
|
+
parser.add_argument('--filename', required=True)
|
|
344
|
+
parser.add_argument('--days_until_expire', required=False, default=None, type=int)
|
|
345
|
+
args = parser.parse_args()
|
|
346
|
+
ScriptCollectionCore().sign_certificate(os.getcwd(), args.cafolder, args.caname, args.targetcertificate, args.filename, args.args.days_until_expire)
|
|
347
|
+
return 0
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
def ChangeFileExtensions() -> int:
|
|
351
|
+
parser = argparse.ArgumentParser()
|
|
352
|
+
parser.add_argument('-f', '--folder', required=True)
|
|
353
|
+
parser.add_argument('-s', '--source_extension', required=True)
|
|
354
|
+
parser.add_argument('-t', '--target_extension', required=True)
|
|
355
|
+
parser.add_argument('-r', '--recursive', required=False, default=False, type=GeneralUtilities.string_to_boolean)
|
|
356
|
+
parser.add_argument('-i', '--ignore_case', required=False, default=True, type=GeneralUtilities.string_to_boolean)
|
|
357
|
+
args = parser.parse_args()
|
|
358
|
+
ScriptCollectionCore().change_file_extensions(args.folder, args.source_extension, args.target_extension, args.recursive, args.ignore_case)
|
|
359
|
+
return 0
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
def GenerateARC42ReferenceTemplate() -> int:
|
|
363
|
+
parser = argparse.ArgumentParser()
|
|
364
|
+
parser.add_argument('-f', '--folder', required=False)
|
|
365
|
+
parser.add_argument('-p', '--productname', required=False)
|
|
366
|
+
parser.add_argument('-s', '--subfolder', required=False)
|
|
367
|
+
args = parser.parse_args()
|
|
368
|
+
|
|
369
|
+
folder = args.folder
|
|
370
|
+
if folder is None:
|
|
371
|
+
folder = os.getcwd()
|
|
372
|
+
ScriptCollectionCore().generate_arc42_reference_template(folder, args.productname, args.subfolder)
|
|
373
|
+
return 0
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
def CreateChangelogEntry() -> int:
|
|
377
|
+
parser = argparse.ArgumentParser()
|
|
378
|
+
parser.add_argument('-f', '--repositoryfolder', required=False, default=".")
|
|
379
|
+
parser.add_argument('-m', '--message', required=True)
|
|
380
|
+
parser.add_argument('-c', '--commit', action='store_true', required=False, default=False)
|
|
381
|
+
args = parser.parse_args()
|
|
382
|
+
|
|
383
|
+
folder: str = None
|
|
384
|
+
if os.path.isabs(args.repositoryfolder):
|
|
385
|
+
folder = args.repositoryfolder
|
|
386
|
+
else:
|
|
387
|
+
folder = GeneralUtilities.resolve_relative_path(args.repositoryfolder, os.getcwd())
|
|
388
|
+
TasksForCommonProjectStructure().create_changelog_entry(folder, args.message, args.commit)
|
|
389
|
+
return 0
|