atomicshop 2.18.22__py3-none-any.whl → 2.18.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 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.18.22'
4
+ __version__ = '2.18.24'
@@ -36,13 +36,13 @@ def thread_worker_main(
36
36
 
37
37
  # Same goes for the '.path' attribute, if it is not HTTP message then there will be no path.
38
38
  try:
39
- http_path: str = client_message.response_auto_parsed.path
39
+ http_path: str = client_message.request_auto_parsed.path
40
40
  except AttributeError:
41
41
  http_path: str = str()
42
42
 
43
43
  # Same goes for the '.command' attribute, if it is not HTTP message then there will be no command.
44
44
  try:
45
- http_command: str = client_message.response_auto_parsed.command
45
+ http_command: str = client_message.request_auto_parsed.command
46
46
  except AttributeError:
47
47
  http_command: str = str()
48
48
 
@@ -1,4 +1,5 @@
1
1
  import docker
2
+ from docker.models.containers import Container
2
3
 
3
4
  from ...print_api import print_api
4
5
 
@@ -167,3 +168,57 @@ def add_execution_permissions_for_file(image_id_or_name: str, file_path: str, pr
167
168
  list_of_commands=[f"chmod +x {file_path}"],
168
169
  print_kwargs=print_kwargs
169
170
  )
171
+
172
+
173
+ def stop_remove_containers_by_image_name(image_name: str):
174
+ """
175
+ Remove all containers by image name.
176
+ :param image_name: str, the name of the image.
177
+ :return:
178
+ """
179
+ client = docker.from_env()
180
+ all_containers = client.containers.list(all=True)
181
+ for container in all_containers:
182
+ if any(image_name in tag for tag in container.image.tags):
183
+ if container.status == "running":
184
+ print_api(f"Stopping container: [{container.name}]. Short ID: [{container.short_id}]")
185
+ container.stop()
186
+ container.remove()
187
+ client.close()
188
+
189
+
190
+ def start_container_without_stop(image_name: str, **kwargs) -> Container:
191
+ """
192
+ Start a container in detached mode, this container will not run the entry point, but will run the infinite sleep.
193
+ This way the container will continue running, you can execute commands in it and stop it manually when needed.
194
+ :param image_name: str, the name of the image.
195
+ :return:
196
+ """
197
+ client = docker.from_env()
198
+
199
+ kwargs.setdefault('detach', True)
200
+ kwargs.setdefault('mem_limit', '512m')
201
+ kwargs.setdefault('ulimits', [docker.types.Ulimit(name='nofile', soft=20000, hard=50000)])
202
+ kwargs.setdefault('remove', False)
203
+
204
+ # Start the container with a "do nothing" command so it stays running
205
+ print_api(f"Starting container from image '{image_name}'...")
206
+ container = client.containers.run(
207
+ image=image_name,
208
+ entrypoint=["/bin/sh", "-c", "tail -f /dev/null"],
209
+ **kwargs
210
+ )
211
+
212
+ stdout = container.logs(stdout=True, stderr=False).decode()
213
+ stderr = container.logs(stdout=False, stderr=True).decode()
214
+ if stdout:
215
+ print_api(f"Container stdout: {stdout}")
216
+ if stderr:
217
+ print_api(f"Container stderr: {stderr}")
218
+
219
+ if not stderr:
220
+ print_api("Container started successfully.")
221
+
222
+ print_api(f"Started container: [{container.name}]. Short ID: [{container.short_id}]")
223
+
224
+ return container
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 2.18.22
3
+ Version: 2.18.24
4
4
  Summary: Atomic functions and classes to make developer life easier
5
5
  Author: Denis Kras
6
6
  License: MIT License
@@ -46,6 +46,7 @@ Requires-Dist: olefile
46
46
  Requires-Dist: openpyxl
47
47
  Requires-Dist: pandas
48
48
  Requires-Dist: paramiko
49
+ Requires-Dist: pefile
49
50
  Requires-Dist: playwright
50
51
  Requires-Dist: playwright-stealth
51
52
  Requires-Dist: protobuf
@@ -1,4 +1,4 @@
1
- atomicshop/__init__.py,sha256=Sr8CPcZQl9qNCWb21lvXNQ_4aKz52aIEFVfSD1NgHvI,124
1
+ atomicshop/__init__.py,sha256=40D415x6iBWWnyUHnyzzhp2ZQ0Khnt9ol-hd9e49cEk,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
@@ -127,7 +127,7 @@ atomicshop/file_io/xmls.py,sha256=zh3SuK-dNaFq2NDNhx6ivcf4GYCfGM8M10PcEwDSpxk,21
127
127
  atomicshop/mitm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
128
128
  atomicshop/mitm/config_static.py,sha256=HIzxyMEj7DZksYvJsN5VuKpB-_HSVvuR6U59ztS9gi0,7871
129
129
  atomicshop/mitm/config_toml_editor.py,sha256=2p1CMcktWRR_NW-SmyDwylu63ad5e0-w1QPMa8ZLDBw,1635
130
- atomicshop/mitm/connection_thread_worker.py,sha256=fdeRBF8Ff-LgD_1PeGPVm2ET4BhRY_rCvESEuiJfWPI,27507
130
+ atomicshop/mitm/connection_thread_worker.py,sha256=JZL87yV_7giOEJW64hm1fxAUQ5lz525o8HEj1s7VLvI,27505
131
131
  atomicshop/mitm/import_config.py,sha256=0Ij14aISTllTOiWYJpIUMOWobQqGofD6uafui5uWllE,9272
132
132
  atomicshop/mitm/initialize_engines.py,sha256=NWz0yBErSrYBn0xWkJDBcHStBJ-kcsv9VtorcSP9x5M,8258
133
133
  atomicshop/mitm/message.py,sha256=mNo4Lphr_Jo6IlNX5mPJzABpogWGkjOhwI4meAivwHw,2987
@@ -211,7 +211,7 @@ atomicshop/wrappers/ctyping/msi_windows_installer/cabs.py,sha256=htzwb2ROYI8yyc8
211
211
  atomicshop/wrappers/ctyping/msi_windows_installer/extract_msi_main.py,sha256=AEkjnqEhfCbCUcYaulv3uba5hZjTB03xm-puAINsZGM,5488
212
212
  atomicshop/wrappers/ctyping/msi_windows_installer/tables.py,sha256=tHsu0YfBgzuIk9L-PyqLgU_IzyVbCfy8L1EqelNnvWk,17674
213
213
  atomicshop/wrappers/dockerw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
214
- atomicshop/wrappers/dockerw/dockerw.py,sha256=w8zSJr5C7cbvbuG09ORCpAe0BOcibqqL_Z2EKEBHYK4,6266
214
+ atomicshop/wrappers/dockerw/dockerw.py,sha256=7EAlhl0ZEnkGoIp-NlOL6ezx4OUQumhMqLzmjoezv7o,8338
215
215
  atomicshop/wrappers/dockerw/install_docker.py,sha256=7NTMxCPBesr0QcqB0RZ5YU0I8FDPtNux_mYAX28wI0I,9982
216
216
  atomicshop/wrappers/elasticsearchw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
217
217
  atomicshop/wrappers/elasticsearchw/config_basic.py,sha256=fDujtrjEjbWiYh_WQ3OcYp_8mXhXPYeKLy4wSPL5qM0,1177
@@ -321,8 +321,8 @@ atomicshop/wrappers/socketw/statistics_csv.py,sha256=fgMzDXI0cybwUEqAxprRmY3lqbh
321
321
  atomicshop/wrappers/winregw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
322
322
  atomicshop/wrappers/winregw/winreg_installed_software.py,sha256=Qzmyktvob1qp6Tjk2DjLfAqr_yXV0sgWzdMW_9kwNjY,2345
323
323
  atomicshop/wrappers/winregw/winreg_network.py,sha256=AENV88H1qDidrcpyM9OwEZxX5svfi-Jb4N6FkS1xtqA,8851
324
- atomicshop-2.18.22.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
325
- atomicshop-2.18.22.dist-info/METADATA,sha256=KFiXe-3Ldsg--Quz9ELqNGlsKZSBn20BlxFz1EQ40VE,10608
326
- atomicshop-2.18.22.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
327
- atomicshop-2.18.22.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
328
- atomicshop-2.18.22.dist-info/RECORD,,
324
+ atomicshop-2.18.24.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
325
+ atomicshop-2.18.24.dist-info/METADATA,sha256=fesLwc3X1CCKBWf5ddn1SFSFJtVWTaPOyJrxaJbnWVU,10631
326
+ atomicshop-2.18.24.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
327
+ atomicshop-2.18.24.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
328
+ atomicshop-2.18.24.dist-info/RECORD,,