atomicshop 3.3.8__py3-none-any.whl → 3.3.10__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 +12 -0
- {atomicshop-3.3.8.dist-info → atomicshop-3.3.10.dist-info}/METADATA +1 -1
- {atomicshop-3.3.8.dist-info → atomicshop-3.3.10.dist-info}/RECORD +9 -9
- {atomicshop-3.3.8.dist-info → atomicshop-3.3.10.dist-info}/WHEEL +0 -0
- {atomicshop-3.3.8.dist-info → atomicshop-3.3.10.dist-info}/entry_points.txt +0 -0
- {atomicshop-3.3.8.dist-info → atomicshop-3.3.10.dist-info}/licenses/LICENSE.txt +0 -0
- {atomicshop-3.3.8.dist-info → atomicshop-3.3.10.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,17 @@ class DnsServer:
|
|
|
302
303
|
time.sleep(1)
|
|
303
304
|
raise DnsConfigurationValuesError(e)
|
|
304
305
|
|
|
306
|
+
# If the listening interface is not localhost, check if the interface can be bound to.
|
|
307
|
+
if not self.listening_interface.startswith('127.'):
|
|
308
|
+
host_ips: list[str] = networks.get_host_ips(ipv6=False)
|
|
309
|
+
if self.listening_interface not in host_ips:
|
|
310
|
+
message = (f"Listening interface [{self.listening_interface}] is not assigned to any of the host "
|
|
311
|
+
f"network interfaces. Current host IPv4 addresses: {host_ips}")
|
|
312
|
+
print_api(f'DnsConfigurationValuesError: {str(message)}', error_type=True, color="red", logger=self.logger)
|
|
313
|
+
# Wait for the message to be printed and saved to file.
|
|
314
|
+
time.sleep(1)
|
|
315
|
+
raise DnsConfigurationValuesError(message)
|
|
316
|
+
|
|
305
317
|
ips_ports: list[str] = [f'{self.listening_interface}:{self.listening_port}']
|
|
306
318
|
port_in_use = psutil_networks.get_processes_using_port_list(ips_ports)
|
|
307
319
|
if port_in_use:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
atomicshop/__init__.py,sha256=
|
|
1
|
+
atomicshop/__init__.py,sha256=HY3DYsUk0tU3jIXn3TtE_YStylYwC51UrRbr7MMqCM0,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
|
|
@@ -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=GOYMvHvS6Fx7s-DRygGqO7_o8_Qt9on3HmKxgOSznRE,55956
|
|
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
|
|
@@ -325,9 +325,9 @@ atomicshop/wrappers/socketw/statistics_csv.py,sha256=_gA8bMX6Sw_UCXKi2y9wNAwlqif
|
|
|
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.10.dist-info/licenses/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
|
|
329
|
+
atomicshop-3.3.10.dist-info/METADATA,sha256=Lfm_L1nmudKGv7HXvn9CwF79LD6LdVejuk7lW--4XTE,9312
|
|
330
|
+
atomicshop-3.3.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
331
|
+
atomicshop-3.3.10.dist-info/entry_points.txt,sha256=SJEgEP0KoFtfxuGwe5tOzKfXkjR9Dv6YYug33KNYxyY,69
|
|
332
|
+
atomicshop-3.3.10.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
|
|
333
|
+
atomicshop-3.3.10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|