atomicshop 3.2.9__py3-none-any.whl → 3.2.11__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.2.9'
4
+ __version__ = '3.2.11'
@@ -0,0 +1,26 @@
1
+ import argparse
2
+ import subprocess
3
+ import sys
4
+
5
+
6
+ WHEEL = (
7
+ "https://github.com/fireeye/pywintrace/releases/download/"
8
+ "v0.3.0/pywintrace-0.3.0-py3-none-any.whl"
9
+ )
10
+
11
+
12
+ def main() -> None:
13
+ parser = argparse.ArgumentParser(
14
+ prog="pywintrace",
15
+ description="Utility wrapper for installing FireEye’s pywintrace wheel"
16
+ )
17
+ sub = parser.add_subparsers(dest="command", required=True)
18
+ sub.add_parser("install", help="Download and install pywintrace v0.3.0")
19
+ args = parser.parse_args()
20
+
21
+ if args.command == "install":
22
+ subprocess.check_call([sys.executable, "-m", "pip", "install", WHEEL])
23
+ print("pywintrace 0.3.0 installed")
24
+
25
+ if __name__ == "__main__":
26
+ main()
@@ -571,3 +571,72 @@ def replace_string_in_file_main_argparse():
571
571
  new_string=args.new_string,
572
572
  find_only=args.find_only
573
573
  )
