atomicshop 3.1.3__py3-none-any.whl → 3.1.5__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.3'
4
+ __version__ = '3.1.5'
atomicshop/networks.py CHANGED
@@ -432,15 +432,26 @@ def add_virtual_ips_to_default_adapter_by_current_setting(
432
432
  if dns_gateways is None:
433
433
  dns_gateways = default_adapter_info['dns_gateways']
434
434
 
435
+ # We will get the default IP address of the machine.
436
+ default_ip_address: str = socket.gethostbyname(socket.gethostname())
437
+ # So we can make it the first IP in the list, but first remove it from the list.
438
+ _ = ips.pop(ips.index(default_ip_address))
439
+ # At this point we will copy the list of IPs that we will set the SkipAsSource flag for.
440
+ ips_for_skip_as_source = ips.copy()
441
+ # Add it back to the beginning of the list.
442
+ ips.insert(0, default_ip_address)
443
+
435
444
  win32_networkadapterconfiguration.set_static_ips(
436
445
  default_network_adapter_config, ips=ips, masks=masks,
437
446
  gateways=gateways, dns_gateways=dns_gateways,
438
447
  availability_wait_seconds=availability_wait_seconds)
439
448
 
449
+ # If there were already virtual IPs assigned to the adapter and already were set SkipAsSource,
450
+ # we need to set SkipAsSource for them once again as well as for the new IPs.
440
451
  if set_virtual_ips_skip_as_source:
441
452
  wmi_standard_cimv2_instance, _ = wmi_helpers.get_wmi_instance(
442
453
  namespace='root\\StandardCimv2', wmi_instance=wmi_civ2_instance, locator=locator)
443
- msft_netipaddress.set_skip_as_source(ips_to_assign, enable=True, wmi_instance=wmi_standard_cimv2_instance)
454
+ msft_netipaddress.set_skip_as_source(ips_for_skip_as_source, enable=True, wmi_instance=wmi_standard_cimv2_instance)
444
455
  else:
445
456
  # print("[!] No new IPs to assign.")
446
457
  pass
@@ -66,8 +66,9 @@ class GoogleLLM:
66
66
  number_of_top_links: int = 2,
67
67
  number_of_characters_per_link: int = 15000,
68
68
  temperature: float = 0,
69
- max_output_tokens: int = 4096,
70
- model_name: str = 'gemini-2.0-flash-thinking-exp-01-21'
69
+ # max_output_tokens: int = 4096,
70
+ # model_name: str = 'gemini-2.0-flash-thinking-exp-01-21'
71
+ model_name: str = 'models/gemini-2.5-pro-preview-03-25'
71
72
  ) -> str:
