atomicshop 3.2.9__py3-none-any.whl → 3.2.12__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.12'
@@ -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()
@@ -66,7 +66,7 @@ def install_docker_ubuntu(
66
66
  use_docker_installer: bool = True,
67
67
  rootless: bool = False,
68
68
  add_current_user_to_docker_group_bool: bool = False
69
- ):
69
+ ) -> int:
70
70
  """
71
71
  The function will install docker on ubuntu.
72
72
  Note: If you want to install docker in rootless mode, you need to run the script without sudo.
@@ -81,15 +81,17 @@ def install_docker_ubuntu(
81
81
  this is not needed.
82
82
 
83
83
  Usage in main.py (run with sudo):
84
+ import sys
84
85
  from atomicshop.wrappers.dockerw import install_docker
85
86
 
86
87
 
87
88
  def main():
88
- install_docker.install_docker_ubuntu()
89
+ execution_result: int = install_docker.install_docker_ubuntu()
90
+ return execution_result
89
91
 
90
92
 
91
93
  if __name__ == '__main__':
92
- main()
94
+ sys.exit(main())
93
95
  """
94
96
 
95
97
  if rootless and permissions.is_admin():
@@ -203,8 +205,8 @@ def install_docker_ubuntu(
203
205
 
204
206
  if 'Hello from Docker!' in '\n'.join(result):
205
207
  print_api('Docker installed successfully.', color='green')
206
- return True
208
+ return 0
207
209
  else:
208
210
  print_api('Docker installation failed.', color='red')
209
211
  print_api('Please check the logs above for more information.', color='red')
210
- return False
212
+ return 1
@@ -17,7 +17,7 @@ def install_before_restart(
17
17
  fact_source_archive_path: str = None,
18
18
  use_built_in_fact_installer: bool = True,
19
19
  print_kwargs: dict = None
20
- ):
20
+ ) -> int:
21
21
  """
22
22
  This function will install the FACT_core before the restart of the computer.
23
23
  :param installation_directory: string, the directory to install the FACT_core to.
@@ -35,12 +35,12 @@ def install_before_restart(
35
35
  If False, only the regular prerequisites will be installed, while the user will need to install DOCKER
36
36
  and Node.js separately.
37
37
  :param print_kwargs: dict, the print kwargs for the print_api function.
38
- :return:
38
+ :return: int, 0 if the installation was successful, 1 if there was an error.
39
39
  """
40
40
 
41
41
  # if not permissions.is_admin():
42
42
  # print_api("This script requires root privileges...", color='red')
43
- # sys.exit(1)
43
+ # return 1
44
44
 
45
45
  # # Install docker in rootless mode.
46
46
  # with ubuntu_permissions.temporary_regular_permissions():
@@ -89,7 +89,9 @@ def install_before_restart(
89
89
  # the user permissions to the docker group before restart.
90
90
  if not install_docker.add_current_user_to_docker_group():
91
91
  print_api("Docker is installed, but the current user was not added to the docker group.", color='red')
92
- sys.exit(1)
92
+ return 1
93
+
94
+ result: int = 0
93
95
  else:
94
96
  message = ("You will need to install DOCKER and NODEJS separately.\n"
95
97
  "This was done to enable Rootless docker install and install other version of NodeJS.")
@@ -108,8 +110,10 @@ def install_before_restart(
108
110
  # use_docker_installer=True, rootless=True, add_current_user_to_docker_group_bool=False)
109
111
 
110
112
  # Install docker in regular mode.
111
- install_docker.install_docker_ubuntu(
113
+ result: int = install_docker.install_docker_ubuntu(
112
114
  use_docker_installer=True, rootless=False, add_current_user_to_docker_group_bool=True)
113
115
 
114
116
  print_api("FACT_core installation before restart is finished.", color='green')
115
117
  print_api("Please restart the computer to continue the installation.", color='red')
118
+
119
+ return result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 3.2.9
3
+ Version: 3.2.12
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=UmFfTKZvO8edwaT-yU9ZjcLhDxPpgQY-gesMVRW1Yx4,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
@@ -225,7 +225,7 @@ atomicshop/wrappers/ctyping/msi_windows_installer/extract_msi_main.py,sha256=AEk
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
227
  atomicshop/wrappers/dockerw/dockerw.py,sha256=GgPSvXxJj15kZ-LPiaHLl8aekof53sSP_U-vUMUe7_8,10639
228
- atomicshop/wrappers/dockerw/install_docker.py,sha256=7NTMxCPBesr0QcqB0RZ5YU0I8FDPtNux_mYAX28wI0I,9982
228
+ atomicshop/wrappers/dockerw/install_docker.py,sha256=CeDlxWuOn_bRUhHEnvpgVGGYZgP7B-Q9qNMkDfFiV2E,10073
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
231
231
  atomicshop/wrappers/elasticsearchw/elastic_infra.py,sha256=at0sD-SFtmEvfGyIU_YBEKoU-MNeVtDQSNscPm0JWLc,10368
@@ -248,7 +248,7 @@ atomicshop/wrappers/factw/fact_extractor/docker_image.py,sha256=2FyYjnw8gxFNwISQ
248
248
  atomicshop/wrappers/factw/fact_extractor/get_extractor.py,sha256=2mfOAftHIlCcGt1s7MWdq7DsDCuI6wX3MtvcEZ4SK-0,756
249
249
  atomicshop/wrappers/factw/install/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
250
250
  atomicshop/wrappers/factw/install/install_after_restart.py,sha256=4dHn2XMbYaPJlhRCmZqqwsgHQBlG2mT7aW50pQCPtp4,4345
251
- atomicshop/wrappers/factw/install/pre_install_and_install_before_restart.py,sha256=GFsO9MTH0czKoxkiPJtjalilUwsmFLBCcx9Znv37S4M,5945
251
+ atomicshop/wrappers/factw/install/pre_install_and_install_before_restart.py,sha256=_gt0KXnVeJUpt-qcBCxDCBumPtuNwPf5CFx7xpTwL3A,6074
252
252
  atomicshop/wrappers/factw/postgresql/__init__.py,sha256=xMBn2d3Exo23IPP2F_9-SXmOlhFbwWDgS9KwozSTjA0,162
253
253
  atomicshop/wrappers/factw/postgresql/analysis.py,sha256=2Rxzy2jyq3zEKIo53z8VkjuslKE_i5mq2ZpmJAvyd6U,716
254
254
  atomicshop/wrappers/factw/postgresql/file_object.py,sha256=VRiCXnsd6yDbnsE-TEKYPC-gkAgFVkE6rygRrJLQShI,713
@@ -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.12.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
341
+ atomicshop-3.2.12.dist-info/METADATA,sha256=FuajSD5uy9j3RcqnJAZrxrkeCRI5PMt7lHVhKAsxHZs,10603
342
+ atomicshop-3.2.12.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
343
+ atomicshop-3.2.12.dist-info/entry_points.txt,sha256=SJEgEP0KoFtfxuGwe5tOzKfXkjR9Dv6YYug33KNYxyY,69
344
+ atomicshop-3.2.12.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
345
+ atomicshop-3.2.12.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