atomicshop 2.19.2__py3-none-any.whl → 2.19.4__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.19.2'
4
+ __version__ = '2.19.4'
@@ -247,7 +247,7 @@ def thread_worker_main(
247
247
  if error_string:
248
248
  client_message.errors.append(error_string)
249
249
 
250
- if client_received_raw_data == b'':
250
+ if client_received_raw_data == b'' or client_received_raw_data is None:
251
251
  return
252
252
 
253
253
  client_message.request_auto_parsed = parse_http(client_message.request_raw_bytes, client_message)
@@ -278,7 +278,7 @@ def thread_worker_main(
278
278
  if error_string:
279
279
  client_message.errors.append(error_string)
280
280
 
281
- if service_received_raw_data == b'':
281
+ if service_received_raw_data == b'' or service_received_raw_data is None:
282
282
  return
283
283
 
284
284
  client_message.response_auto_parsed = parse_http(client_message.response_raw_bytes, client_message)
@@ -420,6 +420,7 @@ def mitm_server_main(config_file_path: str, script_version: str):
420
420
  exit_cleanup()
421
421
  return 0
422
422
  except Exception as e:
423
+ print_api.print_api('', error_type=True, color='red', traceback_string=True)
423
424
  # The error logger will not be initiated if there will be a problem with configuration file or checks.
424
425
  if MITM_ERROR_LOGGER is not None:
425
426
  MITM_ERROR_LOGGER.write(e)
@@ -41,17 +41,44 @@ def delete_certificate_by_issuer_name(
41
41
  :param print_kwargs: dict, print_api kwargs.
42
42
  """
43
43
 
44
- store = wcrypt.CertOpenStore(
45
- CERT_STORE_PROV_SYSTEM, 0, None, STORE_LOCATION_TO_CERT_SYSTEM_STORE[store_location], store_location)
44
+ """
45
+ WinAPI doesn't like to do 2 actions in one iteration. So, first we will collect all certificates to remove,
46
+ and in the second iteration remove them.
47
+
48
+ Full Explanation:
49
+ When you iterate with for cert in store.CertEnumCertificatesInStore(): and call
50
+ cert.CertDeleteCertificateFromStore() inside that loop, you’re modifying the underlying certificate store
51
+ while its internal enumeration is still active. This can lead to a segmentation fault (access violation 0xC0000005).
52
+ By collecting the certificates in the first pass, you freeze the iteration so the store
53
+ doesn’t get mutated mid-enumeration.
54
+ In the second pass, when you actually remove them, you’re no longer in the middle of enumerating.
55
+ This prevents the store’s pointer from becoming invalid.
56
+
57
+ This approach should stop the Process finished with exit code -1073741819 (0xC0000005) issue.
58
+ """
46
59
 
60
+ store = wcrypt.CertOpenStore(
61
+ CERT_STORE_PROV_SYSTEM,
62
+ 0,
63
+ None,
64
+ STORE_LOCATION_TO_CERT_SYSTEM_STORE[store_location],
65
+ store_location
66
+ )
67
+
68
+ # Collect all matching certificates in a list
69
+ certs_to_remove = []
47
70
  for cert in store.CertEnumCertificatesInStore():
48
71
  # Certificate properties.
49
72
  # cert.CertEnumCertificateContextProperties()
50
73
  subject_string: str = wcrypt.CertNameToStr(cert.Subject)
51
74
  if subject_string == issuer_name:
52
75
  # Remove the certificate.
53
- cert.CertDeleteCertificateFromStore()
54
- print_api(f"Removed the Certificate with issuer: {issuer_name}", **(print_kwargs or {}))
76
+ certs_to_remove.append(cert)
77
+
78
+ # Remove all certificates from the list.
79
+ for cert in certs_to_remove:
80
+ cert.CertDeleteCertificateFromStore()
81
+ print_api(f"Removed the Certificate from store [{store_location}] with issuer [{issuer_name}]", **(print_kwargs or {}))
55
82
 
56
83
  # There is an exception about store close.
57
84
  # store.CertCloseStore()
@@ -93,13 +93,13 @@ class Receiver:
93
93
  # A signal to close connection will be empty bytes string: b''.
94
94
  received_data = self.ssl_socket.recv(self.buffer_size_receive)
95
95
  except ConnectionAbortedError:
96
- error_message = "* Connection was aborted by the client. Exiting..."
97
- print_api(error_message, logger=self.logger, logger_method='critical', traceback_string=True)
96
+ error_message = "ConnectionAbortedError: * Connection was aborted by the other side..."
97
+ print_api(error_message, logger=self.logger, logger_method='critical', traceback_string=False)
98
98
  except ConnectionResetError:
99
- error_message = "* Connection was forcibly closed by the client. Exiting..."
100
- print_api(error_message, logger=self.logger, logger_method='critical', traceback_string=True)
99
+ error_message = "ConnectionResetError: * Connection was forcibly closed by the other side..."
100
+ print_api(error_message, logger=self.logger, logger_method='critical', traceback_string=False)
101
101
  except ssl.SSLError:
102
- error_message = "* Encountered SSL error on packet receive. Exiting..."
102
+ error_message = "ssl.SSLError: * Encountered SSL error on receive..."
103
103
  print_api(error_message, logger=self.logger, logger_method='critical', traceback_string=True)
104
104
 
105
105
  if received_data == b'':
@@ -298,7 +298,7 @@ class SocketWrapper:
298
298
  # Check file existence.
299
299
  if not filesystem.is_file_exists(file_path=self.custom_server_certificate_path):
300
300
  message = f"File not found: {self.custom_server_certificate_path}"
301
- print_api(message, color='red')
301
+ print_api(message, color='red', logger=self.logger)
302
302
  return 1
303
303
 
304
304
  # And if 'custom_private_key_path' field was populated in [advanced] section, we'll check its existence.
@@ -306,7 +306,7 @@ class SocketWrapper:
306
306
  # Check private key file existence.
307
307
  if not filesystem.is_file_exists(file_path=self.custom_private_key_path):
308
308
  message = f"File not found: {self.custom_private_key_path}"
309
- print_api(message, color='red')
309
+ print_api(message, color='red', logger=self.logger)
310
310
  return 1
311
311
 
312
312
  port_in_use = networks.get_processes_using_port_list(self.listening_port_list)
@@ -345,6 +345,8 @@ class SocketWrapper:
345
345
  issuer_name=self.ca_certificate_name)
346
346
  # If there is more than one certificate with the same name, delete them all.
347
347
  if is_installed_by_name and len(certificate_list_by_name) > 1:
348
+ message = f"More than one certificate with the same issuer name is installed. Removing all..."
349
+ print_api(message, color='yellow', logger=self.logger)
348
350
  certificates.delete_certificate_by_issuer_name(self.ca_certificate_name)
349
351
  # If there is only one certificate with the same name, check if it is the same certificate.
350
352
  elif is_installed_by_name and len(certificate_list_by_name) == 1:
@@ -355,6 +357,10 @@ class SocketWrapper:
355
357
  if not permissions.is_admin():
356
358
  raise SocketWrapperConfigurationValuesError(
357
359
  "You need to run the script with admin rights to uninstall the unused certificates.")
360
+ message = (
361
+ f"Certificate with the same issuer name is installed, but it is not the same certificate. "
362
+ f"Removing...")
363
+ print_api(message, color='yellow', logger=self.logger)
358
364
  certificates.delete_certificate_by_issuer_name(
359
365
  self.ca_certificate_name, store_location="ROOT", print_kwargs={'logger': self.logger})
360
366
 
@@ -367,7 +373,8 @@ class SocketWrapper:
367
373
  raise SocketWrapperConfigurationValuesError(
368
374
  "You need to run the script with admin rights to install the CA certificate.")
369
375
  certificates.install_certificate_file(
370
- self.ca_certificate_filepath, store_location="ROOT", print_kwargs={'logger': self.logger})
376
+ self.ca_certificate_filepath, store_location="ROOT",
377
+ print_kwargs={'logger': self.logger, 'color': 'blue'})
371
378
 
372
379
  # Creating listening sockets.
373
380
  def create_socket_ipv4_tcp(self, ip_address: str, port: int):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 2.19.2
3
+ Version: 2.19.4
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=SBk9Y1eYsyMmy9xWJ483qY8NFoOX5qMgy1HMpVCjXO0,123
1
+ atomicshop/__init__.py,sha256=2gEn2WdCk0RCwEWqqFtueCBw9uFygvrBG4hm-HaHdQU,123
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
@@ -128,11 +128,11 @@ atomicshop/file_io/xmls.py,sha256=zh3SuK-dNaFq2NDNhx6ivcf4GYCfGM8M10PcEwDSpxk,21
128
128
  atomicshop/mitm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
129
129
  atomicshop/mitm/config_static.py,sha256=DjSnDtMU8srdqca8s6Q-oFCWgjjiCjXRhyk-nafRAUk,7788
130
130
  atomicshop/mitm/config_toml_editor.py,sha256=2p1CMcktWRR_NW-SmyDwylu63ad5e0-w1QPMa8ZLDBw,1635
131
- atomicshop/mitm/connection_thread_worker.py,sha256=2180oQgD3qRS53zloeALs_vYt66RJWJtnaCqjl2jVs4,28187
131
+ atomicshop/mitm/connection_thread_worker.py,sha256=TzC-wTdCT7NIkO-x0myvGbDItbFPm82PpoRmK22_tjo,28260
132
132
  atomicshop/mitm/import_config.py,sha256=0Ij14aISTllTOiWYJpIUMOWobQqGofD6uafui5uWllE,9272
133
133
  atomicshop/mitm/initialize_engines.py,sha256=-3B8xkXyPOwrC_mDJm_uaW9s56VeV-f6VTu4-8dou2s,8258
134
134
  atomicshop/mitm/message.py,sha256=mNo4Lphr_Jo6IlNX5mPJzABpogWGkjOhwI4meAivwHw,2987
135
- atomicshop/mitm/mitm_main.py,sha256=RqRlh5YIY2u817n_L1IUnki6JYXSmr7fTi3bjY5ygRA,23498
135
+ atomicshop/mitm/mitm_main.py,sha256=hLFg5ATozqY8S-4PgHXojy-gDYsj_J9cUFE33RXyyhQ,23584
136
136
  atomicshop/mitm/recs_files.py,sha256=ZAAD0twun-FtmbSniXe3XQhIlawvANNB_HxwbHj7kwI,3151
137
137
  atomicshop/mitm/shared_functions.py,sha256=0lzeyINd44sVEfFbahJxQmz6KAMWbYrW5ou3UYfItvw,1777
138
138
  atomicshop/mitm/statistic_analyzer.py,sha256=5_sAYGX2Xunzo_pS2W5WijNCwr_BlGJbbOO462y_wN4,27533
@@ -290,7 +290,7 @@ atomicshop/wrappers/pycharmw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
290
290
  atomicshop/wrappers/pycharmw/ubuntu.py,sha256=m9MpgqvIYygulhPxo9g2zlGGXrihBpiY3GNLNyT-B7U,1290
291
291
  atomicshop/wrappers/pycharmw/win.py,sha256=jdnTkUqZX_BrMW8AmW-xGtxdV-wmmNr_NMA2jB6JHsQ,2725
292
292
  atomicshop/wrappers/pywin32w/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
293
- atomicshop/wrappers/pywin32w/cert_store.py,sha256=bpFm5nH9j6I9eJdLjPnSvo-g4OyJO7Sb5VddzVE9-UM,3156
293
+ atomicshop/wrappers/pywin32w/cert_store.py,sha256=dV1XyoKTFKZ-HCIVqU2Nd6CTZ8HANqjAXv26rsNzO6s,4365
294
294
  atomicshop/wrappers/pywin32w/console.py,sha256=LstHajPLgXp9qQxFNR44QfH10nOnNp3bCJquxaTquns,1175
295
295
  atomicshop/wrappers/pywin32w/winshell.py,sha256=i2bKiMldPU7_azsD5xGQDdMwjaM7suKJd3k0Szmcs6c,723
296
296
  atomicshop/wrappers/pywin32w/win_event_log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -311,19 +311,19 @@ atomicshop/wrappers/socketw/creator.py,sha256=aSwfN_IwXXf4Hob35vHXUxD_OPeshZcRDZ
311
311
  atomicshop/wrappers/socketw/dns_server.py,sha256=RklzINNuoMQn4PGGQEI5hiAldprbVwwvikY6u9X-jTY,49067
312
312
  atomicshop/wrappers/socketw/exception_wrapper.py,sha256=B-X5SHLSUIWToihH2MKnOB1F4A81_X0DpLLfnYKYbEc,7067
313
313
  atomicshop/wrappers/socketw/get_process.py,sha256=aJC-_qFUv3NgWCSUzDI72E4z8_-VTZE9NVZ0CwUoNlM,5698
314
- atomicshop/wrappers/socketw/receiver.py,sha256=O1h7nhJIRD4KDQxSe6JvYwA-vmKeeP3ONmxF8x6C97M,8207
314
+ atomicshop/wrappers/socketw/receiver.py,sha256=9B3MvcDqr4C3x2fsnjG5SQognd1wRqsBgikxZa0wXG8,8243
315
315
  atomicshop/wrappers/socketw/sender.py,sha256=aX_K8l_rHjd5AWb8bi5mt8-YTkMYVRDB6DnPqK_XDUE,4754
316
316
  atomicshop/wrappers/socketw/sni.py,sha256=T9PXROiTYYxrd_7X4Hoj9hoNPXXTQpa2HdvmBJJIoeA,17607
317
317
  atomicshop/wrappers/socketw/socket_client.py,sha256=oa3GwS4OPgokrJE5_Oc4-5_wlXHxSH9J5f2DKebms8k,22035
318
318
  atomicshop/wrappers/socketw/socket_server_tester.py,sha256=Qobmh4XV8ZxLUaw-eW4ESKAbeSLecCKn2OWFzMhadk0,6420
319
- atomicshop/wrappers/socketw/socket_wrapper.py,sha256=WtylpezgIIBuz-A6PfM0hO1sm9Exd4j3qhDXcFc74-E,35567
319
+ atomicshop/wrappers/socketw/socket_wrapper.py,sha256=S03micuzwD06BSz5YU8DsKfAs_toppgQsndpczj60s4,36124
320
320
  atomicshop/wrappers/socketw/ssl_base.py,sha256=kmiif84kMhBr5yjQW17p935sfjR5JKG0LxIwBA4iVvU,2275
321
321
  atomicshop/wrappers/socketw/statistics_csv.py,sha256=fgMzDXI0cybwUEqAxprRmY3lqbh30KAV-jOpoFKT-m8,3395
322
322
  atomicshop/wrappers/winregw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
323
323
  atomicshop/wrappers/winregw/winreg_installed_software.py,sha256=Qzmyktvob1qp6Tjk2DjLfAqr_yXV0sgWzdMW_9kwNjY,2345
324
324
  atomicshop/wrappers/winregw/winreg_network.py,sha256=AENV88H1qDidrcpyM9OwEZxX5svfi-Jb4N6FkS1xtqA,8851
325
- atomicshop-2.19.2.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
326
- atomicshop-2.19.2.dist-info/METADATA,sha256=hyYsPo_Wfx0n6Q8cdQNEWsP4RqH5_oo3og7-2M5hFBs,10630
327
- atomicshop-2.19.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
328
- atomicshop-2.19.2.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
329
- atomicshop-2.19.2.dist-info/RECORD,,
325
+ atomicshop-2.19.4.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
326
+ atomicshop-2.19.4.dist-info/METADATA,sha256=eSfshvAU4DddcC-LbGoIJSBJ2GMPusBLhqc0pWWZEN0,10630
327
+ atomicshop-2.19.4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
328
+ atomicshop-2.19.4.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
329
+ atomicshop-2.19.4.dist-info/RECORD,,