atomicshop 3.3.7__py3-none-any.whl → 3.3.9__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 +1 -1
- atomicshop/networks.py +53 -0
- atomicshop/wrappers/socketw/dns_server.py +10 -0
- atomicshop/wrappers/socketw/socket_wrapper.py +6 -1
- {atomicshop-3.3.7.dist-info → atomicshop-3.3.9.dist-info}/METADATA +1 -1
- {atomicshop-3.3.7.dist-info → atomicshop-3.3.9.dist-info}/RECORD +10 -10
- {atomicshop-3.3.7.dist-info → atomicshop-3.3.9.dist-info}/WHEEL +0 -0
- {atomicshop-3.3.7.dist-info → atomicshop-3.3.9.dist-info}/entry_points.txt +0 -0
- {atomicshop-3.3.7.dist-info → atomicshop-3.3.9.dist-info}/licenses/LICENSE.txt +0 -0
- {atomicshop-3.3.7.dist-info → atomicshop-3.3.9.dist-info}/top_level.txt +0 -0
atomicshop/__init__.py
CHANGED
atomicshop/networks.py
CHANGED
|
@@ -169,6 +169,59 @@ def get_interface_ips(
|
|
|
169
169
|
return ips
|
|
170
170
|
|
|
171
171
|
|
|
172
|
+
def get_host_ips(
|
|
173
|
+
localhost: bool = True,
|
|
174
|
+
ipv4: bool = True,
|
|
175
|
+
ipv6: bool = True
|
|
176
|
+
) -> list[str]:
|
|
177
|
+
"""
|
|
178
|
+
Yield (ifname, family, ip) for all UP interfaces that have bindable addresses.
|
|
179
|
+
|
|
180
|
+
Args:
|
|
181
|
+
localhost: include 127.0.0.0/8 and ::1 if True.
|
|
182
|
+
ipv4: include IPv4 addresses if True.
|
|
183
|
+
ipv6: include IPv6 addresses if True.
|
|
184
|
+
"""
|
|
185
|
+
stats = psutil.net_if_stats()
|
|
186
|
+
|
|
187
|
+
ip_list: list[str] = []
|
|
188
|
+
for ifname, addrs in psutil.net_if_addrs().items():
|
|
189
|
+
st = stats.get(ifname)
|
|
190
|
+
if not st or not st.isup:
|
|
191
|
+
continue # interface is down or unknown
|
|
192
|
+
|
|
193
|
+
for a in addrs:
|
|
194
|
+
fam = a.family
|
|
195
|
+
if fam not in (socket.AF_INET, socket.AF_INET6):
|
|
196
|
+
continue
|
|
197
|
+
|
|
198
|
+
# Family filters
|
|
199
|
+
if fam == socket.AF_INET and not ipv4:
|
|
200
|
+
continue
|
|
201
|
+
if fam == socket.AF_INET6 and not ipv6:
|
|
202
|
+
continue
|
|
203
|
+
|
|
204
|
+
ip = a.address
|
|
205
|
+
|
|
206
|
+
# Skip placeholders/wildcards
|
|
207
|
+
if fam == socket.AF_INET and ip == "0.0.0.0":
|
|
208
|
+
continue
|
|
209
|
+
if fam == socket.AF_INET6 and ip in ("::",):
|
|
210
|
+
continue
|
|
211
|
+
|
|
212
|
+
# Optionally skip loopback
|
|
213
|
+
if not localhost:
|
|
214
|
+
if fam == socket.AF_INET and ip.startswith("127."):
|
|
215
|
+
continue
|
|
216
|
+
if fam == socket.AF_INET6 and (ip == "::1" or ip.startswith("::1%")):
|
|
217
|
+
continue
|
|
218
|
+
|
|
219
|
+
# yield ifname, fam, ip
|
|
220
|
+
ip_list.append(ip)
|
|
221
|
+
|
|
222
|
+
return ip_list
|
|
223
|
+
|
|
224
|
+
|
|
172
225
|
def get_microsoft_loopback_device_network_configuration(
|
|
173
226
|
wmi_instance: CDispatch = None,
|
|
174
227
|
timeout: int = 1,
|
|
@@ -13,6 +13,7 @@ from ..loggingw import loggingw
|
|
|
13
13
|
from ..psutilw import psutil_networks
|
|
14
14
|
from ...basics import booleans, tracebacks
|
|
15
15
|
from ...file_io import csvs
|
|
16
|
+
from ... import networks
|
|
16
17
|
|
|
17
18
|
# noinspection PyPackageRequirements
|
|
18
19
|
import dnslib
|
|
@@ -302,6 +303,15 @@ class DnsServer:
|
|
|
302
303
|
time.sleep(1)
|
|
303
304
|
raise DnsConfigurationValuesError(e)
|
|
304
305
|
|
|
306
|
+
host_ips: list[str] = networks.get_host_ips(ipv6=False)
|
|
307
|
+
if self.listening_interface not in host_ips:
|
|
308
|
+
message = (f"Listening interface [{self.listening_interface}] is not assigned to any of the host "
|
|
309
|
+
f"network interfaces. Current host IPv4 addresses: {host_ips}")
|
|
310
|
+
print_api(f'DnsConfigurationValuesError: {str(message)}', error_type=True, color="red", logger=self.logger)
|
|
311
|
+
# Wait for the message to be printed and saved to file.
|
|
312
|
+
time.sleep(1)
|
|
313
|
+
raise DnsConfigurationValuesError(message)
|
|
314
|
+
|
|
305
315
|
ips_ports: list[str] = [f'{self.listening_interface}:{self.listening_port}']
|
|
306
316
|
port_in_use = psutil_networks.get_processes_using_port_list(ips_ports)
|
|
307
317
|
if port_in_use:
|
|
@@ -370,7 +370,12 @@ class SocketWrapper:
|
|
|
370
370
|
|
|
371
371
|
# If someone removed the CA certificate file manually, and now it was created, we also need to
|
|
372
372
|
# clear the cached certificates.
|
|
373
|
-
|
|
373
|
+
try:
|
|
374
|
+
shutil.rmtree(self.sni_server_certificates_cache_directory)
|
|
375
|
+
# If the directory doesn't exist it will throw an exception, which is OK.
|
|
376
|
+
except FileNotFoundError:
|
|
377
|
+
pass
|
|
378
|
+
|
|
374
379
|
os.makedirs(self.sni_server_certificates_cache_directory, exist_ok=True)
|
|
375
380
|
print_api("Removed cached server certificates.", logger=self.logger)
|
|
376
381
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
atomicshop/__init__.py,sha256=
|
|
1
|
+
atomicshop/__init__.py,sha256=E3S7H0jQWGqjILSoky2n8u09FS0ToNPC9B6NTFZ6i2s,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
|
|
@@ -24,7 +24,7 @@ atomicshop/http_parse.py,sha256=1Tna9YbOM0rE3t6i_M-klBlwd1KNSA9skA_BqKGXDFc,1186
|
|
|
24
24
|
atomicshop/inspect_wrapper.py,sha256=sGRVQhrJovNygHTydqJj0hxES-aB2Eg9KbIk3G31apw,11429
|
|
25
25
|
atomicshop/ip_addresses.py,sha256=penRFeJ1-LDVTko4Q0EwK4JiN5cU-KzCBR2VXg9qbUY,1238
|
|
26
26
|
atomicshop/keyboard_press.py,sha256=1W5kRtOB75fulVx-uF2yarBhW0_IzdI1k73AnvXstk0,452
|
|
27
|
-
atomicshop/networks.py,sha256=
|
|
27
|
+
atomicshop/networks.py,sha256=IfhEgI0rJHPgkbIDEC6lsPVZm-fyylpacKSo5HrIEic,26403
|
|
28
28
|
atomicshop/on_exit.py,sha256=9XlOnzoAG8zlI8wBF4AB8hyrC6Q1b84gkhqpAhhdN9g,6977
|
|
29
29
|
atomicshop/pbtkmultifile_argparse.py,sha256=aEk8nhvoQVu-xyfZosK3ma17CwIgOjzO1erXXdjwtS4,4574
|
|
30
30
|
atomicshop/print_api.py,sha256=SJNQIMqSLlYaPtjHnALySAI-jQYuYHOCGgfP7oe96fU,10957
|
|
@@ -311,7 +311,7 @@ atomicshop/wrappers/socketw/accepter.py,sha256=4I9ORugRDvwaqSzm_gWSjZnRwQGY8hDTl
|
|
|
311
311
|
atomicshop/wrappers/socketw/base.py,sha256=EcosGkD8VzgBY3GeIHDSG29ThQfXwg3-GQPmBTAqTdw,3048
|
|
312
312
|
atomicshop/wrappers/socketw/certificator.py,sha256=mtWPJ_ew3OSwt0-1W4jaoco1VIY4NRCrMv3mDUxb_Cc,12418
|
|
313
313
|
atomicshop/wrappers/socketw/creator.py,sha256=LGI4gcgJ47thx6f96rjwjPz3CsTAIv6VxWFY4EyUF2E,13667
|
|
314
|
-
atomicshop/wrappers/socketw/dns_server.py,sha256=
|
|
314
|
+
atomicshop/wrappers/socketw/dns_server.py,sha256=SYpjiBWHfYnTpHoekKe5UvTucrdtuQcjyW-CIT2AglU,55767
|
|
315
315
|
atomicshop/wrappers/socketw/exception_wrapper.py,sha256=qW_1CKyPgGlsIt7_jusKkMV4A4hih4bX324u0PLnoO8,7382
|
|
316
316
|
atomicshop/wrappers/socketw/get_process.py,sha256=aJC-_qFUv3NgWCSUzDI72E4z8_-VTZE9NVZ0CwUoNlM,5698
|
|
317
317
|
atomicshop/wrappers/socketw/receiver.py,sha256=9B3MvcDqr4C3x2fsnjG5SQognd1wRqsBgikxZa0wXG8,8243
|
|
@@ -319,15 +319,15 @@ atomicshop/wrappers/socketw/sender.py,sha256=aX_K8l_rHjd5AWb8bi5mt8-YTkMYVRDB6Dn
|
|
|
319
319
|
atomicshop/wrappers/socketw/sni.py,sha256=YlKavbExcPFfHFLYAJ3i3W6QorY7o4mbQp39g-DnDKA,17911
|
|
320
320
|
atomicshop/wrappers/socketw/socket_client.py,sha256=McBd3DeCy787oDGCEMUEP2awWy3vdkPqr9w-aFh2fBM,22502
|
|
321
321
|
atomicshop/wrappers/socketw/socket_server_tester.py,sha256=Qobmh4XV8ZxLUaw-eW4ESKAbeSLecCKn2OWFzMhadk0,6420
|
|
322
|
-
atomicshop/wrappers/socketw/socket_wrapper.py,sha256=
|
|
322
|
+
atomicshop/wrappers/socketw/socket_wrapper.py,sha256=VZe27EQhExaiLQ0FEW4ePJhNSwPMyPzgcl6oljMSbGg,41185
|
|
323
323
|
atomicshop/wrappers/socketw/ssl_base.py,sha256=62-hPm7zla1rh3m_WvDnXqKH-sDUTdiRptD8STCkgdk,2313
|
|
324
324
|
atomicshop/wrappers/socketw/statistics_csv.py,sha256=_gA8bMX6Sw_UCXKi2y9wNAwlqifgExgDGfQIa9pFxQA,5543
|
|
325
325
|
atomicshop/wrappers/winregw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
326
326
|
atomicshop/wrappers/winregw/winreg_installed_software.py,sha256=Qzmyktvob1qp6Tjk2DjLfAqr_yXV0sgWzdMW_9kwNjY,2345
|
|
327
327
|
atomicshop/wrappers/winregw/winreg_network.py,sha256=ih0BVNwByLvf9F_Lac4EdmDYYJA3PzMvmG0PieDZrsE,9905
|
|
328
|
-
atomicshop-3.3.
|
|
329
|
-
atomicshop-3.3.
|
|
330
|
-
atomicshop-3.3.
|
|
331
|
-
atomicshop-3.3.
|
|
332
|
-
atomicshop-3.3.
|
|
333
|
-
atomicshop-3.3.
|
|
328
|
+
atomicshop-3.3.9.dist-info/licenses/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
|
|
329
|
+
atomicshop-3.3.9.dist-info/METADATA,sha256=tAksy0C2kBQBoyBa3TkozMBkD0KlKEBZ09b2oJYY4pQ,9311
|
|
330
|
+
atomicshop-3.3.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
331
|
+
atomicshop-3.3.9.dist-info/entry_points.txt,sha256=SJEgEP0KoFtfxuGwe5tOzKfXkjR9Dv6YYug33KNYxyY,69
|
|
332
|
+
atomicshop-3.3.9.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
|
|
333
|
+
atomicshop-3.3.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|