atomicshop 2.16.12__py3-none-any.whl → 2.16.14__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 CHANGED
@@ -1,4 +1,4 @@
1
1
  """Atomic Basic functions and classes to make developer life easier"""
2
2
 
3
3
  __author__ = "Den Kras"
4
- __version__ = '2.16.12'
4
+ __version__ = '2.16.14'
@@ -4,7 +4,10 @@ from dataclasses import dataclass
4
4
  from . import import_config
5
5
 
6
6
 
7
- SCRIPT_VERSION: str = '1.7.3'
7
+ SCRIPT_VERSION: str = '1.7.5'
8
+ """
9
+ Added logs backup days
10
+ """
8
11
 
9
12
 
10
13
  # CONFIG = None
@@ -105,6 +108,7 @@ class LogRec:
105
108
  logs_path: str
106
109
  recordings_path: str
107
110
  enable_request_response_recordings_in_logs: bool
111
+ store_logs_for_x_days: int
108
112
 
109
113
  recordings_directory_name: str = 'recs'
110
114
 
@@ -9,6 +9,8 @@ from ..wrappers.loggingw import loggingw
9
9
  from .engines.__reference_general import parser___reference_general, responder___reference_general, \
10
10
  recorder___reference_general
11
11
 
12
+ from . import config_static
13
+
12
14
 
13
15
  class ModuleCategory:
14
16
  def __init__(self, script_directory: str):
@@ -89,7 +91,8 @@ class ModuleCategory:
89
91
  add_stream=True,
90
92
  add_timedfile=True,
91
93
  formatter_streamhandler='DEFAULT',
92
- formatter_filehandler='DEFAULT'
94
+ formatter_filehandler='DEFAULT',
95
+ backupCount=config_static.LogRec.store_logs_for_x_days
93
96
  )
94
97
 
95
98
 
@@ -65,7 +65,8 @@ def mitm_server_main(config_file_path: str):
65
65
  add_stream=True,
66
66
  add_timedfile=True,
67
67
  formatter_streamhandler='DEFAULT',
68
- formatter_filehandler='DEFAULT'
68
+ formatter_filehandler='DEFAULT',
69
+ backupCount=config_static.LogRec.store_logs_for_x_days
69
70
  )
70
71
 
71
72
  # Writing first log.
@@ -208,7 +209,8 @@ def mitm_server_main(config_file_path: str):
208
209
  add_stream=True,
209
210
  add_timedfile=True,
210
211
  formatter_streamhandler='DEFAULT',
211
- formatter_filehandler='DEFAULT'
212
+ formatter_filehandler='DEFAULT',
213
+ backupCount=config_static.LogRec.store_logs_for_x_days
212
214
  )
213
215
  system_logger.info(f"Loaded network logger: {network_logger}")
214
216
 