574
+
575
+
576
+ def _replace_string_in_variable():
577
+ """
578
+ Replace string in a string variable, but do it by a meta variable inside the string.
579
+ This is just an example, using the 'Template' class from the 'string' module is a better way to do it.
580
+ """
581
+
582
+ from string import Template
583
+ import os
584
+ import tempfile
585
+ import subprocess
586
+
587
+ get_docker_url: str = "https://get.docker.com"
588
+ docker_proxy_image_name: str = "rpardini/docker-registry-proxy:0.6.5"
589
+ preparation_output_dir: str = str(Path(__file__).parent / "offline-bundle")
590
+
591
+ class BashTemplate(Template):
592
+ # Anything that is not '$', which is a default delimiter in Template class, but also used in bash scripts.
593
+ # The below symbol can be printed from keyboard by holding 'Alt' and typing '0167' on the numeric keypad.
594
+ delimiter = '§'
595
+
596
+ bash_tmpl = BashTemplate(r"""#!/usr/bin/env bash
597
+ #
598
+ set -Eeuo pipefail
599
+
600
+ die() { echo "ERROR: $*" >&2; exit 1; }
601
+ need_root() { [[ $EUID -eq 0 ]] || die "Run as root (use sudo)"; }
602
+ need_cmd() {
603
+ local cmd=$1
604
+ local pkg=${2:-$1} # default package == command
605
+ if ! command -v "$cmd" &>/dev/null; then
606
+ echo "[*] $cmd not found – installing $pkg ..."
607
+ apt-get update -qq
608
+ DEBIAN_FRONTEND=noninteractive \
609
+ apt-get install -y --no-install-recommends "$pkg" || \
610
+ die "Unable to install required package: $pkg"
611
+ fi
612
+ }
613
+
614
+ need_root
615
+ need_cmd curl # binary and pkg are both “curl”
616
+ need_cmd gpg # → apt-get install gpg
617
+
618
+ DRY_LOG=$(curl -fsSL "§url" | bash -s -- --dry-run)
619
+ IMAGE="§proxyimage"
620
+ ARCHIVE="$OUTDIR/registry-proxy-image.tar.gz"
621
+ zip -r "§output_zip" "$OUTDIR"
622
+ """)
623
+
624
+ # Substitute the variables in the bash script template.
625
+ bash_script = bash_tmpl.substitute(
626
+ url=get_docker_url, proxyimage=docker_proxy_image_name, output_zip=preparation_output_dir)
627
+
628
+ # Write it to a secure temporary file.
629
+ with tempfile.NamedTemporaryFile('w', delete=False, suffix='.sh') as f:
630
+ f.write(bash_script)
631
+ temp_path = f.name
632
+ os.chmod(temp_path, 0o755) # make it executable
633
+
634
+ # Decide where the bundle should land (optional argument to the script).
635
+ cmd = ["sudo", temp_path, preparation_output_dir] # use sudo because the script demands root
636
+
637
+ # Run it and stream output live.
638
+ try:
639
+ subprocess.run(cmd, check=True)
640
+ finally:
641
+ # 5. Clean up the temp file unless you want to inspect it.
642
+ os.remove(temp_path)
@@ -629,13 +629,14 @@ def thread_worker_main(
629
629
  else:
630
630
  service_client = create_client_socket(client_message_connection)
631
631
  service_socket_instance, connection_error = service_client.service_connection()
632
- # Now we'll update the server IP with the IP of the service.
633
- server_ip = service_socket_instance.getpeername()[0]
634
- client_message_connection.server_ip = server_ip
635
632
 
636
633
  if connection_error:
637
634
  client_message_connection.errors.append(connection_error)
638
635
  record_and_statistics_write(client_message_connection)
636
+ else:
637
+ # Now we'll update the server IP with the IP of the service.
638
+ server_ip = service_socket_instance.getpeername()[0]
639
+ client_message_connection.server_ip = server_ip
639
640
 
640
641
  if not connection_error:
641
642
  client_exception_queue: queue.Queue = queue.Queue()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 3.2.9
3
+ Version: 3.2.11
4
4
  Summary: Atomic functions and classes to make developer life easier
5
5
  Author: Denis Kras
6
6
  License: MIT License
@@ -158,9 +158,9 @@ To get a local copy up and running follow these simple steps.
158
158
  ```
159
159
 
160
160
  The latest version on PyPI is 0.2, so you will need to install from GitHub.
161
- Alternatively, you can use a cmd file in the addon folder after 'atomicshop' installation:
161
+ Alternatively, you can use a command anywhere in CMD after 'atomicshop' installation:
162
162
  ```sh
163
- "\Lib\site-packages\atomicshop\addons\a_setup_scripts\install_pywintrace_0.3.cmd"
163
+ pywintrace install
164
164
  ```
165
165
 
166
166
  4. If you get an exception while installing the 'psycopg2' package on ubuntu, install this binary:
@@ -1,4 +1,4 @@
1
- atomicshop/__init__.py,sha256=ra4BPlkU5m5LNtGBwX5DiXKx5O4BJ5SgCOyRPbxndBc,122
1
+ atomicshop/__init__.py,sha256=uAe2_I-bgd4PsVkPLa-ANJSdckjZL2cytN_g3gJV6m8,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
@@ -49,6 +49,7 @@ atomicshop/versioning.py,sha256=e5W6m9AF3__M5nntqI9CqNAeHqkwY9JhlnpYeZ1CEus,970
49
49
  atomicshop/virtualization.py,sha256=LPP4vjE0Vr10R6DA4lqhfX_WaNdDGRAZUW0Am6VeGco,494
50
50
  atomicshop/web.py,sha256=hkAS0MeMW_mGgxhFCX1xckT3yslCJ2cMP2nx9ADpe3o,13024
51
51
  atomicshop/websocket_parse.py,sha256=aLHWyKqaYqEn_MRBWm2L6rIl6QPmqbVrjEXE_rBzwCw,16711
52
+ atomicshop/a_installs/pywintrace.py,sha256=oZ9BATsJ2YsdIkZZWLar_dAUV32-oDiT7MJxthC0NnU,738
52
53
  atomicshop/a_installs/ubuntu/docker_rootless.py,sha256=9IPNtGZYjfy1_n6ZRt7gWz9KZgR6XCgevjqq02xk-o0,281
53
54
  atomicshop/a_installs/ubuntu/docker_sudo.py,sha256=JzayxeyKDtiuT4Icp2L2LyFRbx4wvpyN_bHLfZ-yX5E,281
54
55
  atomicshop/a_installs/ubuntu/elastic_search_and_kibana.py,sha256=yRB-l1zBxdiN6av-FwNkhcBlaeu4zrDPjQ0uPGgpK2I,244
@@ -71,7 +72,6 @@ atomicshop/a_mains/FACT/update_extract.py,sha256=atNIBKDeGAM1XNymDjnEHq7Ke3i_rXl
71
72
  atomicshop/addons/PlayWrightCodegen.cmd,sha256=Z5cnllsyXD4F1W2h-WLEnyFkg5nZy0-hTGHRWXVOuW4,173
72
73
  atomicshop/addons/ScriptExecution.cmd,sha256=8iC-uHs9MX9qUD_C2M7n9Xw4MZvwOfxT8H5v3hluVps,93
73
74
  atomicshop/addons/a_setup_scripts/install_psycopg2_ubuntu.sh,sha256=lM7LkXQ2AxfFzDGyzSOfIS_zpg9bAD1k3JJ-qu5CdH8,81
74
- atomicshop/addons/a_setup_scripts/install_pywintrace_0.3.cmd,sha256=lEP_o6rWcBFUyup6_c-LTL3Q2LRMqryLuG3mJw080Zc,115
75
75
  atomicshop/addons/inits/init_to_import_all_modules.py,sha256=piyFjkqtNbM9PT2p8aGcatI615517XEQHgU9kDFwseY,559
76
76
  atomicshop/addons/package_setup/CreateWheel.cmd,sha256=hq9aWBSH6iffYlZyaCNrFlA0vxMh3j1k8DQE8IARQuA,189
77
77
  atomicshop/addons/package_setup/Setup in Edit mode.cmd,sha256=299RsExjR8Mup6YyC6rW0qF8lnwa3uIzwk_gYg_R_Ss,176
@@ -111,7 +111,7 @@ atomicshop/basics/multiprocesses.py,sha256=D-xe4KNWy-CffhQkWcDcROl00KYzdTk-9itrx
111
111
  atomicshop/basics/numbers.py,sha256=ESX0z_7o_ok3sOmCKAUBoZinATklgMy2v-4RndqXlVM,1837
112
112
  atomicshop/basics/package_module.py,sha256=fBd0uVgFce25ZCVtLq83iyowRlbwdWYFj_t4Ml7LU14,391
113
113
  atomicshop/basics/randoms.py,sha256=DmYLtnIhDK29tAQrGP1Nt-A-v8WC7WIEB8Edi-nk3N4,282
114
- atomicshop/basics/strings.py,sha256=mT31UXrn4dgfLtNC6PeBwrkuQHtjdPEiP38VaWgpv3w,21217
114
+ atomicshop/basics/strings.py,sha256=546IWkeqU17wEgExVTKgRnmE9icnwbvPuh3ed2F2RJ4,23777
115
115
  atomicshop/basics/threads.py,sha256=LDJiprLqdWU4JnPpCOiIC_tEnyssmCqh-6J3gfrO4QA,3195
116
116
  atomicshop/basics/timeit_template.py,sha256=fYLrk-X_dhdVtnPU22tarrhhvlggeW6FdKCXM8zkX68,405
117
117
  atomicshop/basics/tracebacks.py,sha256=Q10VnbWqcA1tL0tJsq0q1PxQtRehPT_F69DQzRMNdks,842
@@ -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=9lnSmGuNKUnN0-IskhObA0XJeLvm63vXD2QiNAUTIb8,8751
138
138
  atomicshop/mitm/config_toml_editor.py,sha256=2p1CMcktWRR_NW-SmyDwylu63ad5e0-w1QPMa8ZLDBw,1635
139
- atomicshop/mitm/connection_thread_worker.py,sha256=zo9YVliRtanmt3BDnxlePOuZLYk8HVgMRDak4wJVRvk,32653
139
+ atomicshop/mitm/connection_thread_worker.py,sha256=7B2aM-Py0kHP1geBMjw9uNmoueHEruV3KVdklkpWCLk,32684
140
140
  atomicshop/mitm/import_config.py,sha256=_RJPxoVEEsJQwQY-K_8qPw2PbzsDcV23_sEJEWSKqXY,17831
141
141
  atomicshop/mitm/initialize_engines.py,sha256=EYGW6gEYVETmmh9uNdsFT89YAdzeducFTIkdF-as33s,10534
142
142
  atomicshop/mitm/message.py,sha256=CDhhm4BTuZE7oNZCjvIZ4BuPOW4MuIzQLOg91hJaxDI,3065
@@ -337,8 +337,9 @@ 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.2.9.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
341
- atomicshop-3.2.9.dist-info/METADATA,sha256=jlHhB8jGICbCSLKn2kaaVDwwNuJ4ajRyr6vkaK9zMDs,10670
342
- atomicshop-3.2.9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
343
- atomicshop-3.2.9.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
344
- atomicshop-3.2.9.dist-info/RECORD,,
340
+ atomicshop-3.2.11.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
341
+ atomicshop-3.2.11.dist-info/METADATA,sha256=5C3bLgLQeg8N_xL7RpKGTnOSU8CEi9MIgciC5B6sXNE,10603
342
+ atomicshop-3.2.11.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
343
+ atomicshop-3.2.11.dist-info/entry_points.txt,sha256=SJEgEP0KoFtfxuGwe5tOzKfXkjR9Dv6YYug33KNYxyY,69
344
+ atomicshop-3.2.11.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
345
+ atomicshop-3.2.11.dist-info/RECORD,,
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pywintrace = atomicshop.a_installs.pywintrace:main
@@ -1,2 +0,0 @@
1
- pip install https://github.com/fireeye/pywintrace/releases/download/v0.3.0/pywintrace-0.3.0-py3-none-any.whl
2
- pause