atomicshop 3.3.24__py3-none-any.whl → 3.3.26__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/wrappers/socketw/socket_wrapper.py +36 -28
- {atomicshop-3.3.24.dist-info → atomicshop-3.3.26.dist-info}/METADATA +1 -1
- {atomicshop-3.3.24.dist-info → atomicshop-3.3.26.dist-info}/RECORD +7 -7
- {atomicshop-3.3.24.dist-info → atomicshop-3.3.26.dist-info}/WHEEL +0 -0
- {atomicshop-3.3.24.dist-info → atomicshop-3.3.26.dist-info}/licenses/LICENSE.txt +0 -0
- {atomicshop-3.3.24.dist-info → atomicshop-3.3.26.dist-info}/top_level.txt +0 -0
atomicshop/__init__.py
CHANGED
|
@@ -16,7 +16,7 @@ from ..loggingw import loggingw
|
|
|
16
16
|
from ...script_as_string_processor import ScriptAsStringProcessor
|
|
17
17
|
from ...permissions import permissions
|
|
18
18
|
from ... import filesystem, certificates
|
|
19
|
-
from ...basics import booleans
|
|
19
|
+
from ...basics import booleans, tracebacks
|
|
20
20
|
from ...print_api import print_api
|
|
21
21
|
|
|
22
22
|
from . import base, creator, get_process, accepter, statistics_csv, ssl_base, sni
|
|
@@ -500,6 +500,13 @@ class SocketWrapper:
|
|
|
500
500
|
listening_sockets: list = [listening_socket_object]
|
|
501
501
|
|
|
502
502
|
while True:
|
|
503
|
+
engine_name: str = ''
|
|
504
|
+
source_ip: str = ''
|
|
505
|
+
source_hostname: str = ''
|
|
506
|
+
dest_port: int = 0
|
|
507
|
+
process_name: str = ''
|
|
508
|
+
domain_from_engine: str = ''
|
|
509
|
+
|
|
503
510
|
try:
|
|
504
511
|
# Using "select.select" which is currently the only API function that works on all
|
|
505
512
|
# operating system types: Windows / Linux / BSD.
|
|
@@ -510,7 +517,6 @@ class SocketWrapper:
|
|
|
510
517
|
|
|
511
518
|
listening_ip, listening_port = listening_socket_object.getsockname()
|
|
512
519
|
|
|
513
|
-
domain_from_engine = None
|
|
514
520
|
# Get the domain to connect on this process in case on no SNI provided.
|
|
515
521
|
for domain, ip_port_dict in self.engine.domain_target_dict.items():
|
|
516
522
|
if ip_port_dict['ip'] == listening_ip:
|
|
@@ -536,16 +542,27 @@ class SocketWrapper:
|
|
|
536
542
|
|
|
537
543
|
self.logger.info(f"Requested domain setting: {domain_from_engine}")
|
|
538
544
|
|
|
545
|
+
engine_name = get_engine_name(domain_from_engine, [self.engine])
|
|
546
|
+
|
|
539
547
|
# Wait from any connection on "accept()".
|
|
540
548
|
# 'client_socket' is socket or ssl socket, 'client_address' is a tuple (ip_address, port).
|
|
541
549
|
client_socket, client_address, accept_error_message = accepter.accept_connection_with_error(
|
|
542
550
|
listening_socket_object, domain_from_dns_server=domain_from_engine,
|
|
543
551
|
print_kwargs={'logger': self.logger})
|
|
544
552
|
|
|
553
|
+
source_ip: str = client_address[0]
|
|
554
|
+
dest_port: int = listening_socket_object.getsockname()[1]
|
|
555
|
+
|
|
556
|
+
# Not always there will be a hostname resolved by the IP address, so we will leave it empty if it fails.
|
|
557
|
+
try:
|
|
558
|
+
source_hostname = socket.gethostbyaddr(source_ip)[0]
|
|
559
|
+
source_hostname = source_hostname.lower()
|
|
560
|
+
except socket.herror:
|
|
561
|
+
pass
|
|
562
|
+
|
|
545
563
|
# This is the earliest stage to ask for process name.
|
|
546
564
|
# SSH Remote / LOCALHOST script execution to identify process section.
|
|
547
565
|
# If 'get_process_name' was set to True, then this will be executed.
|
|
548
|
-
process_name = None
|
|
549
566
|
if self.get_process_name:
|
|
550
567
|
# Get the process name from the socket.
|
|
551
568
|
get_command_instance = get_process.GetCommandLine(
|
|
@@ -556,35 +573,13 @@ class SocketWrapper:
|
|
|
556
573
|
logger=self.logger)
|
|
557
574
|
process_name = get_command_instance.get_process_name(print_kwargs={'logger': self.logger})
|
|
558
575
|
|
|
559
|
-
source_ip: str = client_address[0]
|
|
560
|
-
engine_name: str = get_engine_name(domain_from_engine, [self.engine])
|
|
561
|
-
dest_port: int = listening_socket_object.getsockname()[1]
|
|
562
|
-
|
|
563
|
-
# Not always there will be a hostname resolved by the IP address, so we will leave it empty if it fails.
|
|
564
|
-
try:
|
|
565
|
-
source_hostname: str = socket.gethostbyaddr(source_ip)[0]
|
|
566
|
-
except socket.herror:
|
|
567
|
-
source_hostname = ''
|
|
568
|
-
|
|
569
576
|
# If 'accept()' function worked well, SSL worked well, then 'client_socket' won't be empty.
|
|
570
577
|
if client_socket:
|
|
571
578
|
# Get the protocol type from the socket.
|
|
572
579
|
is_tls: bool = False
|
|
573
580
|
|
|
574
581
|
time.sleep(1) # Wait a second to gather some data.
|
|
575
|
-
|
|
576
|
-
tls_properties = ssl_base.is_tls(client_socket)
|
|
577
|
-
except ConnectionResetError as e:
|
|
578
|
-
self.statistics_writer.write_accept_error(
|
|
579
|
-
engine=engine_name,
|
|
580
|
-
source_host=source_hostname,
|
|
581
|
-
source_ip=source_ip,
|
|
582
|
-
error_message=str(e),
|
|
583
|
-
dest_port=str(dest_port),
|
|
584
|
-
host=domain_from_engine,
|
|
585
|
-
process_name=process_name)
|
|
586
|
-
|
|
587
|
-
continue
|
|
582
|
+
tls_properties = ssl_base.is_tls(client_socket)
|
|
588
583
|
|
|
589
584
|
if tls_properties:
|
|
590
585
|
is_tls = True
|
|
@@ -698,9 +693,22 @@ class SocketWrapper:
|
|
|
698
693
|
dest_port=str(dest_port),
|
|
699
694
|
host=domain_from_engine,
|
|
700
695
|
process_name=process_name)
|
|
696
|
+
except ConnectionResetError as e:
|
|
697
|
+
exception_string: str = tracebacks.get_as_string()
|
|
698
|
+
full_string: str = f"{str(e)} | {exception_string}"
|
|
699
|
+
self.statistics_writer.write_accept_error(
|
|
700
|
+
engine=engine_name,
|
|
701
|
+
source_host=source_hostname,
|
|
702
|
+
source_ip=source_ip,
|
|
703
|
+
error_message=full_string,
|
|
704
|
+
dest_port=str(dest_port),
|
|
705
|
+
host=domain_from_engine,
|
|
706
|
+
process_name=process_name)
|
|
701
707
|
except Exception as e:
|
|
702
|
-
|
|
703
|
-
|
|
708
|
+
_ = e
|
|
709
|
+
exception_string: str = tracebacks.get_as_string()
|
|
710
|
+
full_string: str = f"Engine: [{engine_name}] | {exception_string}"
|
|
711
|
+
self.exceptions_logger.write(full_string)
|
|
704
712
|
|
|
705
713
|
|
|
706
714
|
def before_socket_thread_worker(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
atomicshop/__init__.py,sha256=
|
|
1
|
+
atomicshop/__init__.py,sha256=4EgJYd49JARUMQEP9YUXR0MGaFjopGdy25l3D73gEiM,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
|
|
@@ -308,14 +308,14 @@ atomicshop/wrappers/socketw/sender.py,sha256=aX_K8l_rHjd5AWb8bi5mt8-YTkMYVRDB6Dn
|
|
|
308
308
|
atomicshop/wrappers/socketw/sni.py,sha256=uj6KKYKmSrzXcKBhVLaHQhYn1wNfIUpdnmcvn21V9iE,18176
|
|
309
309
|
atomicshop/wrappers/socketw/socket_client.py,sha256=WWIiCxUX9irN9aWzJ6-1xrXNB_iv_diq3ha1yrWsNGU,22671
|
|
310
310
|
atomicshop/wrappers/socketw/socket_server_tester.py,sha256=Qobmh4XV8ZxLUaw-eW4ESKAbeSLecCKn2OWFzMhadk0,6420
|
|
311
|
-
atomicshop/wrappers/socketw/socket_wrapper.py,sha256=
|
|
311
|
+
atomicshop/wrappers/socketw/socket_wrapper.py,sha256=GZyDzuc9Snm3qthl9gkGB9_Yb4p_Egp0sMtaivQ2xuo,42654
|
|
312
312
|
atomicshop/wrappers/socketw/ssl_base.py,sha256=62-hPm7zla1rh3m_WvDnXqKH-sDUTdiRptD8STCkgdk,2313
|
|
313
313
|
atomicshop/wrappers/socketw/statistics_csv.py,sha256=_gA8bMX6Sw_UCXKi2y9wNAwlqifgExgDGfQIa9pFxQA,5543
|
|
314
314
|
atomicshop/wrappers/winregw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
315
315
|
atomicshop/wrappers/winregw/winreg_installed_software.py,sha256=Qzmyktvob1qp6Tjk2DjLfAqr_yXV0sgWzdMW_9kwNjY,2345
|
|
316
316
|
atomicshop/wrappers/winregw/winreg_network.py,sha256=ih0BVNwByLvf9F_Lac4EdmDYYJA3PzMvmG0PieDZrsE,9905
|
|
317
|
-
atomicshop-3.3.
|
|
318
|
-
atomicshop-3.3.
|
|
319
|
-
atomicshop-3.3.
|
|
320
|
-
atomicshop-3.3.
|
|
321
|
-
atomicshop-3.3.
|
|
317
|
+
atomicshop-3.3.26.dist-info/licenses/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
|
|
318
|
+
atomicshop-3.3.26.dist-info/METADATA,sha256=IvU66yRmy4iNKUf6PLOdThdn4s6XZ7qEHfWO5sH5FE8,9318
|
|
319
|
+
atomicshop-3.3.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
320
|
+
atomicshop-3.3.26.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
|
|
321
|
+
atomicshop-3.3.26.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|