@@ -227,12 +229,13 @@ def mitm_server_main(config_file_path: str):
227
229
  dns_server_instance = dns_server.DnsServer(
228
230
  listening_interface=config_static.DNSServer.listening_interface,
229
231
  listening_port=config_static.DNSServer.listening_port,
232
+ log_directory_path=config_static.LogRec.logs_path,
233
+ backupCount_log_files_x_days=config_static.LogRec.store_logs_for_x_days,
230
234
  forwarding_dns_service_ipv4=config_static.DNSServer.forwarding_dns_service_ipv4,
231
235
  tcp_target_server_ipv4=config_static.DNSServer.target_tcp_server_ipv4,
232
236
  # Passing the engine domain list to DNS server to work with.
233
237
  # 'list' function re-initializes the current list, or else it will be the same instance object.
234
238
  tcp_resolve_domain_list=list(config_static.Certificates.domains_all_times),
235
- log_directory_path=config_static.LogRec.logs_path,
236
239
  offline_mode=config_static.DNSServer.offline_mode,
237
240
  resolve_to_tcp_server_only_tcp_resolve_domains=(
238
241
  config_static.DNSServer.resolve_to_tcp_server_only_engine_domains),
@@ -124,6 +124,7 @@ def _wrap_do_rollover(handler, header):
124
124
  handler.doRollover = new_do_rollover
125
125
 
126
126
 
127
+ # noinspection PyPep8Naming
127
128
  def add_timedfilehandler_with_queuehandler(
128
129
  logger: logging.Logger,
129
130
  file_path: str,
@@ -144,6 +145,7 @@ def add_timedfilehandler_with_queuehandler(
144
145
  when: str = 'midnight',
145
146
  interval: int = 1,
146
147
  delay: bool = True,
148
+ backupCount: int = 0,
147
149
  encoding=None,
148
150
  header: str = None
149
151
  ):
@@ -164,15 +166,16 @@ def add_timedfilehandler_with_queuehandler(
164
166
  filesystem.create_directory(os.path.dirname(file_path))
165
167
 
166
168
  file_handler = get_timed_rotating_file_handler(
167
- file_path, when=when, interval=interval, delay=delay, encoding=encoding)
169
+ file_path, when=when, interval=interval, delay=delay, backupCount=backupCount, encoding=encoding)
168
170
 
169
171
  loggers.set_logging_level(file_handler, logging_level)
170
172
 
171
173
  formatter = _process_formatter_attribute(formatter, file_type=file_type)
172
174
 
173
175
  # If formatter was passed to the function we'll add it to handler.
176
+ # noinspection GrazieInspection
174
177
  if formatter:
175
- # Convert string to Formatter object. Moved to newer styling of python 3: style='{'
178
+ # Convert string to Formatter object. Moved to newer styling of python 3: style='{'.
176
179
  logging_formatter = formatters.get_logging_formatter_from_string(
177
180
  formatter=formatter, use_nanoseconds=formatter_use_nanoseconds)
178
181
  # Setting the formatter in file handler.
@@ -240,8 +243,14 @@ def get_stream_handler() -> logging.StreamHandler:
240
243
  return logging.StreamHandler()
241
244
 
242
245
 
246
+ # noinspection PyPep8Naming
243
247
  def get_timed_rotating_file_handler(
244
- log_file_path: str, when: str = "midnight", interval: int = 1, delay: bool = False, encoding=None
248
+ log_file_path: str,
249
+ when: str = "midnight",
250
+ interval: int = 1,
251
+ backupCount: int = 0,
252
+ delay: bool = False,
253
+ encoding=None
245
254
  ) -> TimedRotatingFileHandler:
246
255
  """
247
256
  Function to get a TimedRotatingFileHandler.
@@ -255,13 +264,16 @@ def get_timed_rotating_file_handler(
255
264
  "D" - Days
256
265
  "midnight" - Roll over at midnight
257
266
  :param interval: Interval to rotate the log file.
267
+ :param backupCount: int, Number of backup files to keep. Default is 0.
268
+ If backupCount is > 0, when rollover is done, no more than backupCount files are kept, the oldest are deleted.
269
+ If backupCount is == 0, all the backup files will be kept.
258
270
  :param delay: bool, If set to True, the log file will be created only if there's something to write.
259
271
  :param encoding: Encoding to use for the log file. Same as for the TimeRotatingFileHandler, which uses Default None.
260
272
  :return: TimedRotatingFileHandler.
261
273
  """
262
274
 
263
275
  return TimedRotatingFileHandler(
264
- filename=log_file_path, when=when, interval=interval, delay=delay, encoding=encoding)
276
+ filename=log_file_path, when=when, interval=interval, backupCount=backupCount, delay=delay, encoding=encoding)
265
277
 
266
278
 
267
279
  def start_queue_listener_for_file_handler(
@@ -32,6 +32,7 @@ def create_logger(
32
32
  filehandler_rotation_use_default_namer_function: bool = True,
33
33
  when: str = "midnight",
34
34
  interval: int = 1,
35
+ backupCount: int = 0,
35
36
  delay: bool = False,
36
37
  encoding=None,
37
38
  header: str = None
@@ -95,6 +96,9 @@ def create_logger(
95
96
  :param interval: int, Interval to rotate the log file. Default is 1.
96
97
  If 'when="midnight"' and 'interval=1', then the log file will be rotated every midnight.
97
98
  If 'when="midnight"' and 'interval=2', then the log file will be rotated every 2nd midnights.
99
+ :param backupCount: int, Number of backup files to keep. Default is 0.
100
+ If backupCount is > 0, when rollover is done, no more than backupCount files are kept, the oldest are deleted.
101
+ If backupCount is == 0, all the backup files will be kept.
98
102
  :param delay: bool, If set to True, the log file will be created only if there's something to write.
99
103
  :param encoding: string, Encoding to use for the log file. Default is None.
100
104
  :param header: string, Header to write to the log file.
@@ -181,7 +185,7 @@ def create_logger(
181
185
  rotation_date_format=filehandler_rotation_date_format,
182
186
  rotation_callback_namer_function=filehandler_rotation_callback_namer_function,
183
187
  rotation_use_default_callback_namer_function=filehandler_rotation_use_default_namer_function,
184
- when=when, interval=interval, delay=delay, encoding=encoding, header=header)
188
+ when=when, interval=interval, delay=delay, backupCount=backupCount, encoding=encoding, header=header)
185
189
 
186
190
  return logger
187
191
 
@@ -35,6 +35,7 @@ class DnsServer:
35
35
  listening_interface: str,
36
36
  listening_port: int,
37
37
  log_directory_path: str,
38
+ backupCount_log_files_x_days: int = 0,
38
39
  forwarding_dns_service_ipv4: str = '8.8.8.8',
39
40
  forwarding_dns_service_port: int = 53,
40
41
  resolve_to_tcp_server_only_tcp_resolve_domains: bool = False,
@@ -56,6 +57,9 @@ class DnsServer:
56
57
  Example: '0.0.0.0'. For all interfaces.
57
58
  :param listening_port: int: Port number that the DNS Server will listen on.
58
59
  :param log_directory_path: str: Path to the directory where the logs will be saved.
60
+ :param backupCount_log_files_x_days: int: How many days the log files will be kept.
61
+ Default is 0, which means that the log files will be kept indefinitely.
62
+ More than 0 means that the log files will be deleted after the specified days.
59
63
  :param forwarding_dns_service_ipv4: str: IPv4 address of the DNS Service that will be used for resolving.
60
64
  Example: '8.8.8.8'. For Google DNS Service.
61
65
  :param forwarding_dns_service_port: int: Port number of the DNS Service that will be used for resolving.
@@ -126,7 +130,8 @@ class DnsServer:
126
130
  logger_name="dns",
127
131
  directory_path=self.log_directory_path,
128
132
  add_timedfile=True,
129
- formatter_filehandler='DEFAULT'
133
+ formatter_filehandler='DEFAULT',
134
+ backupCount=backupCount_log_files_x_days
130
135
  )
131
136
 
132
137
  self.test_config()
@@ -1,6 +1,5 @@
1
1
  import datetime
2
2
 
3
- from ...print_api import print_api
4
3
  from ...file_io import csvs
5
4
  from ..loggingw import loggingw
6
5
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 2.16.12
3
+ Version: 2.16.14
4
4
  Summary: Atomic functions and classes to make developer life easier
5
5
  Author: Denis Kras
6
6
  License: MIT License
@@ -1,4 +1,4 @@
1
- atomicshop/__init__.py,sha256=62uoYqbNQHiHzG_4RP9rz3BnzTcxCNm9aF_cLTSSAto,124
1
+ atomicshop/__init__.py,sha256=waCY7DPxgBrQX24BI-0hmphU84XoLtMKDMT9OE3ps6g,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
@@ -122,13 +122,13 @@ atomicshop/file_io/tomls.py,sha256=ol8EvQPf9sryTmZUf1v55BYSUQ6ml7HVVBHpNKbsIlA,9
122
122
  atomicshop/file_io/xlsxs.py,sha256=v_dyg9GD4LqgWi6wA1QuWRZ8zG4ZwB6Dz52ytdcmmmI,2184
123
123
  atomicshop/file_io/xmls.py,sha256=zh3SuK-dNaFq2NDNhx6ivcf4GYCfGM8M10PcEwDSpxk,2104
124
124
  atomicshop/mitm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
125
- atomicshop/mitm/config_static.py,sha256=bcZPp9g12cMNcmHm6chpI6ZrbW6b1Xrz4IVOzJahao4,7105
125
+ atomicshop/mitm/config_static.py,sha256=ds31SXyOnOEvd7RAVWvw1o8MrQTVWWZCZeQX0wUptbM,7171
126
126
  atomicshop/mitm/config_toml_editor.py,sha256=2p1CMcktWRR_NW-SmyDwylu63ad5e0-w1QPMa8ZLDBw,1635
127
127
  atomicshop/mitm/connection_thread_worker.py,sha256=1MBpRoLpzWJMvxqQKizo6IVQ4XYsbKGsjxianNQLUlE,20051
128
128
  atomicshop/mitm/import_config.py,sha256=5peDr6cT0ZWK3J53yG-VEew77CKrvB88CphM10SQd3I,7868
129
- atomicshop/mitm/initialize_engines.py,sha256=F_FESrvTghEln-P9wesvXnr3_sxczYJBN6QtmQ3d2WE,8249
129
+ atomicshop/mitm/initialize_engines.py,sha256=kBG8TBnyFuwlJ1uKaWDzc5AiZNpwdvouq2pr-PYrdEA,8349
130
130
  atomicshop/mitm/message.py,sha256=d_sm3O_aoZf87dDQP44xOMNEG-uZBN1ZecQgMCacbZs,1814
131
- atomicshop/mitm/mitm_main.py,sha256=UQ8vCHE83H5Q5Uffv3dIGCH8Buigq6FxSWgLm6_vRGc,20683
131
+ atomicshop/mitm/mitm_main.py,sha256=N7ckWZhGkkIO2dJ7m7mnh_h7lQTihUeSAfzTTsHEKts,20903
132
132
  atomicshop/mitm/recs_files.py,sha256=btOuYQca4DuBOAKp9OY21HGjeEVOx9r_k-AnZOqs3Dk,3007
133
133
  atomicshop/mitm/shared_functions.py,sha256=hplm98tz8pgJ4WHUVI9sf_oVqUM2KJ1Y2pD6EFSb8P0,1879
134
134
  atomicshop/mitm/statistic_analyzer.py,sha256=AzL9rQhg0tLJj33gZfxdwWghmbXGLh_HyMBDpzuBmsQ,24709
@@ -247,9 +247,9 @@ atomicshop/wrappers/fibratusw/install.py,sha256=PLVymDe0HuOvU0r2lje8BkQAgtiOWEeR
247
247
  atomicshop/wrappers/loggingw/consts.py,sha256=JWiUJEydjhwatBxtIJsGTmDUSTLbmIRidtR6qRLMaIY,1608
248
248
  atomicshop/wrappers/loggingw/filters.py,sha256=CMs5PAMb68zxJgBcQobaOFDG5kLJBOVYnoBHjDgksO8,2859
249
249
  atomicshop/wrappers/loggingw/formatters.py,sha256=7XUJvlB0CK4DCkEp8NTL0S0dkyrZD0UTADgEwkStKOY,5483
250
- atomicshop/wrappers/loggingw/handlers.py,sha256=yFYBeTkxnpmtlauoH3ZEFEHUYQYu9YL-ycd9sYTvOl4,16928
250
+ atomicshop/wrappers/loggingw/handlers.py,sha256=_69ZtmZRUsdgL8Q1rh2X-a0ComDU9gg9v101ngbJcac,17436
251
251
  atomicshop/wrappers/loggingw/loggers.py,sha256=DHOOTAtqkwn1xgvLHSkOiBm6yFGNuQy1kvbhG-TDog8,2374
252
- atomicshop/wrappers/loggingw/loggingw.py,sha256=lo4OZPXCbYZi3GqpaaJSs9SOGFfqD2EgHzzTK7f5IR4,11275
252
+ atomicshop/wrappers/loggingw/loggingw.py,sha256=BBQe_2i8otcbe0cZcAKd3tZ2D5XL3SPb_IWTXCepSxw,11595
253
253
  atomicshop/wrappers/loggingw/reading.py,sha256=tplnJlQ7RMxWv2s782tWGOo1C7WNemk2SRTZCCgD9J0,16474
254
254
  atomicshop/wrappers/mongodbw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
255
255
  atomicshop/wrappers/mongodbw/infrastructure.py,sha256=tHqtt__yKGtj24CT5AIk0V0k9t1p_PjezFExXRmmmcA,1517
@@ -295,7 +295,7 @@ atomicshop/wrappers/socketw/accepter.py,sha256=hZZKVYlF3LOHQJsSIEKXZUf6QXXWm-Atq
295
295
  atomicshop/wrappers/socketw/base.py,sha256=evoOIxg5Xff3THJnrVX00D5HobaOpDp6_e_gso7TJmA,2191
296
296
  atomicshop/wrappers/socketw/certificator.py,sha256=3CpQKtcW68FSbH6LVSEZTqWBS6Yg_-3K0x4nFkId4UY,12236
297
297
  atomicshop/wrappers/socketw/creator.py,sha256=3_OraDkw2DAWZfoSdY3svCGMOIxpjLEEY7NxWd7M5P4,9873
298
- atomicshop/wrappers/socketw/dns_server.py,sha256=VIpz6cluQ53nZ14QGhnXU9zJqlcOa5fEZsHeKJWr9ec,45127
298
+ atomicshop/wrappers/socketw/dns_server.py,sha256=53S52lkA9RWetNlee-mjt000OJW4Mi7Ktcru0WXrMZE,45504
299
299
  atomicshop/wrappers/socketw/exception_wrapper.py,sha256=B-X5SHLSUIWToihH2MKnOB1F4A81_X0DpLLfnYKYbEc,7067
300
300
  atomicshop/wrappers/socketw/get_process.py,sha256=_YMVxYhVlzjJpeOR36tphZ5QWeKYwk03Ilw0muCxDbg,5950
301
301
  atomicshop/wrappers/socketw/receiver.py,sha256=G3hDTacm7nwwUNHEbKZpxO0c8rHcl0NeKpZy7Xc6zpA,9008
@@ -305,11 +305,11 @@ atomicshop/wrappers/socketw/socket_client.py,sha256=FNmTt94YvjZP0X4RPb7icO3xD_nB
305
305
  atomicshop/wrappers/socketw/socket_server_tester.py,sha256=wAwyst8YdVyVfZfERav1A9_OnMJAiVBy-4uY0RpNqkU,6339
306
306
  atomicshop/wrappers/socketw/socket_wrapper.py,sha256=g7f_8RkW80EZeQWNTqGYnfrQkgAI56T3SwWybq7ZsXg,28521
307
307
  atomicshop/wrappers/socketw/ssl_base.py,sha256=k4V3gwkbq10MvOH4btU4onLX2GNOsSfUAdcHmL1rpVE,2274
308
- atomicshop/wrappers/socketw/statistics_csv.py,sha256=Jc0D12crkKRaqoCRQ-2Mz1zm6n4UUx9dXakf-N2TYWA,3065
308
+ atomicshop/wrappers/socketw/statistics_csv.py,sha256=V_m1D0KpizQox3IEWp2AUcncwWy5kG25hbFrc-mBSJE,3029
309
309
  atomicshop/wrappers/winregw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
310
310
  atomicshop/wrappers/winregw/winreg_network.py,sha256=bQ8Jql8bVGBJ0dt3VQ56lga_1LBOMLI3Km_otvvbU6c,7138
311
- atomicshop-2.16.12.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
312
- atomicshop-2.16.12.dist-info/METADATA,sha256=POvocbg-JIQO-oVd8Z3RIvANnUqSiQmXx0Q4A9vTvI0,10503
313
- atomicshop-2.16.12.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
314
- atomicshop-2.16.12.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
315
- atomicshop-2.16.12.dist-info/RECORD,,
311
+ atomicshop-2.16.14.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
312
+ atomicshop-2.16.14.dist-info/METADATA,sha256=V_qBUztY_EbQm-h-yHG_P1-KbkF1PpntRW34Q1zW07U,10503
313
+ atomicshop-2.16.14.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
314
+ atomicshop-2.16.14.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
315
+ atomicshop-2.16.14.dist-info/RECORD,,