atomicshop 2.16.19__py3-none-any.whl → 2.16.21__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 atomicshop might be problematic. Click here for more details.
- atomicshop/__init__.py +1 -1
- atomicshop/file_io/file_io.py +2 -1
- atomicshop/mitm/statistic_analyzer.py +63 -1
- {atomicshop-2.16.19.dist-info → atomicshop-2.16.21.dist-info}/METADATA +1 -1
- {atomicshop-2.16.19.dist-info → atomicshop-2.16.21.dist-info}/RECORD +8 -8
- {atomicshop-2.16.19.dist-info → atomicshop-2.16.21.dist-info}/LICENSE.txt +0 -0
- {atomicshop-2.16.19.dist-info → atomicshop-2.16.21.dist-info}/WHEEL +0 -0
- {atomicshop-2.16.19.dist-info → atomicshop-2.16.21.dist-info}/top_level.txt +0 -0
atomicshop/__init__.py
CHANGED
atomicshop/file_io/file_io.py
CHANGED
|
@@ -21,7 +21,8 @@ def write_file_decorator(function_name):
|
|
|
21
21
|
|
|
22
22
|
print_api(message=f"Writing file: {kwargs['file_path']}", **kwargs)
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
enable_long_file_path = kwargs.get('enable_long_file_path', False)
|
|
25
|
+
if enable_long_file_path:
|
|
25
26
|
# A simpler string method would be to add '\\?\' to the beginning of the file path.
|
|
26
27
|
# kwargs['file_path'] = rf"\\?\{kwargs['file_path']}"
|
|
27
28
|
|
|
@@ -2,6 +2,7 @@ import os
|
|
|
2
2
|
import datetime
|
|
3
3
|
import json
|
|
4
4
|
from typing import Union, Literal
|
|
5
|
+
import argparse
|
|
5
6
|
|
|
6
7
|
from .statistic_analyzer_helper import analyzer_helper, moving_average_helper
|
|
7
8
|
from .. import filesystem, domains, datetimes, urls
|
|
@@ -344,7 +345,7 @@ def analyze(main_file_path: str):
|
|
|
344
345
|
# ======================================================================================================================
|
|
345
346
|
|
|
346
347
|
|
|
347
|
-
def
|
|
348
|
+
def deviation_calculator_by_moving_average(
|
|
348
349
|
statistics_file_directory: str,
|
|
349
350
|
by_type: Literal['host', 'url'],
|
|
350
351
|
moving_average_window_days: int,
|
|
@@ -470,3 +471,64 @@ def deviation_calculator_by_moving_average_main(
|
|
|
470
471
|
return deviation_list
|
|
471
472
|
|
|
472
473
|
return []
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
def deviation_calculator_by_moving_average_main():
|
|
477
|
+
def parse_args():
|
|
478
|
+
description_full: str = (
|
|
479
|
+
f'Description: Calculate deviation by moving average.')
|
|
480
|
+
|
|
481
|
+
parser = argparse.ArgumentParser(
|
|
482
|
+
description=description_full)
|
|
483
|
+
|
|
484
|
+
parser.add_argument(
|
|
485
|
+
'-d', '--directory', type=str, required=True,
|
|
486
|
+
help='Provide full path to directory with statistics.csv files.')
|
|
487
|
+
parser.add_argument(
|
|
488
|
+
'-of', '--output_file', type=str, required=True, help='Provide full path to output file.')
|
|
489
|
+
parser.add_argument(
|
|
490
|
+
'-ot', '--output_type', type=str, required=True, help='Provide output type: [json] or [csv].')
|
|
491
|
+
parser.add_argument(
|
|
492
|
+
'-by', '--by_type', type=str, required=True, help='Calculate by [host] or [url].')
|
|
493
|
+
parser.add_argument(
|
|
494
|
+
'-f', '--full_details', action='store_true', required=False,
|
|
495
|
+
help='(OPTIONAL) Output full processing details instead of summary.')
|
|
496
|
+
parser.add_argument(
|
|
497
|
+
'-w', '--window', type=int, required=True, help='Moving average window in days.')
|
|
498
|
+
parser.add_argument(
|
|
499
|
+
'-p', '--percentage', type=float, required=True,
|
|
500
|
+
help='Percentage of deviation from moving average. Example: 0.1 for 10%%.')
|
|
501
|
+
|
|
502
|
+
return parser.parse_args()
|
|
503
|
+
|
|
504
|
+
args = parse_args()
|
|
505
|
+
|
|
506
|
+
if args.output_type == 'csv' and args.full_details:
|
|
507
|
+
print_api("Full details output is not supported for csv files.", color='red')
|
|
508
|
+
return 1
|
|
509
|
+
|
|
510
|
+
if not os.path.isdir(args.directory):
|
|
511
|
+
print_api(f"Directory does not exist: {args.directory}", color='red')
|
|
512
|
+
return 1
|
|
513
|
+
|
|
514
|
+
if not filesystem.get_paths_from_directory(
|
|
515
|
+
directory_path=args.directory, get_file=True, simple_list=True, file_name_check_pattern='*statistics*.csv'):
|
|
516
|
+
print_api(f"No statistics files found in: {args.directory}", color='red')
|
|
517
|
+
return 1
|
|
518
|
+
|
|
519
|
+
if args.full_details:
|
|
520
|
+
summary = False
|
|
521
|
+
else:
|
|
522
|
+
summary = True
|
|
523
|
+
|
|
524
|
+
_ = deviation_calculator_by_moving_average(
|
|
525
|
+
statistics_file_directory=args.directory,
|
|
526
|
+
by_type=args.by_type,
|
|
527
|
+
moving_average_window_days=args.window,
|
|
528
|
+
top_bottom_deviation_percentage=args.percentage,
|
|
529
|
+
summary=summary,
|
|
530
|
+
output_file_path=args.output_file,
|
|
531
|
+
output_file_type=args.output_type,
|
|
532
|
+
)
|
|
533
|
+
|
|
534
|
+
return 0
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
atomicshop/__init__.py,sha256=
|
|
1
|
+
atomicshop/__init__.py,sha256=zKVPai5VQ8seJQHyf_xQ-rQvYdF2i_Ndo5C7J_u4bvA,124
|
|
2
2
|
atomicshop/_basics_temp.py,sha256=6cu2dd6r2dLrd1BRNcVDKTHlsHs_26Gpw8QS6v32lQ0,3699
|
|
3
3
|
atomicshop/_create_pdf_demo.py,sha256=Yi-PGZuMg0RKvQmLqVeLIZYadqEZwUm-4A9JxBl_vYA,3713
|
|
4
4
|
atomicshop/_patch_import.py,sha256=ENp55sKVJ0e6-4lBvZnpz9PQCt3Otbur7F6aXDlyje4,6334
|
|
@@ -116,7 +116,7 @@ atomicshop/etws/traces/trace_sysmon_process_creation.py,sha256=OM-bkK38uYMwWLZKN
|
|
|
116
116
|
atomicshop/file_io/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
117
117
|
atomicshop/file_io/csvs.py,sha256=oZiaIEd1q50ypNdd9mlHWb-f7HAdGa_D6jLd3T_4sWU,8777
|
|
118
118
|
atomicshop/file_io/docxs.py,sha256=ffJhnmM_WyD8mCoq2dGdpfahdIrGTPy96QVlH5EWjeI,5754
|
|
119
|
-
atomicshop/file_io/file_io.py,sha256=
|
|
119
|
+
atomicshop/file_io/file_io.py,sha256=IVqs0Kd7PV8O-NH9321hK_IvPqWx2z_45zdDtqgw4II,7113
|
|
120
120
|
atomicshop/file_io/jsons.py,sha256=q9ZU8slBKnHLrtn3TnbK1qxrRpj5ZvCm6AlsFzoANjo,5303
|
|
121
121
|
atomicshop/file_io/tomls.py,sha256=ol8EvQPf9sryTmZUf1v55BYSUQ6ml7HVVBHpNKbsIlA,9768
|
|
122
122
|
atomicshop/file_io/xlsxs.py,sha256=v_dyg9GD4LqgWi6wA1QuWRZ8zG4ZwB6Dz52ytdcmmmI,2184
|
|
@@ -131,7 +131,7 @@ atomicshop/mitm/message.py,sha256=d_sm3O_aoZf87dDQP44xOMNEG-uZBN1ZecQgMCacbZs,18
|
|
|
131
131
|
atomicshop/mitm/mitm_main.py,sha256=CdCv4nYt_jwd23AI14v6lC2H8SZeIZqsXjFhwq61UtM,21285
|
|
132
132
|
atomicshop/mitm/recs_files.py,sha256=B8fSuvYXlh50LWfwLRw_bYswreTjmdZLuHJzbDC5Gss,2930
|
|
133
133
|
atomicshop/mitm/shared_functions.py,sha256=hplm98tz8pgJ4WHUVI9sf_oVqUM2KJ1Y2pD6EFSb8P0,1879
|
|
134
|
-
atomicshop/mitm/statistic_analyzer.py,sha256=
|
|
134
|
+
atomicshop/mitm/statistic_analyzer.py,sha256=0QYmkdSp5tjHkyl5MGWVEsgpRR3FgN7A2fE6pKTSO8I,27164
|
|
135
135
|
atomicshop/mitm/engines/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
136
136
|
atomicshop/mitm/engines/create_module_template.py,sha256=tRjVSm1sD6FzML71Qbuwvita0qsusdFGm8NZLsZ-XMs,4853
|
|
137
137
|
atomicshop/mitm/engines/create_module_template_example.py,sha256=X5xhvbV6-g9jU_bQVhf_crZmaH50LRWz3bS-faQ18ds,489
|
|
@@ -309,8 +309,8 @@ atomicshop/wrappers/socketw/ssl_base.py,sha256=kmiif84kMhBr5yjQW17p935sfjR5JKG0L
|
|
|
309
309
|
atomicshop/wrappers/socketw/statistics_csv.py,sha256=V_m1D0KpizQox3IEWp2AUcncwWy5kG25hbFrc-mBSJE,3029
|
|
310
310
|
atomicshop/wrappers/winregw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
311
311
|
atomicshop/wrappers/winregw/winreg_network.py,sha256=bQ8Jql8bVGBJ0dt3VQ56lga_1LBOMLI3Km_otvvbU6c,7138
|
|
312
|
-
atomicshop-2.16.
|
|
313
|
-
atomicshop-2.16.
|
|
314
|
-
atomicshop-2.16.
|
|
315
|
-
atomicshop-2.16.
|
|
316
|
-
atomicshop-2.16.
|
|
312
|
+
atomicshop-2.16.21.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
|
|
313
|
+
atomicshop-2.16.21.dist-info/METADATA,sha256=laLfi_M6QxDCtlg45NOSU4pblQDzfKTAavug5lp8Ewo,10473
|
|
314
|
+
atomicshop-2.16.21.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
315
|
+
atomicshop-2.16.21.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
|
|
316
|
+
atomicshop-2.16.21.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|