72
73
  """
73
74
  Function to get the answer to a question by searching Google Custom Console API and processing the content using Gemini API.
@@ -121,7 +122,8 @@ class GoogleLLM:
121
122
  f'{combined_content}')
122
123
 
123
124
  # Ask Gemini to process the combined content
124
- gemini_response = self.ask_gemini(final_question, temperature, max_output_tokens, model_name)
125
+ # gemini_response = self.ask_gemini(final_question, temperature, max_output_tokens, model_name)
126
+ gemini_response = self.ask_gemini(final_question, temperature, model_name)
125
127
  return gemini_response
126
128
 
127
129
  @staticmethod
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from win32com.client import CDispatch
2
4
 
3
5
  from . import wmi_helpers
@@ -73,4 +75,39 @@ def set_skip_as_source(
73
75
 
74
76
  obj.SkipAsSource = enable
75
77
  obj.Put_() # commit the change
76
- print(f"[+] {ip}: SkipAsSource set to {enable}")
78
+ print(f"[+] {ip}: SkipAsSource set to {enable}")
79
+
80
+
81
+ def is_skip_as_source(
82
+ ip_address: str,
83
+ wmi_instance: CDispatch = None
84
+ ) -> Optional[bool]:
85
+ """
86
+ Check whether *ip_address* currently has SkipAsSource set.
87
+
88
+ Returns
89
+ -------
90
+ True – the flag is enabled
91
+ False – the flag is disabled
92
+ None – no MSFT_NetIPAddress object matches the IP (not present)
93
+
94
+ Notes
95
+ -----
96
+ * Works for both IPv4/IPv6.
97
+ * Uses the same Win32 CIM class (root\\StandardCimv2 › MSFT_NetIPAddress).
98
+ * You can pass an existing `wmi_instance` to avoid reconnecting in tight loops.
99
+ """
100
+ # Get a WMI connection if the caller didn’t hand us one
101
+ if not wmi_instance:
102
+ wmi_instance, _ = wmi_helpers.get_wmi_instance(namespace='root\\StandardCimv2')
103
+
104
+ query = f"SELECT SkipAsSource FROM MSFT_NetIPAddress WHERE IPAddress='{ip_address}'"
105
+ matches = wmi_instance.ExecQuery(query)
106
+
107
+ if not matches: # address not configured on this host/NIC
108
+ return None
109
+
110
+ # There should be only one entry per literal IP, but handle duplicates sanely
111
+ # Return True if *any* matching record has SkipAsSource = True,
112
+ # otherwise False (all are False).
113
+ return any(bool(obj.SkipAsSource) for obj in matches)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: atomicshop
3
- Version: 3.1.3
3
+ Version: 3.1.5
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=iecTS2GszzrWWXhhrFgck5TiMcZTtx_WUNY90_aJA6k,122
1
+ atomicshop/__init__.py,sha256=3G5h8j3jqnhX7IVXqhpP6otC6Me-EEHzhq3ijShiqaU,122
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
@@ -23,7 +23,7 @@ atomicshop/http_parse.py,sha256=1Tna9YbOM0rE3t6i_M-klBlwd1KNSA9skA_BqKGXDFc,1186
23
23
  atomicshop/inspect_wrapper.py,sha256=sGRVQhrJovNygHTydqJj0hxES-aB2Eg9KbIk3G31apw,11429
24
24
  atomicshop/ip_addresses.py,sha256=penRFeJ1-LDVTko4Q0EwK4JiN5cU-KzCBR2VXg9qbUY,1238
25
25
  atomicshop/keyboard_press.py,sha256=1W5kRtOB75fulVx-uF2yarBhW0_IzdI1k73AnvXstk0,452
26
- atomicshop/networks.py,sha256=XiQYQEPcBRX_HwNNHa1c8jN1OnRj6E8azcR24oFCkng,17922
26
+ atomicshop/networks.py,sha256=OSFaEUu8otxCkNq9oMbYQpj5SLzHie2r5uJDiyLR19U,18685
27
27
  atomicshop/on_exit.py,sha256=9XlOnzoAG8zlI8wBF4AB8hyrC6Q1b84gkhqpAhhdN9g,6977
28
28
  atomicshop/pbtkmultifile_argparse.py,sha256=aEk8nhvoQVu-xyfZosK3ma17CwIgOjzO1erXXdjwtS4,4574
29
29
  atomicshop/print_api.py,sha256=SJNQIMqSLlYaPtjHnALySAI-jQYuYHOCGgfP7oe96fU,10957
@@ -189,7 +189,7 @@ atomicshop/startup/win/startup_folder.py,sha256=2RZEyF-Mf8eWPlt_-OaoGKKnMs6YhELE
189
189
  atomicshop/startup/win/task_scheduler.py,sha256=qALe-8sfthYxsdCViH2r8OsH3x-WauDqteg5RzElPdk,4348
190
190
  atomicshop/web_apis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
191
191
  atomicshop/web_apis/google_custom_search.py,sha256=R1BnUmBFWZIWkfizSRWoSYoZTdPEjLJ28F_sS2g1jGQ,1558
192
- atomicshop/web_apis/google_llm.py,sha256=bOE91hGSz4I2DJK0LZHMCSDDYSTgP6SF_FWVvpV5LcY,7691
192
+ atomicshop/web_apis/google_llm.py,sha256=_uBu8iKBMEMeJEOOztQiVa7k2yHdrLB81rub8yCuxPI,7850
193
193
  atomicshop/wrappers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
194
194
  atomicshop/wrappers/_process_wrapper_curl.py,sha256=XkZZXYl7D0Q6UfdWqy-18AvpU0yVp9i2BVD2qRcXlkk,841
195
195
  atomicshop/wrappers/_process_wrapper_tar.py,sha256=WUMZFKNrlG4nJP9tWZ51W7BR1j_pIjsjgyAStmWjRGs,655
@@ -312,7 +312,7 @@ atomicshop/wrappers/pywin32w/win_event_log/subscribes/process_create.py,sha256=I
312
312
  atomicshop/wrappers/pywin32w/win_event_log/subscribes/process_terminate.py,sha256=OJFWywGGGkBHq1N0MKGtHSFFQMFQSDVU6FXCRIdssg8,3761
313
313
  atomicshop/wrappers/pywin32w/win_event_log/subscribes/schannel_logging.py,sha256=8nxIcNcbeEuvoBwhujgh7-oIpL9A6J-gg1NM8hOGAVA,3442
314
314
  atomicshop/wrappers/pywin32w/wmis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
315
- atomicshop/wrappers/pywin32w/wmis/msft_netipaddress.py,sha256=jCfLS81byOgBwtZWTRPzDWm2IUkcODy1REYjdN80fJo,3482
315
+ atomicshop/wrappers/pywin32w/wmis/msft_netipaddress.py,sha256=Kn2gQsyEquM5QQkdF2Vtr1MqK5D7uo6EFi-cxt52Q0g,4800
316
316
  atomicshop/wrappers/pywin32w/wmis/win32_networkadapterconfiguration.py,sha256=Iz-p--cE2iP6wyD9ceSF3scMMvdXC5fF-VKP1v-iIDo,10813
317
317
  atomicshop/wrappers/pywin32w/wmis/win32networkadapter.py,sha256=iao4OK6u097uRacw6vQuya1kOtJzLA1IM4cgo6UCWLM,3941
318
318
  atomicshop/wrappers/pywin32w/wmis/win32process.py,sha256=qMzXtJ5hBZ5ydAyqpDbSx0nO2RJQL95HdmV5SzNKMhk,6826
@@ -336,8 +336,8 @@ atomicshop/wrappers/socketw/statistics_csv.py,sha256=WcNyaqEZ82S5-f3kzqi1nllNT2N
336
336
  atomicshop/wrappers/winregw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
337
337
  atomicshop/wrappers/winregw/winreg_installed_software.py,sha256=Qzmyktvob1qp6Tjk2DjLfAqr_yXV0sgWzdMW_9kwNjY,2345
338
338
  atomicshop/wrappers/winregw/winreg_network.py,sha256=3Ts1sVqSUiCDsHRHwJCbiZ9EYvv2ELGxF0Y_pibGU4k,9596
339
- atomicshop-3.1.3.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
340
- atomicshop-3.1.3.dist-info/METADATA,sha256=j8iedLkgbjssGczhijWtmc-mcil_AE8Z-LLIuJm_U4I,10653
341
- atomicshop-3.1.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
342
- atomicshop-3.1.3.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
343
- atomicshop-3.1.3.dist-info/RECORD,,
339
+ atomicshop-3.1.5.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
340
+ atomicshop-3.1.5.dist-info/METADATA,sha256=8lGudQYkq9i-g4r-658XFe5RJmIY1ebxXKbGav0XSrc,10653
341
+ atomicshop-3.1.5.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
342
+ atomicshop-3.1.5.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
343
+ atomicshop-3.1.5.dist-info/RECORD,,