malwareDetector 0.1.9__py3-none-any.whl → 0.1.10__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.
Potentially problematic release.
This version of malwareDetector might be problematic. Click here for more details.
- malwareDetector/config.py +25 -15
- malwareDetector/const.py +1 -1
- {malwareDetector-0.1.9.dist-info → malwareDetector-0.1.10.dist-info}/METADATA +1 -1
- malwareDetector-0.1.10.dist-info/RECORD +10 -0
- malwareDetector-0.1.9.dist-info/RECORD +0 -10
- {malwareDetector-0.1.9.dist-info → malwareDetector-0.1.10.dist-info}/LICENCE.txt +0 -0
- {malwareDetector-0.1.9.dist-info → malwareDetector-0.1.10.dist-info}/WHEEL +0 -0
- {malwareDetector-0.1.9.dist-info → malwareDetector-0.1.10.dist-info}/top_level.txt +0 -0
malwareDetector/config.py
CHANGED
|
@@ -25,6 +25,7 @@ class PathConfig(BaseModel, extra=Extra.allow):
|
|
|
25
25
|
'''
|
|
26
26
|
input: str = DEFAULT_INPUT_PATH
|
|
27
27
|
output: str = DEFAULT_OUT_PATH
|
|
28
|
+
config: str = DEFAULT_CONFIG_PATH
|
|
28
29
|
|
|
29
30
|
def set_param(self, __name: str, __value: Any):
|
|
30
31
|
if hasattr(self, __name):
|
|
@@ -185,6 +186,12 @@ def parameter_parser(config: Config) -> Config:
|
|
|
185
186
|
help="Embeddings path."
|
|
186
187
|
)
|
|
187
188
|
|
|
189
|
+
parser.add_argument("--config-path","-c",
|
|
190
|
+
dest="config_path",
|
|
191
|
+
nargs="?",
|
|
192
|
+
default=DEFAULT_CONFIG_PATH,
|
|
193
|
+
help="Configuration file path.")
|
|
194
|
+
|
|
188
195
|
parser.add_argument("--dimensions",
|
|
189
196
|
dest="dimensions",
|
|
190
197
|
type=int,
|
|
@@ -241,7 +248,7 @@ def parameter_parser(config: Config) -> Config:
|
|
|
241
248
|
help='Select the model(KNN, LR, MLP, RF, SVM).'
|
|
242
249
|
)
|
|
243
250
|
|
|
244
|
-
parser.add_argument('--classify', '-
|
|
251
|
+
parser.add_argument('--classify', '-f',
|
|
245
252
|
dest="classify",
|
|
246
253
|
action='store_true',
|
|
247
254
|
default=DEFAULT_CLASSIFY,
|
|
@@ -251,6 +258,7 @@ def parameter_parser(config: Config) -> Config:
|
|
|
251
258
|
args = parser.parse_args()
|
|
252
259
|
config.path.input = args.input_path
|
|
253
260
|
config.path.output = args.output_path
|
|
261
|
+
config.path.config = args.config_path
|
|
254
262
|
config.model.dimensions = args.dimensions
|
|
255
263
|
config.model.workers = args.workers
|
|
256
264
|
config.model.epochs = args.epochs
|
|
@@ -263,7 +271,7 @@ def parameter_parser(config: Config) -> Config:
|
|
|
263
271
|
|
|
264
272
|
return config
|
|
265
273
|
|
|
266
|
-
def write_config_to_file(config: Config):
|
|
274
|
+
def write_config_to_file(config: Config, config_file_path=DEFAULT_CONFIG_PATH):
|
|
267
275
|
'''
|
|
268
276
|
Writes the parameter settings of
|
|
269
277
|
the config object to a JSON file in
|
|
@@ -271,10 +279,10 @@ def write_config_to_file(config: Config):
|
|
|
271
279
|
default name `config.json`.
|
|
272
280
|
'''
|
|
273
281
|
|
|
274
|
-
with open(
|
|
282
|
+
with open(config_file_path, "w", encoding="utf8") as file:
|
|
275
283
|
file.write(config.json(exclude={"folder": {"folder_list"}}))
|
|
276
284
|
|
|
277
|
-
def detect_config_file() -> None:
|
|
285
|
+
def detect_config_file(config_file_path=DEFAULT_CONFIG_PATH) -> None:
|
|
278
286
|
'''
|
|
279
287
|
If you run Python using the IPython approach,
|
|
280
288
|
the command line parsing functionality will not be enabled.
|
|
@@ -286,18 +294,21 @@ def detect_config_file() -> None:
|
|
|
286
294
|
logging.info(
|
|
287
295
|
"Creating local config file by argparse."
|
|
288
296
|
)
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
logging.info(f"{
|
|
297
|
+
config = parameter_parser(Config())
|
|
298
|
+
config_file_path = config.path.config
|
|
299
|
+
write_config_to_file(config, config.path.config)
|
|
300
|
+
logging.info(f"{config_file_path} created!")
|
|
301
|
+
elif config_file_path in os.listdir():
|
|
302
|
+
logging.info(f"{config_file_path} detected!")
|
|
293
303
|
else:
|
|
294
304
|
logging.info(
|
|
295
305
|
"config file not found. creating local config file by default config."
|
|
296
306
|
)
|
|
297
|
-
write_config_to_file(Config())
|
|
298
|
-
logging.info(f"{
|
|
307
|
+
write_config_to_file(Config(), config_file_path)
|
|
308
|
+
logging.info(f"{config_file_path} created!")
|
|
309
|
+
return config_file_path
|
|
299
310
|
|
|
300
|
-
def read_config(count=1) -> Config:
|
|
311
|
+
def read_config(config_file_path=DEFAULT_CONFIG_PATH, count=1) -> Config:
|
|
301
312
|
'''
|
|
302
313
|
Reads the settings from the `config.json` file.
|
|
303
314
|
'''
|
|
@@ -307,14 +318,13 @@ def read_config(count=1) -> Config:
|
|
|
307
318
|
if count != 1:
|
|
308
319
|
logging.info(f"Trying to read config time:{count}")
|
|
309
320
|
try:
|
|
310
|
-
|
|
321
|
+
config_file_path = detect_config_file(config_file_path=config_file_path)
|
|
322
|
+
with open(config_file_path, encoding="utf-8") as file:
|
|
311
323
|
config = Config.parse_raw(file.read())
|
|
312
324
|
config.folder.update_folder_list()
|
|
313
325
|
return config
|
|
314
326
|
except Exception as err:
|
|
315
327
|
logging.warning(err)
|
|
316
|
-
|
|
317
|
-
return read_config(count=count+1)
|
|
328
|
+
return read_config(config_file_path=config_file_path, count=count+1)
|
|
318
329
|
|
|
319
|
-
detect_config_file()
|
|
320
330
|
logging.info("config.py got executed")
|
malwareDetector/const.py
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
malwareDetector/__init__.py,sha256=x9kkfeWTUR0g6RQkE13V2sZhY2DSVD3KqzcxOqlNjtA,768
|
|
2
|
+
malwareDetector/config.py,sha256=_Wk3XAaQIcG0O_fxhsz7TwEloM-w6IeEr0gpJJLc4vY,12195
|
|
3
|
+
malwareDetector/const.py,sha256=9XC5FUofRz6meRdFkzUPe3LK8fp-aBVCFHlsSLFD9b0,533
|
|
4
|
+
malwareDetector/detector.py,sha256=IeLfmOoMp20s-io5w8igMc5bJdXt8ir-EarHKBo3C_U,2207
|
|
5
|
+
malwareDetector/utils.py,sha256=kjEX-A-FuwjGwxZ-2JP489NaaeC7HwvdMrDrfPk4pYE,371
|
|
6
|
+
malwareDetector-0.1.10.dist-info/LICENCE.txt,sha256=2XPCaZqZ-jgHh7e1DKa87JUeuOB6DC0jaZonmjDeILM,1088
|
|
7
|
+
malwareDetector-0.1.10.dist-info/METADATA,sha256=SPO7of7kYU9zIKn-cJsJa9wI4qK6icSZ4aSlVgP1YS0,2287
|
|
8
|
+
malwareDetector-0.1.10.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
|
9
|
+
malwareDetector-0.1.10.dist-info/top_level.txt,sha256=wRXSanQD5XDXRYp3lPh1SjltOo6rpC5jktmR69tqIQo,16
|
|
10
|
+
malwareDetector-0.1.10.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
malwareDetector/__init__.py,sha256=x9kkfeWTUR0g6RQkE13V2sZhY2DSVD3KqzcxOqlNjtA,768
|
|
2
|
-
malwareDetector/config.py,sha256=VaXlljXeR9MG_aFVvc47JnZLWdr-uCiNXLrBqf-zUck,11569
|
|
3
|
-
malwareDetector/const.py,sha256=7UtO1bUHKh-_arYMTbjQ-XKdY0-EVBASY2Uy7Lqxu6U,528
|
|
4
|
-
malwareDetector/detector.py,sha256=IeLfmOoMp20s-io5w8igMc5bJdXt8ir-EarHKBo3C_U,2207
|
|
5
|
-
malwareDetector/utils.py,sha256=kjEX-A-FuwjGwxZ-2JP489NaaeC7HwvdMrDrfPk4pYE,371
|
|
6
|
-
malwareDetector-0.1.9.dist-info/LICENCE.txt,sha256=2XPCaZqZ-jgHh7e1DKa87JUeuOB6DC0jaZonmjDeILM,1088
|
|
7
|
-
malwareDetector-0.1.9.dist-info/METADATA,sha256=7I0tfwIqcVAmTkr1y9i9DfAulLOVesuSoKa3znX6Oko,2286
|
|
8
|
-
malwareDetector-0.1.9.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
|
9
|
-
malwareDetector-0.1.9.dist-info/top_level.txt,sha256=wRXSanQD5XDXRYp3lPh1SjltOo6rpC5jktmR69tqIQo,16
|
|
10
|
-
malwareDetector-0.1.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|