atomicshop 2.16.22__py3-none-any.whl → 2.16.24__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/mitm/statistic_analyzer.py +19 -30
- atomicshop/mitm/statistic_analyzer_helper/moving_average_helper.py +37 -6
- {atomicshop-2.16.22.dist-info → atomicshop-2.16.24.dist-info}/METADATA +1 -1
- {atomicshop-2.16.22.dist-info → atomicshop-2.16.24.dist-info}/RECORD +8 -8
- {atomicshop-2.16.22.dist-info → atomicshop-2.16.24.dist-info}/LICENSE.txt +0 -0
- {atomicshop-2.16.22.dist-info → atomicshop-2.16.24.dist-info}/WHEEL +0 -0
- {atomicshop-2.16.22.dist-info → atomicshop-2.16.24.dist-info}/top_level.txt +0 -0
atomicshop/__init__.py
CHANGED
|
@@ -353,7 +353,8 @@ def deviation_calculator_by_moving_average(
|
|
|
353
353
|
get_deviation_for_last_day_only: bool = False,
|
|
354
354
|
summary: bool = False,
|
|
355
355
|
output_file_path: str = None,
|
|
356
|
-
output_file_type: Literal['json', 'csv'] = 'json'
|
|
356
|
+
output_file_type: Literal['json', 'csv'] = 'json',
|
|
357
|
+
convert_sizes_lists_and_ma_data_to_string: bool = False
|
|
357
358
|
) -> Union[list, None]:
|
|
358
359
|
"""
|
|
359
360
|
This function is the main function for the moving average calculator.
|
|
@@ -383,6 +384,8 @@ def deviation_calculator_by_moving_average(
|
|
|
383
384
|
to calculate the averages and the moving average data.
|
|
384
385
|
:param output_file_path: string, if None, no file will be written.
|
|
385
386
|
:param output_file_type: string, the type of the output file. 'json' or 'csv'.
|
|
387
|
+
:param convert_sizes_lists_and_ma_data_to_string: bool, if True, the 'request_sizes', 'response_sizes' and 'ma_data'
|
|
388
|
+
will be converted to string. This is useful when writing to files, so the view will be more readable.
|
|
386
389
|
-----------------------------
|
|
387
390
|
:return: the deviation list of dicts.
|
|
388
391
|
|
|
@@ -428,39 +431,22 @@ def deviation_calculator_by_moving_average(
|
|
|
428
431
|
)
|
|
429
432
|
|
|
430
433
|
if deviation_list:
|
|
434
|
+
if convert_sizes_lists_and_ma_data_to_string:
|
|
435
|
+
for deviation_list_index, deviation in enumerate(deviation_list):
|
|
436
|
+
convert_data_value_to_string('request_sizes', deviation_list_index)
|
|
437
|
+
convert_data_value_to_string('response_sizes', deviation_list_index)
|
|
438
|
+
convert_value_to_string('ma_data', deviation_list_index)
|
|
439
|
+
|
|
431
440
|
if summary:
|
|
432
|
-
summary_deviation_list: list = []
|
|
433
441
|
for deviation in deviation_list:
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
summary_deviation_list.append({
|
|
442
|
-
'day': deviation['day'],
|
|
443
|
-
'host': deviation['host'],
|
|
444
|
-
'message': deviation['message'],
|
|
445
|
-
'value': deviation.get('value', None),
|
|
446
|
-
'ma_value': deviation.get('ma_value', None),
|
|
447
|
-
'deviation_percentage': deviation.get('deviation_percentage', None),
|
|
448
|
-
'total_entries_averaged': total_entries_averaged,
|
|
449
|
-
'median_request_size': deviation.get('median_request_size', None),
|
|
450
|
-
'median_response_size': deviation.get('median_response_size', None),
|
|
451
|
-
'mm_request_size': deviation.get('mm_request_size', None),
|
|
452
|
-
'mm_response_size': deviation.get('mm_response_size', None),
|
|
453
|
-
})
|
|
454
|
-
|
|
455
|
-
deviation_list = summary_deviation_list
|
|
442
|
+
_ = deviation.pop('check_type')
|
|
443
|
+
_ = deviation.pop('percentage')
|
|
444
|
+
_ = deviation.pop('ma_value_checked')
|
|
445
|
+
_ = deviation.pop('deviation_type')
|
|
446
|
+
_ = deviation.pop('data')
|
|
447
|
+
_ = deviation.pop('ma_data')
|
|
456
448
|
|
|
457
449
|
if output_file_path:
|
|
458
|
-
if not summary:
|
|
459
|
-
for deviation_list_index, deviation in enumerate(deviation_list):
|
|
460
|
-
convert_data_value_to_string('request_sizes', deviation_list_index)
|
|
461
|
-
convert_data_value_to_string('response_sizes', deviation_list_index)
|
|
462
|
-
convert_value_to_string('ma_data', deviation_list_index)
|
|
463
|
-
|
|
464
450
|
print_api(f'Deviation Found, saving to file: {output_file_path}', color='blue')
|
|
465
451
|
|
|
466
452
|
if output_file_type == 'csv':
|
|
@@ -518,8 +504,10 @@ def deviation_calculator_by_moving_average_main():
|
|
|
518
504
|
|
|
519
505
|
if args.full_details:
|
|
520
506
|
summary = False
|
|
507
|
+
convert_sizes_lists_and_ma_data_to_string = True
|
|
521
508
|
else:
|
|
522
509
|
summary = True
|
|
510
|
+
convert_sizes_lists_and_ma_data_to_string = False
|
|
523
511
|
|
|
524
512
|
_ = deviation_calculator_by_moving_average(
|
|
525
513
|
statistics_file_directory=args.directory,
|
|
@@ -529,6 +517,7 @@ def deviation_calculator_by_moving_average_main():
|
|
|
529
517
|
summary=summary,
|
|
530
518
|
output_file_path=args.output_file,
|
|
531
519
|
output_file_type=args.output_type,
|
|
520
|
+
convert_sizes_lists_and_ma_data_to_string=convert_sizes_lists_and_ma_data_to_string
|
|
532
521
|
)
|
|
533
522
|
|
|
534
523
|
return 0
|
|
@@ -270,6 +270,7 @@ def compute_average_for_current_day_from_past_x_days(
|
|
|
270
270
|
ma_count = statistics.mean(host_dict['counts'])
|
|
271
271
|
ma_request_size = statistics.mean(host_dict['avg_request_sizes'])
|
|
272
272
|
ma_response_size = statistics.mean(host_dict['avg_response_sizes'])
|
|
273
|
+
mm_count = statistics.median(host_dict['counts'])
|
|
273
274
|
mm_request_size = statistics.median(host_dict['median_request_sizes'])
|
|
274
275
|
mm_response_size = statistics.median(host_dict['median_response_sizes'])
|
|
275
276
|
|
|
@@ -277,6 +278,7 @@ def compute_average_for_current_day_from_past_x_days(
|
|
|
277
278
|
'ma_count': ma_count,
|
|
278
279
|
'ma_request_size': ma_request_size,
|
|
279
280
|
'ma_response_size': ma_response_size,
|
|
281
|
+
'mm_count': mm_count,
|
|
280
282
|
'mm_request_size': mm_request_size,
|
|
281
283
|
'mm_response_size': mm_response_size,
|
|
282
284
|
'counts': host_dict['counts'],
|
|
@@ -332,8 +334,28 @@ def find_deviation_from_moving_average(
|
|
|
332
334
|
deviation_percentage = (
|
|
333
335
|
(host_moving_average_by_type - day_statistics_content_dict[check_type]) /
|
|
334
336
|
host_moving_average_by_type)
|
|
337
|
+
|
|
335
338
|
if deviation_type:
|
|
336
339
|
message = f'[{check_type}] is [{deviation_type}] the moving average.'
|
|
340
|
+
|
|
341
|
+
# Get the right moving median.
|
|
342
|
+
if check_type == 'count':
|
|
343
|
+
median_type_string: str = 'count'
|
|
344
|
+
moving_median_type_string: str = 'mm_count'
|
|
345
|
+
else:
|
|
346
|
+
median_type_string: str = check_type.replace('avg', 'median')
|
|
347
|
+
moving_median_type_string: str = check_type.replace('avg', 'mm')
|
|
348
|
+
|
|
349
|
+
# The median and the total count are None for the count, Since they are the count.
|
|
350
|
+
if check_type == 'count':
|
|
351
|
+
total_entries_averaged = None
|
|
352
|
+
median_size = None
|
|
353
|
+
else:
|
|
354
|
+
total_entries_averaged = day_statistics_content_dict['count']
|
|
355
|
+
median_size = day_statistics_content_dict[median_type_string]
|
|
356
|
+
|
|
357
|
+
moving_median_size = moving_averages_dict[host][moving_median_type_string]
|
|
358
|
+
|
|
337
359
|
deviation_list.append({
|
|
338
360
|
'day': day,
|
|
339
361
|
'host': host,
|
|
@@ -344,11 +366,10 @@ def find_deviation_from_moving_average(
|
|
|
344
366
|
'percentage': top_bottom_deviation_percentage,
|
|
345
367
|
'ma_value_checked': check_type_moving_above,
|
|
346
368
|
'deviation_percentage': deviation_percentage,
|
|
369
|
+
'total_entries_averaged': total_entries_averaged,
|
|
347
370
|
'deviation_type': deviation_type,
|
|
348
|
-
'
|
|
349
|
-
'
|
|
350
|
-
'mm_request_size': moving_averages_dict[host]['mm_request_size'],
|
|
351
|
-
'mm_response_size': moving_averages_dict[host]['mm_response_size'],
|
|
371
|
+
'median_size': median_size,
|
|
372
|
+
'mm_size': moving_median_size,
|
|
352
373
|
'data': day_statistics_content_dict,
|
|
353
374
|
'ma_data': moving_averages_dict[host]
|
|
354
375
|
})
|
|
@@ -373,9 +394,19 @@ def find_deviation_from_moving_average(
|
|
|
373
394
|
deviation_list.append({
|
|
374
395
|
'day': day,
|
|
375
396
|
'host': host,
|
|
376
|
-
'data': host_dict,
|
|
377
397
|
'message': message,
|
|
378
|
-
'
|
|
398
|
+
'value': None,
|
|
399
|
+
'ma_value': None,
|
|
400
|
+
'check_type': None,
|
|
401
|
+
'percentage': None,
|
|
402
|
+
'ma_value_checked': None,
|
|
403
|
+
'deviation_percentage': None,
|
|
404
|
+
'total_entries_averaged': None,
|
|
405
|
+
'deviation_type': 'clear',
|
|
406
|
+
'median_size': None,
|
|
407
|
+
'mm_size': None,
|
|
408
|
+
'data': host_dict,
|
|
409
|
+
'ma_data': previous_day_moving_average_dict
|
|
379
410
|
})
|
|
380
411
|
continue
|
|
381
412
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
atomicshop/__init__.py,sha256=
|
|
1
|
+
atomicshop/__init__.py,sha256=CTmlCQGjYSV8TXiXGaZZB1S8I3hG61RNpEbQc104SF8,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
|
|
@@ -131,7 +131,7 @@ atomicshop/mitm/message.py,sha256=d_sm3O_aoZf87dDQP44xOMNEG-uZBN1ZecQgMCacbZs,18
|
|
|
131
131
|
atomicshop/mitm/mitm_main.py,sha256=gA8sV7hI107OnoeedCHpy8f3zcE4vAsBc44l_VTjVFo,21622
|
|
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=mBmwEe68WAjnIskGndQTRldnsAsDHuaOW0O7UXlM3Pc,26702
|
|
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
|
|
@@ -145,7 +145,7 @@ atomicshop/mitm/engines/__reference_general/recorder___reference_general.py,sha2
|
|
|
145
145
|
atomicshop/mitm/engines/__reference_general/responder___reference_general.py,sha256=IUyQYMPeEhIARfALWiKPFeXagSQD6lRzAxUdi4ZIT88,7010
|
|
146
146
|
atomicshop/mitm/statistic_analyzer_helper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
147
147
|
atomicshop/mitm/statistic_analyzer_helper/analyzer_helper.py,sha256=pk6L1t1ea1kvlBoR9QEJptOmaX-mumhwLsP2GCKukbk,5920
|
|
148
|
-
atomicshop/mitm/statistic_analyzer_helper/moving_average_helper.py,sha256=
|
|
148
|
+
atomicshop/mitm/statistic_analyzer_helper/moving_average_helper.py,sha256=XkJBAKD20j4rBpTWuhRJG3ONDWsktOh3PfOqzVDSORo,17883
|
|
149
149
|
atomicshop/monitor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
150
150
|
atomicshop/monitor/change_monitor.py,sha256=K5NlVp99XIDDPnQQMdru4BDmua_DtcDIhVAzkTOvD5s,7673
|
|
151
151
|
atomicshop/monitor/checks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -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.24.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
|
|
313
|
+
atomicshop-2.16.24.dist-info/METADATA,sha256=172BnmXPSDlG-AxPVViiY5xQNY2m7UqFq6DQ0ytD9zM,10473
|
|
314
|
+
atomicshop-2.16.24.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
315
|
+
atomicshop-2.16.24.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
|
|
316
|
+
atomicshop-2.16.24.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|