atomicshop 3.3.8__py3-none-any.whl → 3.10.0__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/a_mains/get_local_tcp_ports.py +85 -0
- atomicshop/a_mains/install_ca_certificate.py +172 -0
- atomicshop/a_mains/process_from_port.py +119 -0
- atomicshop/a_mains/set_default_dns_gateway.py +90 -0
- atomicshop/basics/strings.py +1 -1
- atomicshop/certificates.py +2 -2
- atomicshop/dns.py +26 -28
- atomicshop/etws/traces/trace_tcp.py +1 -2
- atomicshop/mitm/centered_settings.py +133 -0
- atomicshop/mitm/config_static.py +22 -44
- atomicshop/mitm/connection_thread_worker.py +383 -165
- atomicshop/mitm/engines/__parent/recorder___parent.py +1 -1
- atomicshop/mitm/engines/__parent/requester___parent.py +1 -1
- atomicshop/mitm/engines/__parent/responder___parent.py +15 -2
- atomicshop/mitm/engines/create_module_template.py +1 -2
- atomicshop/mitm/import_config.py +91 -89
- atomicshop/mitm/initialize_engines.py +1 -2
- atomicshop/mitm/message.py +5 -4
- atomicshop/mitm/mitm_main.py +238 -122
- atomicshop/mitm/recs_files.py +61 -5
- atomicshop/mitm/ssh_tester.py +82 -0
- atomicshop/mitm/statistic_analyzer.py +33 -12
- atomicshop/mitm/statistic_analyzer_helper/moving_average_helper.py +104 -31
- atomicshop/networks.py +160 -92
- atomicshop/package_mains_processor.py +84 -0
- atomicshop/permissions/ubuntu_permissions.py +47 -0
- atomicshop/print_api.py +3 -5
- atomicshop/process.py +11 -4
- atomicshop/python_functions.py +23 -108
- atomicshop/speech_recognize.py +8 -0
- atomicshop/ssh_remote.py +140 -164
- atomicshop/web.py +63 -22
- atomicshop/web_apis/google_llm.py +22 -14
- atomicshop/wrappers/ctyping/msi_windows_installer/cabs.py +2 -1
- atomicshop/wrappers/ctyping/msi_windows_installer/extract_msi_main.py +2 -1
- atomicshop/wrappers/dockerw/dockerw.py +2 -2
- atomicshop/wrappers/elasticsearchw/config_basic.py +0 -12
- atomicshop/wrappers/elasticsearchw/elastic_infra.py +0 -190
- atomicshop/wrappers/factw/install/pre_install_and_install_before_restart.py +5 -5
- atomicshop/wrappers/githubw.py +180 -68
- atomicshop/wrappers/loggingw/consts.py +1 -1
- atomicshop/wrappers/loggingw/handlers.py +1 -1
- atomicshop/wrappers/loggingw/loggingw.py +20 -4
- atomicshop/wrappers/loggingw/reading.py +18 -0
- atomicshop/wrappers/mongodbw/mongo_infra.py +0 -38
- atomicshop/wrappers/netshw.py +124 -3
- atomicshop/wrappers/playwrightw/scenarios.py +1 -1
- atomicshop/wrappers/powershell_networking.py +80 -0
- atomicshop/wrappers/psutilw/psutil_networks.py +9 -0
- atomicshop/wrappers/pywin32w/win_event_log/fetch.py +174 -0
- atomicshop/wrappers/pywin32w/win_event_log/subscribes/process_create.py +3 -105
- atomicshop/wrappers/pywin32w/win_event_log/subscribes/process_terminate.py +3 -57
- atomicshop/wrappers/pywin32w/wmis/win32_networkadapterconfiguration.py +12 -27
- atomicshop/wrappers/pywin32w/wmis/win32networkadapter.py +15 -9
- atomicshop/wrappers/socketw/certificator.py +19 -9
- atomicshop/wrappers/socketw/creator.py +101 -14
- atomicshop/wrappers/socketw/dns_server.py +17 -5
- atomicshop/wrappers/socketw/exception_wrapper.py +21 -16
- atomicshop/wrappers/socketw/process_getter.py +86 -0
- atomicshop/wrappers/socketw/receiver.py +29 -9
- atomicshop/wrappers/socketw/sender.py +10 -9
- atomicshop/wrappers/socketw/sni.py +31 -10
- atomicshop/wrappers/socketw/{base.py → socket_base.py} +33 -1
- atomicshop/wrappers/socketw/socket_client.py +11 -10
- atomicshop/wrappers/socketw/socket_wrapper.py +125 -32
- atomicshop/wrappers/socketw/ssl_base.py +6 -2
- atomicshop/wrappers/ubuntu_terminal.py +21 -18
- atomicshop/wrappers/win_auditw.py +189 -0
- {atomicshop-3.3.8.dist-info → atomicshop-3.10.0.dist-info}/METADATA +25 -30
- {atomicshop-3.3.8.dist-info → atomicshop-3.10.0.dist-info}/RECORD +83 -109
- atomicshop/_basics_temp.py +0 -101
- atomicshop/a_installs/ubuntu/docker_rootless.py +0 -11
- atomicshop/a_installs/ubuntu/docker_sudo.py +0 -11
- atomicshop/a_installs/ubuntu/elastic_search_and_kibana.py +0 -10
- atomicshop/a_installs/ubuntu/mongodb.py +0 -12
- atomicshop/a_installs/win/fibratus.py +0 -9
- atomicshop/a_installs/win/mongodb.py +0 -9
- atomicshop/a_installs/win/wsl_ubuntu_lts.py +0 -10
- atomicshop/addons/a_setup_scripts/install_psycopg2_ubuntu.sh +0 -3
- atomicshop/addons/package_setup/CreateWheel.cmd +0 -7
- atomicshop/addons/package_setup/Setup in Edit mode.cmd +0 -6
- atomicshop/addons/package_setup/Setup.cmd +0 -7
- atomicshop/archiver/__init__.py +0 -0
- atomicshop/archiver/_search_in_zip.py +0 -189
- atomicshop/archiver/search_in_archive.py +0 -284
- atomicshop/archiver/sevenz_app_w.py +0 -86
- atomicshop/archiver/sevenzs.py +0 -73
- atomicshop/archiver/shutils.py +0 -34
- atomicshop/archiver/zips.py +0 -353
- atomicshop/file_types.py +0 -24
- atomicshop/pbtkmultifile_argparse.py +0 -88
- atomicshop/script_as_string_processor.py +0 -42
- atomicshop/ssh_scripts/process_from_ipv4.py +0 -37
- atomicshop/ssh_scripts/process_from_port.py +0 -27
- atomicshop/wrappers/_process_wrapper_curl.py +0 -27
- atomicshop/wrappers/_process_wrapper_tar.py +0 -21
- atomicshop/wrappers/dockerw/install_docker.py +0 -449
- atomicshop/wrappers/elasticsearchw/install_elastic.py +0 -233
- atomicshop/wrappers/ffmpegw.py +0 -125
- atomicshop/wrappers/fibratusw/__init__.py +0 -0
- atomicshop/wrappers/fibratusw/install.py +0 -80
- atomicshop/wrappers/mongodbw/install_mongodb_ubuntu.py +0 -100
- atomicshop/wrappers/mongodbw/install_mongodb_win.py +0 -244
- atomicshop/wrappers/process_wrapper_pbtk.py +0 -16
- atomicshop/wrappers/socketw/get_process.py +0 -123
- atomicshop/wrappers/wslw.py +0 -192
- atomicshop-3.3.8.dist-info/entry_points.txt +0 -2
- /atomicshop/{addons → a_mains/addons}/PlayWrightCodegen.cmd +0 -0
- /atomicshop/{addons → a_mains/addons}/ScriptExecution.cmd +0 -0
- /atomicshop/{addons → a_mains/addons}/inits/init_to_import_all_modules.py +0 -0
- /atomicshop/{addons → a_mains/addons}/process_list/ReadMe.txt +0 -0
- /atomicshop/{addons → a_mains/addons}/process_list/compile.cmd +0 -0
- /atomicshop/{addons → a_mains/addons}/process_list/compiled/Win10x64/process_list.dll +0 -0
- /atomicshop/{addons → a_mains/addons}/process_list/compiled/Win10x64/process_list.exp +0 -0
- /atomicshop/{addons → a_mains/addons}/process_list/compiled/Win10x64/process_list.lib +0 -0
- /atomicshop/{addons → a_mains/addons}/process_list/process_list.cpp +0 -0
- {atomicshop-3.3.8.dist-info → atomicshop-3.10.0.dist-info}/WHEEL +0 -0
- {atomicshop-3.3.8.dist-info → atomicshop-3.10.0.dist-info}/licenses/LICENSE.txt +0 -0
- {atomicshop-3.3.8.dist-info → atomicshop-3.10.0.dist-info}/top_level.txt +0 -0
|
@@ -76,7 +76,7 @@ class RecorderParent:
|
|
|
76
76
|
self.recorder_worker_thread = threading.Thread(
|
|
77
77
|
target=save_message_worker,
|
|
78
78
|
args=(self.record_file_path, self.message_queue, self.logger),
|
|
79
|
-
name=f"Thread-{self.class_client_message.thread_id}-Recorder",
|
|
79
|
+
name=f"{self.class_client_message.thread_process} | Thread-{self.class_client_message.thread_id}-Recorder",
|
|
80
80
|
daemon=True
|
|
81
81
|
)
|
|
82
82
|
self.recorder_worker_thread.start()
|
|
@@ -112,5 +112,5 @@ class RequesterParent:
|
|
|
112
112
|
def create_request(self, class_client_message: ClientMessage, **kwargs) -> bytes:
|
|
113
113
|
""" This function should be overridden in the child class. """
|
|
114
114
|
|
|
115
|
-
request_bytes: bytes =
|
|
115
|
+
request_bytes: bytes = None
|
|
116
116
|
return request_bytes
|
|
@@ -18,6 +18,20 @@ class ResponderParent:
|
|
|
18
18
|
"""The class that is responsible for generating response to client based on the received message."""
|
|
19
19
|
def __init__(self):
|
|
20
20
|
self.logger = create_custom_logger()
|
|
21
|
+
# engine: initialize_engines.ModuleCategory
|
|
22
|
+
self.engine = None
|
|
23
|
+
|
|
24
|
+
def add_args(
|
|
25
|
+
self,
|
|
26
|
+
# engine: initialize_engines.ModuleCategory
|
|
27
|
+
engine = None
|
|
28
|
+
):
|
|
29
|
+
"""
|
|
30
|
+
Add more arguments to the class.
|
|
31
|
+
This is needed to be backwards compatible and not to change the child class apis.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
self.engine = engine
|
|
21
35
|
|
|
22
36
|
@staticmethod
|
|
23
37
|
def get_path_parts(path: str):
|
|
@@ -202,5 +216,4 @@ class ResponderParent:
|
|
|
202
216
|
def create_response(self, class_client_message: ClientMessage):
|
|
203
217
|
""" This function should be overridden in the child class. """
|
|
204
218
|
|
|
205
|
-
|
|
206
|
-
return response_bytes_list
|
|
219
|
+
return None
|
|
@@ -85,8 +85,7 @@ class CreateModuleTemplate:
|
|
|
85
85
|
domains_with_quotes: list = [f'"{domain}"' for domain in self.domains]
|
|
86
86
|
|
|
87
87
|
config_lines_list.append('[engine]')
|
|
88
|
-
config_lines_list.append(f'domains = [{", ".join(domains_with_quotes)}]')
|
|
89
|
-
config_lines_list.append('localhost = 1\n')
|
|
88
|
+
config_lines_list.append(f'domains = [{", ".join(domains_with_quotes)}]\n')
|
|
90
89
|
config_lines_list.append('[on_port_connect]')
|
|
91
90
|
config_lines_list.append('#5000 = "31.31.31.31:443"')
|
|
92
91
|
config_lines_list.append('#5000 = "ip_port_address.txt"\n')
|
atomicshop/mitm/import_config.py
CHANGED
|
@@ -5,35 +5,12 @@ import socket
|
|
|
5
5
|
from ..print_api import print_api
|
|
6
6
|
from .. import config_init, filesystem, dns
|
|
7
7
|
from ..permissions import permissions
|
|
8
|
-
from ..wrappers.socketw import
|
|
8
|
+
from ..wrappers.socketw import socket_base
|
|
9
9
|
from ..basics import booleans
|
|
10
10
|
|
|
11
11
|
from . import config_static, initialize_engines
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
def assign_bool(dict_instance: dict, section: str, key: str):
|
|
15
|
-
# If the value is already boolean, don't do anything.
|
|
16
|
-
if dict_instance[section][key] is True or dict_instance[section][key] is False:
|
|
17
|
-
return
|
|
18
|
-
elif dict_instance[section][key] == 1:
|
|
19
|
-
dict_instance[section][key] = True
|
|
20
|
-
elif dict_instance[section][key] == 0:
|
|
21
|
-
dict_instance[section][key] = False
|
|
22
|
-
elif isinstance(dict_instance[section][key], dict):
|
|
23
|
-
for subkey, subvalue in dict_instance[section][key].items():
|
|
24
|
-
if subkey == '1':
|
|
25
|
-
dict_instance[section][key] = {True: subvalue}
|
|
26
|
-
elif subkey == '0':
|
|
27
|
-
dict_instance[section][key] = {False: subvalue}
|
|
28
|
-
else:
|
|
29
|
-
print_api(f"Error: {section}.{key}.{subkey} must be 0 or 1.", color='red')
|
|
30
|
-
return 1
|
|
31
|
-
break
|
|
32
|
-
else:
|
|
33
|
-
print_api(f"Error: {section}.{key} must be 0 or 1.", color='red')
|
|
34
|
-
return 1
|
|
35
|
-
|
|
36
|
-
|
|
37
14
|
def import_config_files(
|
|
38
15
|
config_file_path: str,
|
|
39
16
|
print_kwargs: dict = None
|
|
@@ -52,17 +29,48 @@ def import_config_files(
|
|
|
52
29
|
print_kwargs=print_kwargs or {}
|
|
53
30
|
)
|
|
54
31
|
|
|
55
|
-
# Assign boolean values to the toml dict module.
|
|
56
|
-
for boolean_tuple in config_static.LIST_OF_BOOLEANS:
|
|
57
|
-
assign_bool(config_toml, boolean_tuple[0], boolean_tuple[1])
|
|
58
32
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
33
|
+
config_static.MainConfig.is_offline = bool(config_toml['dnstcp']['offline'])
|
|
34
|
+
config_static.MainConfig.network_interface = config_toml['dnstcp']['network_interface']
|
|
35
|
+
config_static.MainConfig.is_localhost = bool(config_toml['dnstcp']['localhost'])
|
|
36
|
+
config_static.MainConfig.set_default_dns_gateway = config_toml['dnstcp']['set_default_dns_gateway']
|
|
37
|
+
|
|
38
|
+
config_static.DNSServer.is_enabled = bool(config_toml['dns']['enable'])
|
|
39
|
+
config_static.DNSServer.listening_ipv4 = config_toml['dns']['listening_ipv4']
|
|
40
|
+
config_static.DNSServer.listening_port = config_toml['dns']['listening_port']
|
|
41
|
+
config_static.DNSServer.forwarding_dns_service_ipv4 = config_toml['dns']['forwarding_dns_service_ipv4']
|
|
42
|
+
config_static.DNSServer.cache_timeout_minutes = config_toml['dns']['cache_timeout_minutes']
|
|
43
|
+
config_static.DNSServer.resolve_by_engine = bool(config_toml['dns']['resolve_by_engine'])
|
|
44
|
+
config_static.DNSServer.resolve_regular_pass_thru = bool(config_toml['dns']['resolve_regular_pass_thru'])
|
|
45
|
+
config_static.DNSServer.resolve_all_domains_to_ipv4 = config_toml['dns']['resolve_all_domains_to_ipv4']
|
|
46
|
+
|
|
47
|
+
config_static.TCPServer.is_enabled = bool(config_toml['tcp']['enable'])
|
|
48
|
+
config_static.TCPServer.no_engines_usage_to_listen_addresses = config_toml['tcp']['no_engines_usage_to_listen_addresses']
|
|
49
|
+
|
|
50
|
+
config_static.LogRec.logs_path = config_toml['logrec']['logs_path']
|
|
51
|
+
config_static.LogRec.enable_request_response_recordings_in_logs = bool(config_toml['logrec']['enable_request_response_recordings_in_logs'])
|
|
52
|
+
config_static.LogRec.store_logs_for_x_days = config_toml['logrec']['store_logs_for_x_days']
|
|
53
|
+
|
|
54
|
+
config_static.Certificates.install_ca_certificate_to_root_store = bool(config_toml['certificates']['install_ca_certificate_to_root_store'])
|
|
55
|
+
config_static.Certificates.uninstall_unused_ca_certificates_with_mitm_ca_name = bool(config_toml['certificates']['uninstall_unused_ca_certificates_with_mitm_ca_name'])
|
|
56
|
+
config_static.Certificates.default_server_certificate_usage = bool(config_toml['certificates']['default_server_certificate_usage'])
|
|
57
|
+
config_static.Certificates.sni_add_new_domains_to_default_server_certificate = bool(config_toml['certificates']['sni_add_new_domains_to_default_server_certificate'])
|
|
58
|
+
config_static.Certificates.custom_server_certificate_usage = bool(config_toml['certificates']['custom_server_certificate_usage'])
|
|
59
|
+
config_static.Certificates.custom_server_certificate_path = config_toml['certificates']['custom_server_certificate_path']
|
|
60
|
+
config_static.Certificates.custom_private_key_path = config_toml['certificates']['custom_private_key_path']
|
|
61
|
+
config_static.Certificates.sni_create_server_certificate_for_each_domain = bool(config_toml['certificates']['sni_create_server_certificate_for_each_domain'])
|
|
62
|
+
config_static.Certificates.sni_server_certificates_cache_directory = config_toml['certificates']['sni_server_certificates_cache_directory']
|
|
63
|
+
config_static.Certificates.sni_get_server_certificate_from_server_socket = bool(config_toml['certificates']['sni_get_server_certificate_from_server_socket'])
|
|
64
|
+
config_static.Certificates.sni_server_certificate_from_server_socket_download_directory = config_toml['certificates']['sni_server_certificate_from_server_socket_download_directory']
|
|
65
|
+
|
|
66
|
+
config_static.SkipExtensions.tls_web_client_authentication = bool(config_toml['skip_extensions']['tls_web_client_authentication'])
|
|
67
|
+
config_static.SkipExtensions.crl_distribution_points = bool(config_toml['skip_extensions']['crl_distribution_points'])
|
|
68
|
+
config_static.SkipExtensions.authority_information_access = bool(config_toml['skip_extensions']['authority_information_access'])
|
|
69
|
+
|
|
70
|
+
config_static.ProcessName.get_process_name = bool(config_toml['process_name']['get_process_name'])
|
|
71
|
+
config_static.ProcessName.ssh_user = config_toml['process_name']['ssh_user']
|
|
72
|
+
config_static.ProcessName.ssh_pass = config_toml['process_name']['ssh_pass']
|
|
73
|
+
|
|
66
74
|
|
|
67
75
|
manipulations_after_import()
|
|
68
76
|
|
|
@@ -93,14 +101,14 @@ def import_engines_configs(print_kwargs: dict) -> int:
|
|
|
93
101
|
for engine_config_path in engine_config_path_list:
|
|
94
102
|
# Initialize engine.
|
|
95
103
|
current_module: initialize_engines.ModuleCategory = initialize_engines.ModuleCategory(config_static.MainConfig.SCRIPT_DIRECTORY)
|
|
96
|
-
|
|
97
|
-
if
|
|
104
|
+
rc, error = current_module.fill_engine_fields_from_config(engine_config_path.path, print_kwargs=print_kwargs or {})
|
|
105
|
+
if rc != 0:
|
|
98
106
|
print_api(f"Error reading engine config file: {engine_config_path.path}\n{error}", color='red')
|
|
99
|
-
return
|
|
100
|
-
|
|
101
|
-
if
|
|
107
|
+
return rc
|
|
108
|
+
rc, error = current_module.initialize_engine(print_kwargs=print_kwargs or {})
|
|
109
|
+
if rc != 0:
|
|
102
110
|
print_api(f"Error initializing engine from directory: {Path(engine_config_path.path).parent}\n{error}", color='red')
|
|
103
|
-
return
|
|
111
|
+
return rc
|
|
104
112
|
|
|
105
113
|
# Extending the full engine domain list with this list.
|
|
106
114
|
domains_engine_list_full.extend(current_module.domain_list)
|
|
@@ -116,7 +124,15 @@ def import_engines_configs(print_kwargs: dict) -> int:
|
|
|
116
124
|
return result_code
|
|
117
125
|
|
|
118
126
|
# Assigning all the engines domains to all time domains, that will be responsible for adding new domains.
|
|
119
|
-
|
|
127
|
+
domains_all_times_with_ports: list[str] = list(domains_engine_list_full)
|
|
128
|
+
|
|
129
|
+
domains_all_times: list[str] = list()
|
|
130
|
+
for domain_and_port in domains_all_times_with_ports:
|
|
131
|
+
domain: str = domain_and_port.split(':')[0]
|
|
132
|
+
if domain not in domains_engine_list_full:
|
|
133
|
+
domains_all_times.append(domain)
|
|
134
|
+
|
|
135
|
+
config_static.Certificates.domains_all_times = domains_all_times
|
|
120
136
|
|
|
121
137
|
config_static.ENGINES_LIST = engines_list
|
|
122
138
|
config_static.REFERENCE_MODULE = reference_module
|
|
@@ -134,7 +150,7 @@ def check_configurations() -> int:
|
|
|
134
150
|
is_admin = permissions.is_admin()
|
|
135
151
|
|
|
136
152
|
# Check if both DNS and TCP servers are disabled. ==============================================================
|
|
137
|
-
if not config_static.DNSServer.
|
|
153
|
+
if not config_static.DNSServer.is_enabled and not config_static.TCPServer.is_enabled:
|
|
138
154
|
print_api("Both DNS and TCP servers in config ini file, nothing to run. Exiting...", color='red')
|
|
139
155
|
return 1
|
|
140
156
|
|
|
@@ -165,7 +181,6 @@ def check_configurations() -> int:
|
|
|
165
181
|
print_api(error_message, color="red")
|
|
166
182
|
return 1
|
|
167
183
|
|
|
168
|
-
is_localhost: bool | None = None
|
|
169
184
|
for engine in config_static.ENGINES_LIST:
|
|
170
185
|
port_list: list[str] = []
|
|
171
186
|
for domain_port in engine.domain_list:
|
|
@@ -206,20 +221,11 @@ def check_configurations() -> int:
|
|
|
206
221
|
return 1
|
|
207
222
|
|
|
208
223
|
|
|
209
|
-
|
|
210
|
-
#
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
else:
|
|
215
|
-
if is_localhost != engine.is_localhost:
|
|
216
|
-
message = (
|
|
217
|
-
f"[*] Mixed [localhost] setting in the engines found.\n"
|
|
218
|
-
f"[*] Some engines are set to [localhost] and some are not.\n"
|
|
219
|
-
f"[*] This is not allowed. All engines must be set to [localhost = 1] or All engines must be set to [localhost = 0].\n"
|
|
220
|
-
f"Please check your engine configuration files.")
|
|
221
|
-
print_api(message, color="red")
|
|
222
|
-
return 1
|
|
224
|
+
if not config_static.MainConfig.is_localhost and not is_admin:
|
|
225
|
+
# If we're not in localhost mode, this means we need to set virtual IPv4 addresses, which requires admin rights.
|
|
226
|
+
message = "In order to run the server in non-localhost mode, administrative rights are required.\nExiting..."
|
|
227
|
+
print_api(message, color='red')
|
|
228
|
+
return 1
|
|
223
229
|
|
|
224
230
|
# Check admin right if on localhost ============================================================================
|
|
225
231
|
# If any of the DNS IP target addresses is localhost loopback, then we need to check if the script
|
|
@@ -230,16 +236,15 @@ def check_configurations() -> int:
|
|
|
230
236
|
if config_static.ProcessName.get_process_name:
|
|
231
237
|
# If the DNS server was set to resolve by engines, we need to check all relevant engine settings.
|
|
232
238
|
if config_static.DNSServer.resolve_by_engine:
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
return 1
|
|
239
|
+
# Check if the DNS target is localhost loopback.
|
|
240
|
+
if config_static.MainConfig.is_localhost and not is_admin:
|
|
241
|
+
message: str = \
|
|
242
|
+
("Need to run the script with administrative rights to get the process name while TCP "
|
|
243
|
+
"running on the same computer.\nExiting...")
|
|
244
|
+
print_api(message, color='red')
|
|
245
|
+
return 1
|
|
241
246
|
if config_static.DNSServer.resolve_all_domains_to_ipv4:
|
|
242
|
-
if config_static.DNSServer.target_ipv4 in
|
|
247
|
+
if config_static.DNSServer.target_ipv4 in socket_base.THIS_DEVICE_IP_LIST or \
|
|
243
248
|
config_static.DNSServer.target_ipv4.startswith('127.'):
|
|
244
249
|
if not is_admin:
|
|
245
250
|
message: str = \
|
|
@@ -248,33 +253,17 @@ def check_configurations() -> int:
|
|
|
248
253
|
print_api(message, color='red')
|
|
249
254
|
return 1
|
|
250
255
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
booleans_list_of_tuples=[
|
|
254
|
-
(config_static.DNSServer.set_default_dns_gateway, '[dns][set_default_dns_gateway]'),
|
|
255
|
-
(config_static.DNSServer.set_default_dns_gateway_to_localhost,
|
|
256
|
-
'[dns][set_default_dns_gateway_to_localhost]'),
|
|
257
|
-
(config_static.DNSServer.set_default_dns_gateway_to_default_interface_ipv4,
|
|
258
|
-
'[dns][set_default_dns_gateway_to_default_interface_ipv4]')
|
|
259
|
-
],
|
|
260
|
-
raise_if_all_false=False
|
|
261
|
-
)
|
|
262
|
-
except ValueError as e:
|
|
263
|
-
print_api(str(e), color='red')
|
|
264
|
-
return 1
|
|
265
|
-
|
|
266
|
-
if (config_static.DNSServer.set_default_dns_gateway or
|
|
267
|
-
config_static.DNSServer.set_default_dns_gateway_to_localhost or
|
|
268
|
-
config_static.DNSServer.set_default_dns_gateway_to_default_interface_ipv4):
|
|
256
|
+
if (config_static.MainConfig.set_default_dns_gateway or
|
|
257
|
+
config_static.MainConfig.set_default_dns_gateway_to_network_interface_ipv4):
|
|
269
258
|
# Get current settings of the DNS gateway.
|
|
270
259
|
is_dns_dynamic, current_dns_gateway = dns.get_default_dns_gateway()
|
|
271
260
|
|
|
272
261
|
if not is_admin:
|
|
273
|
-
if config_static.
|
|
274
|
-
ipv4_address_list = config_static.
|
|
275
|
-
elif config_static.
|
|
276
|
-
ipv4_address_list = [
|
|
277
|
-
elif config_static.
|
|
262
|
+
if config_static.MainConfig.set_default_dns_gateway:
|
|
263
|
+
ipv4_address_list = config_static.MainConfig.set_default_dns_gateway
|
|
264
|
+
elif config_static.MainConfig.set_default_dns_gateway_to_network_interface_ipv4 and config_static.MainConfig.is_localhost:
|
|
265
|
+
ipv4_address_list = [config_static.MainConfig.default_localhost_dns_gateway_ipv4]
|
|
266
|
+
elif config_static.MainConfig.set_default_dns_gateway_to_network_interface_ipv4 and not config_static.MainConfig.is_localhost:
|
|
278
267
|
ipv4_address_list = [socket.gethostbyname(socket.gethostname())]
|
|
279
268
|
else:
|
|
280
269
|
raise ValueError("Error: DNS gateway configuration is not set.")
|
|
@@ -311,11 +300,21 @@ def check_configurations() -> int:
|
|
|
311
300
|
|
|
312
301
|
def manipulations_after_import():
|
|
313
302
|
for key, value in config_static.DNSServer.resolve_all_domains_to_ipv4.items():
|
|
303
|
+
key = bool(int(key))
|
|
314
304
|
config_static.DNSServer.resolve_all_domains_to_ipv4_enable = key
|
|
315
305
|
config_static.DNSServer.target_ipv4 = value
|
|
316
306
|
break
|
|
317
307
|
|
|
308
|
+
if config_static.MainConfig.set_default_dns_gateway:
|
|
309
|
+
if config_static.MainConfig.set_default_dns_gateway[0] == 'l':
|
|
310
|
+
config_static.MainConfig.set_default_dns_gateway_to_localhost = True
|
|
311
|
+
config_static.MainConfig.set_default_dns_gateway = list()
|
|
312
|
+
elif config_static.MainConfig.set_default_dns_gateway[0] == 'n':
|
|
313
|
+
config_static.MainConfig.set_default_dns_gateway_to_network_interface_ipv4 = True
|
|
314
|
+
config_static.MainConfig.set_default_dns_gateway = list()
|
|
315
|
+
|
|
318
316
|
for key, value in config_static.TCPServer.no_engines_usage_to_listen_addresses.items():
|
|
317
|
+
key = bool(int(key))
|
|
319
318
|
# If the key is False, it means that the user doesn't want to use the no_engines_listening_address_list.
|
|
320
319
|
# So, we'll assign an empty list to it.
|
|
321
320
|
if not key:
|
|
@@ -361,3 +360,6 @@ def manipulations_after_import():
|
|
|
361
360
|
filesystem.check_absolute_path___add_full(
|
|
362
361
|
config_static.Certificates.sni_server_certificate_from_server_socket_download_directory,
|
|
363
362
|
config_static.MainConfig.SCRIPT_DIRECTORY)
|
|
363
|
+
config_static.Certificates.sslkeylog_file_path = (f"{config_static.LogRec.logs_path}{os.sep}"
|
|
364
|
+
f"{config_static.Certificates.sslkeylog_file_name}")
|
|
365
|
+
|
|
@@ -54,7 +54,6 @@ class ModuleCategory:
|
|
|
54
54
|
|
|
55
55
|
# Getting the parameters from engine config file
|
|
56
56
|
self.domain_list = configuration_data['engine']['domains']
|
|
57
|
-
self.is_localhost = bool(configuration_data['engine']['localhost'])
|
|
58
57
|
|
|
59
58
|
if 'on_port_connect' in configuration_data:
|
|
60
59
|
self.on_port_connect = configuration_data['on_port_connect']
|
|
@@ -88,7 +87,7 @@ class ModuleCategory:
|
|
|
88
87
|
error_string: str = f"No [domain:port] pair found in: {domain_port_string}"
|
|
89
88
|
return 1, error_string
|
|
90
89
|
|
|
91
|
-
self.domain_target_dict[domain] = {'ip': None, 'port': port}
|
|
90
|
+
self.domain_target_dict[domain] = {'ip': None, 'port': int(port)}
|
|
92
91
|
|
|
93
92
|
for port, value in self.on_port_connect.items():
|
|
94
93
|
self.port_target_dict[port] = {'ip': None, 'port': int(port)}
|
atomicshop/mitm/message.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
|
-
from typing import Union
|
|
2
|
+
from typing import Union, Any
|
|
3
3
|
|
|
4
4
|
from .. import http_parse
|
|
5
5
|
from ..basics import dicts
|
|
@@ -14,12 +14,12 @@ class ClientMessage:
|
|
|
14
14
|
# noinspection PyTypeChecker
|
|
15
15
|
self.request_raw_bytes: bytes = None
|
|
16
16
|
self.request_auto_parsed: Union[http_parse.HTTPRequestParse, any] = None
|
|
17
|
-
self.request_custom_parsed:
|
|
17
|
+
self.request_custom_parsed: Any = None
|
|
18
18
|
self.request_raw_hex: hex = None
|
|
19
19
|
# noinspection PyTypeChecker
|
|
20
20
|
self.response_raw_bytes: bytes = None
|
|
21
|
-
self.response_auto_parsed:
|
|
22
|
-
self.response_custom_parsed:
|
|
21
|
+
self.response_auto_parsed: Any = None
|
|
22
|
+
self.response_custom_parsed: Any = None
|
|
23
23
|
self.response_raw_hex: hex = None
|
|
24
24
|
self.server_name: str = str()
|
|
25
25
|
self.server_ip: str = str()
|
|
@@ -29,6 +29,7 @@ class ClientMessage:
|
|
|
29
29
|
self.destination_port: int = int()
|
|
30
30
|
self.process_name: str = str()
|
|
31
31
|
self.thread_id = None
|
|
32
|
+
self.thread_process: str = str()
|
|
32
33
|
self.info: str = str()
|
|
33
34
|
self.errors: list = list()
|
|
34
35
|
self.protocol: str = str()
|