atomicshop 3.1.11__py3-none-any.whl → 3.1.13__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__ = '3.1.11'
4
+ __version__ = '3.1.13'
@@ -353,6 +353,21 @@ def thread_worker_main(
353
353
  server_receive_count += 1
354
354
  current_count = server_receive_count
355
355
 
356
+ # Getting current time of message received, either from client or service.
357
+ client_message.timestamp = datetime.now()
358
+
359
+ # # No need to receive on service socket if we're in offline mode, because there is no service to connect to.
360
+ # if config_static.MainConfig.offline and side == 'Service':
361
+ # print_api("Offline Mode, skipping receiving on service socket.", logger=network_logger,
362
+ # logger_method='info')
363
+ # else:
364
+
365
+ # TODO
366
+ # if config_static.MainConfig.offline:
367
+ # if side == 'Client':
368
+ # # If we're in offline mode, then we'll use the offline queue to put the data for the service socket.
369
+ # offline_client_service_queue.put()
370
+
356
371
  network_logger.info(
357
372
  f"Initializing Receiver for {side} cycle: {str(current_count)}")
358
373
 
@@ -360,9 +375,6 @@ def thread_worker_main(
360
375
  received_raw_data, is_socket_closed, error_message = receiver.Receiver(
361
376
  ssl_socket=receiving_socket, logger=network_logger).receive()
362
377
 
363
- # Getting current time of message received, either from client or service.
364
- client_message.timestamp = datetime.now()
365
-
366
378
  # In case of client socket, we'll process the raw data specifically for the client.
367
379
  if side == 'Client':
368
380
  process_client_raw_data(received_raw_data, error_message, client_message)
@@ -383,6 +395,11 @@ def thread_worker_main(
383
395
  # the close on the opposite socket.
384
396
  record_and_statistics_write(client_message)
385
397
 
398
+ if is_socket_closed:
399
+ exception_or_close_in_receiving_thread = True
400
+ finish_thread()
401
+ return
402
+
386
403
  # Now send it to requester/responder.
387
404
  if side == 'Client':
388
405
  # Send to requester.
@@ -395,10 +412,6 @@ def thread_worker_main(
395
412
  else:
396
413
  raise ValueError(f"Unknown side [{side}] of the socket: {receiving_socket}")
397
414
 
398
- if is_socket_closed:
399
- exception_or_close_in_receiving_thread = True
400
- finish_thread()
401
- return
402
415
 
403
416
  # If nothing was passed from the responder, and the client message is the connection message, then we'll skip to the next iteration.
404
417
  if not bytes_to_send_list and client_connection_message:
@@ -511,6 +524,9 @@ def thread_worker_main(
511
524
  # websocket_unmasked_frame_parser = websocket_parse.WebsocketFrameParser()
512
525
  websocket_frame_parser = websocket_parse.WebsocketFrameParser()
513
526
 
527
+ # Offline queue between client and service threads.
528
+ offline_client_service_queue: queue.Queue = queue.Queue()
529
+
514
530
  # Loading parser by domain, if there is no parser for current domain - general reference parser is loaded.
515
531
  # These should be outside any loop and initialized only once entering the thread.
516
532
  found_domain_module = assign_class_by_domain(
@@ -1,3 +1,5 @@
1
+ import threading
2
+
1
3
  import docker
2
4
  from docker.models.containers import Container
3
5
  from docker import DockerClient
@@ -177,14 +179,31 @@ def stop_remove_containers_by_image_name(image_name: str):
177
179
  :param image_name: str, the name of the image.
178
180
  :return:
179
181
  """
182
+
183
+ def stop_remove_containers(container_instance: Container):
184
+ """
185
+ Stop and remove a container instance.
186
+ :param container_instance: Container, the docker container object.
187
+ """
188
+ if container_instance.status == "running":
189
+ print_api(f"Stopping container: [{container_instance.name}]. Short ID: [{container_instance.short_id}]")
190
+ container_instance.stop()
191
+ print_api(f"Removing container: [{container_instance.name}]. Short ID: [{container_instance.short_id}]")
192
+ container_instance.remove()
193
+ print_api(f"Container removed: [{container_instance.name}]. Short ID: [{container_instance.short_id}]", color='green')
194
+
195
+
180
196
  client = docker.from_env()
181
197
  all_containers = client.containers.list(all=True)
198
+
199
+ containers_to_remove: list[Container] = []
182
200
  for container in all_containers:
183
201
  if any(image_name in tag for tag in container.image.tags):
184
- if container.status == "running":
185
- print_api(f"Stopping container: [{container.name}]. Short ID: [{container.short_id}]")
186
- container.stop()
187
- container.remove()
202
+ containers_to_remove.append(container)
203
+
204
+ for removing_container in containers_to_remove:
205
+ threading.Thread(target=stop_remove_containers, args=(removing_container,), daemon=True).start()
206
+
188
207
  client.close()
189
208
 
190
209
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 3.1.11
3
+ Version: 3.1.13
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=8u6hiKXHeheb_YkAYlFORxMIiYuSzHr0do9YConmyXA,123
1
+ atomicshop/__init__.py,sha256=m7-cUoalFlb_P0L7dq5ZKqms-k_BdzctCtwbbLtMGyQ,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
@@ -136,7 +136,7 @@ atomicshop/file_io/xmls.py,sha256=zh3SuK-dNaFq2NDNhx6ivcf4GYCfGM8M10PcEwDSpxk,21
136
136
  atomicshop/mitm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
137
137
  atomicshop/mitm/config_static.py,sha256=N3D06C_wUytwm80PQCL90ZGHLMHeQlCcI2XQQU2FZ1I,8145
138
138
  atomicshop/mitm/config_toml_editor.py,sha256=2p1CMcktWRR_NW-SmyDwylu63ad5e0-w1QPMa8ZLDBw,1635
139
- atomicshop/mitm/connection_thread_worker.py,sha256=Iea2XszWwqcvIq1eyRDBkIuW1uUQHVaAxfdA9EZolac,28507
139
+ atomicshop/mitm/connection_thread_worker.py,sha256=r3yKhT96oh_vyFIi858gYrpFyqIpoDwxIMAOo2S8Jl4,29385
140
140
  atomicshop/mitm/import_config.py,sha256=gCH1hV-CxBAdwjeFJu1I5ntbm5hqzcB0y0vzRPkzra0,16936
141
141
  atomicshop/mitm/initialize_engines.py,sha256=Pj9k3iLdoE0KAl3QWG1Z10LHUHY8WQivSPFnQLhCWrc,7385
142
142
  atomicshop/mitm/message.py,sha256=CDhhm4BTuZE7oNZCjvIZ4BuPOW4MuIzQLOg91hJaxDI,3065
@@ -224,7 +224,7 @@ atomicshop/wrappers/ctyping/msi_windows_installer/cabs.py,sha256=htzwb2ROYI8yyc8
224
224
  atomicshop/wrappers/ctyping/msi_windows_installer/extract_msi_main.py,sha256=AEkjnqEhfCbCUcYaulv3uba5hZjTB03xm-puAINsZGM,5488
225
225
  atomicshop/wrappers/ctyping/msi_windows_installer/tables.py,sha256=tHsu0YfBgzuIk9L-PyqLgU_IzyVbCfy8L1EqelNnvWk,17674
226
226
  atomicshop/wrappers/dockerw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
227
- atomicshop/wrappers/dockerw/dockerw.py,sha256=mwQT8d1aUrn8FbMCwcmUjoP35UWexl8DztNSuJAHJQo,9865
227
+ atomicshop/wrappers/dockerw/dockerw.py,sha256=DIhn3RTG3m7bJ-NTevoF1s1EeGHgi2y-m07oY5xJ_ls,10640
228
228
  atomicshop/wrappers/dockerw/install_docker.py,sha256=7NTMxCPBesr0QcqB0RZ5YU0I8FDPtNux_mYAX28wI0I,9982
229
229
  atomicshop/wrappers/elasticsearchw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
230
230
  atomicshop/wrappers/elasticsearchw/config_basic.py,sha256=fDujtrjEjbWiYh_WQ3OcYp_8mXhXPYeKLy4wSPL5qM0,1177
@@ -337,8 +337,8 @@ atomicshop/wrappers/socketw/statistics_csv.py,sha256=WcNyaqEZ82S5-f3kzqi1nllNT2N
337
337
  atomicshop/wrappers/winregw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
338
338
  atomicshop/wrappers/winregw/winreg_installed_software.py,sha256=Qzmyktvob1qp6Tjk2DjLfAqr_yXV0sgWzdMW_9kwNjY,2345
339
339
  atomicshop/wrappers/winregw/winreg_network.py,sha256=ih0BVNwByLvf9F_Lac4EdmDYYJA3PzMvmG0PieDZrsE,9905
340
- atomicshop-3.1.11.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
341
- atomicshop-3.1.11.dist-info/METADATA,sha256=nanoa0C9_fa9ZwN1zyJxq_IsjcXhUGGWVSzn5Hm8AZQ,10671
342
- atomicshop-3.1.11.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
343
- atomicshop-3.1.11.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
344
- atomicshop-3.1.11.dist-info/RECORD,,
340
+ atomicshop-3.1.13.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
341
+ atomicshop-3.1.13.dist-info/METADATA,sha256=5LMH6VMuu4OhGpNqI2y4YObNGBe0k0ZU-GeGaqZl-xM,10671
342
+ atomicshop-3.1.13.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
343
+ atomicshop-3.1.13.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
344
+ atomicshop-3.1.13.dist-info/RECORD,,