atomicshop 2.16.10__py3-none-any.whl → 2.16.12__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/basics/enums.py +2 -2
- atomicshop/basics/list_of_classes.py +29 -0
- atomicshop/dns.py +2 -4
- atomicshop/file_io/docxs.py +4 -4
- atomicshop/file_io/file_io.py +12 -0
- atomicshop/filesystem.py +265 -198
- atomicshop/mitm/config_static.py +7 -8
- atomicshop/mitm/connection_thread_worker.py +59 -39
- atomicshop/mitm/engines/__parent/parser___parent.py +0 -1
- atomicshop/mitm/engines/__parent/recorder___parent.py +5 -6
- atomicshop/mitm/engines/__parent/responder___parent.py +0 -1
- atomicshop/mitm/import_config.py +6 -4
- atomicshop/mitm/initialize_engines.py +6 -6
- atomicshop/mitm/message.py +1 -0
- atomicshop/mitm/{initialize_mitm_server.py → mitm_main.py} +57 -32
- atomicshop/mitm/recs_files.py +17 -17
- atomicshop/mitm/statistic_analyzer.py +2 -2
- atomicshop/ssh_remote.py +9 -9
- atomicshop/wrappers/factw/install/pre_install_and_install_before_restart.py +1 -1
- atomicshop/wrappers/loggingw/reading.py +63 -100
- atomicshop/wrappers/pywin32w/wmis/helpers.py +5 -1
- atomicshop/wrappers/pywin32w/wmis/win32networkadapter.py +0 -32
- atomicshop/wrappers/socketw/dns_server.py +9 -10
- atomicshop/wrappers/socketw/exception_wrapper.py +5 -7
- atomicshop/wrappers/socketw/get_process.py +3 -3
- atomicshop/wrappers/socketw/receiver.py +3 -3
- atomicshop/wrappers/socketw/sender.py +1 -1
- atomicshop/wrappers/socketw/sni.py +1 -1
- atomicshop/wrappers/socketw/socket_server_tester.py +5 -5
- atomicshop/wrappers/winregw/__init__.py +0 -0
- atomicshop/wrappers/winregw/winreg_network.py +174 -0
- {atomicshop-2.16.10.dist-info → atomicshop-2.16.12.dist-info}/METADATA +1 -1
- {atomicshop-2.16.10.dist-info → atomicshop-2.16.12.dist-info}/RECORD +37 -34
- {atomicshop-2.16.10.dist-info → atomicshop-2.16.12.dist-info}/LICENSE.txt +0 -0
- {atomicshop-2.16.10.dist-info → atomicshop-2.16.12.dist-info}/WHEEL +0 -0
- {atomicshop-2.16.10.dist-info → atomicshop-2.16.12.dist-info}/top_level.txt +0 -0
atomicshop/__init__.py
CHANGED
atomicshop/basics/enums.py
CHANGED
|
@@ -32,10 +32,10 @@ def __comparison_usage_example(
|
|
|
32
32
|
main folder.
|
|
33
33
|
|
|
34
34
|
Usage:
|
|
35
|
-
from atomicshop.filesystem import
|
|
35
|
+
from atomicshop.filesystem import get_paths_from_directory, ComparisonOperator
|
|
36
36
|
|
|
37
37
|
# Get full paths of all the 'engine_config.ini' files.
|
|
38
|
-
engine_config_path_list =
|
|
38
|
+
engine_config_path_list = get_paths_from_directory(
|
|
39
39
|
directory_fullpath=some_directory_path,
|
|
40
40
|
file_name_check_tuple=(config_file_name, ComparisonOperator.EQ))
|
|
41
41
|
"""
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from operator import attrgetter
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def sort_by_attributes(
|
|
5
|
+
list_instance: list,
|
|
6
|
+
attribute_list: list,
|
|
7
|
+
reverse: bool = False,
|
|
8
|
+
case_insensitive: bool = False
|
|
9
|
+
):
|
|
10
|
+
"""
|
|
11
|
+
Sort a list of objects by their attributes.
|
|
12
|
+
|
|
13
|
+
:param list_instance: list of objects.
|
|
14
|
+
:param attribute_list: list of attributes (strings). The sorting will be done by the attributes in the list.
|
|
15
|
+
In the appearing order in the list.
|
|
16
|
+
:param reverse: bool, sort in reverse order.
|
|
17
|
+
:param case_insensitive: bool, sorting will be case-insensitive.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
for attribute in attribute_list:
|
|
21
|
+
if case_insensitive:
|
|
22
|
+
list_instance = sorted(
|
|
23
|
+
list_instance, key=lambda obj: getattr(obj, attribute).lower(), reverse=reverse
|
|
24
|
+
)
|
|
25
|
+
else:
|
|
26
|
+
list_instance = sorted(
|
|
27
|
+
list_instance, key=attrgetter(attribute), reverse=reverse
|
|
28
|
+
)
|
|
29
|
+
return list_instance
|
atomicshop/dns.py
CHANGED
|
@@ -5,6 +5,7 @@ import dns.resolver
|
|
|
5
5
|
from .print_api import print_api
|
|
6
6
|
from .permissions import permissions
|
|
7
7
|
from .wrappers.pywin32w.wmis import win32networkadapter
|
|
8
|
+
from .wrappers.winregw import winreg_network
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
# Defining Dictionary of Numeric to String DNS Query Types.
|
|
@@ -71,10 +72,7 @@ def get_default_dns_gateway() -> tuple[bool, list[str]]:
|
|
|
71
72
|
:return: tuple(is dynamic boolean, list of DNS server IPv4s).
|
|
72
73
|
"""
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
dns_servers = list(resolver.nameservers)
|
|
76
|
-
|
|
77
|
-
is_dynamic = win32networkadapter.is_adapter_dns_gateway_from_dhcp(use_default_interface=True)
|
|
75
|
+
is_dynamic, dns_servers = winreg_network.get_default_dns_gateway()
|
|
78
76
|
return is_dynamic, dns_servers
|
|
79
77
|
|
|
80
78
|
|
atomicshop/file_io/docxs.py
CHANGED
|
@@ -74,20 +74,20 @@ def search_for_hyperlink_in_files(directory_path: str, hyperlink: str, relative_
|
|
|
74
74
|
raise NotADirectoryError(f"Directory doesn't exist: {directory_path}")
|
|
75
75
|
|
|
76
76
|
# Get all the docx files in the specified directory.
|
|
77
|
-
files = filesystem.
|
|
78
|
-
directory_path, file_name_check_pattern="*\.docx",
|
|
77
|
+
files = filesystem.get_paths_from_directory(
|
|
78
|
+
directory_path, get_file=True, file_name_check_pattern="*\.docx",
|
|
79
79
|
add_relative_directory=True, relative_file_name_as_directory=True)
|
|
80
80
|
|
|
81
81
|
found_in_files: list = list()
|
|
82
82
|
for file_path in files:
|
|
83
|
-
hyperlinks = get_hyperlinks(file_path
|
|
83
|
+
hyperlinks = get_hyperlinks(file_path.path)
|
|
84
84
|
if hyperlink in hyperlinks:
|
|
85
85
|
found_in_files.append(file_path)
|
|
86
86
|
|
|
87
87
|
if relative_paths:
|
|
88
88
|
result_list = list()
|
|
89
89
|
for found_file in found_in_files:
|
|
90
|
-
result_list.append(found_file
|
|
90
|
+
result_list.append(found_file.relative_dir)
|
|
91
91
|
else:
|
|
92
92
|
result_list = found_in_files
|
|
93
93
|
|
atomicshop/file_io/file_io.py
CHANGED
|
@@ -21,6 +21,15 @@ def write_file_decorator(function_name):
|
|
|
21
21
|
|
|
22
22
|
print_api(message=f"Writing file: {kwargs['file_path']}", **kwargs)
|
|
23
23
|
|
|
24
|
+
if kwargs['enable_long_file_path']:
|
|
25
|
+
# A simpler string method would be to add '\\?\' to the beginning of the file path.
|
|
26
|
+
# kwargs['file_path'] = rf"\\?\{kwargs['file_path']}"
|
|
27
|
+
|
|
28
|
+
# Enable long file path.
|
|
29
|
+
from ctypes import windll
|
|
30
|
+
# Enable long file path.
|
|
31
|
+
windll.kernel32.SetFileAttributesW(kwargs['file_path'], 0x80)
|
|
32
|
+
|
|
24
33
|
try:
|
|
25
34
|
with open(kwargs['file_path'], kwargs['file_mode'], encoding=kwargs['encoding']) as output_file:
|
|
26
35
|
# Pass the 'output_file' object to kwargs that will pass the object to the executing function.
|
|
@@ -78,6 +87,7 @@ def write_file(
|
|
|
78
87
|
file_path: str,
|
|
79
88
|
file_mode: str = 'w',
|
|
80
89
|
encoding: str = None,
|
|
90
|
+
enable_long_file_path: bool = False,
|
|
81
91
|
file_object=None,
|
|
82
92
|
**kwargs) -> None:
|
|
83
93
|
"""
|
|
@@ -89,6 +99,8 @@ def write_file(
|
|
|
89
99
|
Default is 'w'.
|
|
90
100
|
:param encoding: string, write the file with encoding. Example: 'utf-8'. 'None' is default, since it is default
|
|
91
101
|
in 'open()' function.
|
|
102
|
+
:param enable_long_file_path: Boolean, by default Windows has a limit of 260 characters for file path. If True,
|
|
103
|
+
the long file path will be enabled, and the limit will be 32,767 characters.
|
|
92
104
|
:param file_object: file object of the 'open()' function in the decorator. Decorator executes the 'with open()'
|
|
93
105
|
statement and passes to this function. That's why the default is 'None', since we get it from the decorator.
|
|
94
106
|
:return:
|