atomicshop 2.12.7__py3-none-any.whl → 2.12.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/basics/list_of_dicts.py +11 -2
- atomicshop/basics/strings.py +21 -4
- atomicshop/monitor/checks/process_running.py +1 -1
- atomicshop/process.py +11 -3
- atomicshop/web.py +5 -2
- {atomicshop-2.12.7.dist-info → atomicshop-2.12.9.dist-info}/METADATA +1 -1
- {atomicshop-2.12.7.dist-info → atomicshop-2.12.9.dist-info}/RECORD +11 -11
- {atomicshop-2.12.7.dist-info → atomicshop-2.12.9.dist-info}/LICENSE.txt +0 -0
- {atomicshop-2.12.7.dist-info → atomicshop-2.12.9.dist-info}/WHEEL +0 -0
- {atomicshop-2.12.7.dist-info → atomicshop-2.12.9.dist-info}/top_level.txt +0 -0
atomicshop/__init__.py
CHANGED
|
@@ -100,7 +100,13 @@ def merge_to_dict(list_of_dicts: list) -> dict:
|
|
|
100
100
|
return result_dict
|
|
101
101
|
|
|
102
102
|
|
|
103
|
-
def is_value_exist_in_key(
|
|
103
|
+
def is_value_exist_in_key(
|
|
104
|
+
list_of_dicts: list,
|
|
105
|
+
key: str,
|
|
106
|
+
value_to_match: str,
|
|
107
|
+
value_case_insensitive: bool = False,
|
|
108
|
+
prefix_suffix: bool = False
|
|
109
|
+
) -> bool:
|
|
104
110
|
"""
|
|
105
111
|
The function will check if a value exists in a key in a list of dicts.
|
|
106
112
|
|
|
@@ -113,6 +119,7 @@ def is_value_exist_in_key(list_of_dicts: list, key: str, value_to_match: str, pr
|
|
|
113
119
|
:param key: str, the key to check in each entry (dict) in the list.
|
|
114
120
|
:param value_to_match: str, the value to find in the key.
|
|
115
121
|
This values is a pattern, so it can be a part of the value and can contain wildcards as "*" character.
|
|
122
|
+
:param value_case_insensitive: bool, if True the value will be matched case insensitive.
|
|
116
123
|
:param prefix_suffix: bool, related to how pattern of 'value_to_find' is matched against the value in the key.
|
|
117
124
|
Check the 'strings.match_pattern_against_string' function for more information.
|
|
118
125
|
:return: bool, True if the value exists in the key in any entry in the list of dicts, False if not.
|
|
@@ -121,7 +128,9 @@ def is_value_exist_in_key(list_of_dicts: list, key: str, value_to_match: str, pr
|
|
|
121
128
|
for dictionary in list_of_dicts:
|
|
122
129
|
try:
|
|
123
130
|
# if value_to_find in dictionary.get(key, None):
|
|
124
|
-
if strings.match_pattern_against_string(
|
|
131
|
+
if strings.match_pattern_against_string(
|
|
132
|
+
value_to_match, dictionary.get(key, None), case_insensitive=value_case_insensitive,
|
|
133
|
+
prefix_suffix=prefix_suffix):
|
|
125
134
|
return True
|
|
126
135
|
# If the key is not present in the dict 'TypeError' will be raised, since 'None' doesn't have the 'in' operator.
|
|
127
136
|
except TypeError:
|
atomicshop/basics/strings.py
CHANGED
|
@@ -108,7 +108,12 @@ def is_any_string_from_list_in_string(string_list: list, check_string: str) -> b
|
|
|
108
108
|
return any(test_string in check_string for test_string in string_list)
|
|
109
109
|
|
|
110
110
|
|
|
111
|
-
def match_pattern_against_string(
|
|
111
|
+
def match_pattern_against_string(
|
|
112
|
+
pattern: str,
|
|
113
|
+
check_string: str,
|
|
114
|
+
case_insensitive: bool = False,
|
|
115
|
+
prefix_suffix: bool = False
|
|
116
|
+
) -> bool:
|
|
112
117
|
"""
|
|
113
118
|
Function checks the 'pattern' against 'check_string' and returns 'True' if pattern matches and 'False' if not.
|
|
114
119
|
|
|
@@ -121,6 +126,7 @@ def match_pattern_against_string(pattern: str, check_string: str, prefix_suffix:
|
|
|
121
126
|
|
|
122
127
|
:param pattern: string, can include wildcards as '*'.
|
|
123
128
|
:param check_string: string, to check the pattern against.
|
|
129
|
+
:param case_insensitive: boolean, if 'True' will treat the 'pattern' and 'check_string' as case-insensitive.
|
|
124
130
|
:param prefix_suffix: boolean, that sets if the function should return 'True' also for all the cases that wildcard
|
|
125
131
|
in the beginning of the pattern and in the end of the pattern, since the default behavior of regex to return
|
|
126
132
|
'False' on these cases.
|
|
@@ -152,12 +158,16 @@ def match_pattern_against_string(pattern: str, check_string: str, prefix_suffix:
|
|
|
152
158
|
# on complex strings.
|
|
153
159
|
# return fnmatch.fnmatch(check_string, pattern)
|
|
154
160
|
|
|
161
|
+
# Determine the regex flags based on case_insensitive.
|
|
162
|
+
flags = re.IGNORECASE if case_insensitive else 0
|
|
163
|
+
|
|
155
164
|
def search_pattern(function_pattern):
|
|
156
165
|
# Use regex to match the pattern.
|
|
157
|
-
return re.search(fr'{function_pattern}', check_string)
|
|
166
|
+
return re.search(fr'{function_pattern}', check_string, flags)
|
|
158
167
|
|
|
159
168
|
wildcard_str: str = '*'
|
|
160
169
|
wildcard_re: str = '.+'
|
|
170
|
+
# wildcard_re: str = '.*' # Adjusted to '.*' to match zero or more characters
|
|
161
171
|
|
|
162
172
|
# Replace the wildcard string '*' with regex wildcard string '.+'.
|
|
163
173
|
# In regex '.' is a wildcard, but only for 1 character, if you need more than 1 character you should add '+'.
|
|
@@ -204,13 +214,19 @@ def match_pattern_against_string(pattern: str, check_string: str, prefix_suffix:
|
|
|
204
214
|
return False
|
|
205
215
|
|
|
206
216
|
|
|
207
|
-
def match_list_of_patterns_against_string(
|
|
217
|
+
def match_list_of_patterns_against_string(
|
|
218
|
+
patterns: list,
|
|
219
|
+
check_string: str,
|
|
220
|
+
case_insensitive: bool = False,
|
|
221
|
+
prefix_suffix: bool = False
|
|
222
|
+
) -> bool:
|
|
208
223
|
"""
|
|
209
224
|
Function checks each pattern in 'patterns' list against 'check_string' and returns 'True' if any pattern matches
|
|
210
225
|
and 'False' if not.
|
|
211
226
|
|
|
212
227
|
:param patterns: list, of string patterns to check against. May include wildcards.
|
|
213
228
|
:param check_string: string, to check the pattern against.
|
|
229
|
+
:param case_insensitive: boolean, if 'True' will treat the 'pattern' and 'check_string' as case-insensitive.
|
|
214
230
|
:param prefix_suffix: boolean, that sets if the function should return 'True' also for all the cases that wildcard
|
|
215
231
|
in the beginning of the pattern and in the end of the pattern, since the default behavior of regex to return
|
|
216
232
|
'False' on these cases.
|
|
@@ -221,7 +237,8 @@ def match_list_of_patterns_against_string(patterns: list, check_string: str, pre
|
|
|
221
237
|
"""
|
|
222
238
|
|
|
223
239
|
for pattern in patterns:
|
|
224
|
-
if match_pattern_against_string(
|
|
240
|
+
if match_pattern_against_string(
|
|
241
|
+
pattern, check_string, case_insensitive=case_insensitive, prefix_suffix=prefix_suffix):
|
|
225
242
|
return True
|
|
226
243
|
|
|
227
244
|
return False
|
|
@@ -20,7 +20,7 @@ def _execute_cycle(change_monitor_instance, print_kwargs: dict = None):
|
|
|
20
20
|
processes = _get_list(change_monitor_instance)
|
|
21
21
|
|
|
22
22
|
for process_name in change_monitor_instance.check_object_list:
|
|
23
|
-
result = list_of_dicts.is_value_exist_in_key(processes, 'cmdline', process_name)
|
|
23
|
+
result = list_of_dicts.is_value_exist_in_key(processes, 'cmdline', process_name, value_case_insensitive=True)
|
|
24
24
|
|
|
25
25
|
# If the process name was found in the list of currently running processes.
|
|
26
26
|
if result:
|
atomicshop/process.py
CHANGED
|
@@ -7,7 +7,7 @@ import shutil
|
|
|
7
7
|
|
|
8
8
|
from .print_api import print_api
|
|
9
9
|
from .inspect_wrapper import get_target_function_default_args_and_combine_with_current
|
|
10
|
-
from .basics
|
|
10
|
+
from .basics import strings
|
|
11
11
|
from .wrappers import ubuntu_terminal
|
|
12
12
|
|
|
13
13
|
if os.name == 'nt':
|
|
@@ -247,12 +247,18 @@ def safe_terminate(popen_process: subprocess.Popen):
|
|
|
247
247
|
popen_process.wait()
|
|
248
248
|
|
|
249
249
|
|
|
250
|
-
def match_pattern_against_running_processes_cmdlines(
|
|
250
|
+
def match_pattern_against_running_processes_cmdlines(
|
|
251
|
+
pattern: str,
|
|
252
|
+
process_name_case_insensitive: bool = False,
|
|
253
|
+
first: bool = False,
|
|
254
|
+
prefix_suffix: bool = False
|
|
255
|
+
):
|
|
251
256
|
"""
|
|
252
257
|
The function matches specified string pattern including wildcards against all the currently running processes'
|
|
253
258
|
command lines.
|
|
254
259
|
|
|
255
260
|
:param pattern: string, the pattern that we will search in the command line list of currently running processes.
|
|
261
|
+
:param process_name_case_insensitive: boolean, if True, the process name will be matched case insensitive.
|
|
256
262
|
:param first: boolean, that will set if first pattern match found the iteration will stop, or we will return
|
|
257
263
|
the list of all command lines that contain the pattern.
|
|
258
264
|
:param prefix_suffix: boolean. Check the description in 'match_pattern_against_string' function.
|
|
@@ -268,7 +274,9 @@ def match_pattern_against_running_processes_cmdlines(pattern: str, first: bool =
|
|
|
268
274
|
for process in processes:
|
|
269
275
|
# Check if command line isn't empty and that string pattern is matched against command line.
|
|
270
276
|
if process['cmdline'] and \
|
|
271
|
-
match_pattern_against_string(
|
|
277
|
+
strings.match_pattern_against_string(
|
|
278
|
+
pattern, process['cmdline'], case_insensitive=process_name_case_insensitive,
|
|
279
|
+
prefix_suffix=prefix_suffix):
|
|
272
280
|
matched_cmdlines.append(process['cmdline'])
|
|
273
281
|
# If 'first' was set to 'True' we will stop, since we found the first match.
|
|
274
282
|
if first:
|
atomicshop/web.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import urllib.request
|
|
3
|
+
import ssl
|
|
4
|
+
import certifi
|
|
3
5
|
|
|
4
6
|
from .print_api import print_api
|
|
5
7
|
from .archiver import zips
|
|
@@ -182,8 +184,9 @@ def download(file_url: str, target_directory: str = None, file_name: str = None,
|
|
|
182
184
|
print_api(f'To: {file_path}', **kwargs)
|
|
183
185
|
|
|
184
186
|
# In order to use 'urllib.request', it is not enough to 'import urllib', you need to 'import urllib.request'.
|
|
185
|
-
# Open the URL for data gathering
|
|
186
|
-
|
|
187
|
+
# Open the URL for data gathering with SSL context from certifi
|
|
188
|
+
ssl_context = ssl.create_default_context(cafile=certifi.where())
|
|
189
|
+
file_to_download = urllib.request.urlopen(file_url, context=ssl_context)
|
|
187
190
|
|
|
188
191
|
# Check status of url.
|
|
189
192
|
if not is_status_ok(status_code=file_to_download.status, **kwargs):
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
atomicshop/__init__.py,sha256
|
|
1
|
+
atomicshop/__init__.py,sha256=-vfpVbmmEp5MJjeiy8KXfc5AiYWei228hKs92EJDabk,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/keyboard_press.py,sha256=1W5kRtOB75fulVx-uF2yarBhW0_IzdI1k73AnvXstk0,
|
|
|
24
24
|
atomicshop/pbtkmultifile_argparse.py,sha256=aEk8nhvoQVu-xyfZosK3ma17CwIgOjzO1erXXdjwtS4,4574
|
|
25
25
|
atomicshop/permissions.py,sha256=P6tiUKV-Gw-c3ePEVsst9bqWaHJbB4ZlJB4xbDYVpEs,4436
|
|
26
26
|
atomicshop/print_api.py,sha256=DhbCQd0MWZZ5GYEk4oTu1opRFC-b31g1VWZgTGewG2Y,11568
|
|
27
|
-
atomicshop/process.py,sha256=
|
|
27
|
+
atomicshop/process.py,sha256=Zgb4CUjy9gIBaawvtCOEcxGUCqvqPyARk0lpBjRzxWE,15950
|
|
28
28
|
atomicshop/process_name_cmd.py,sha256=TNAK6kQZm5JKWzEW6QLqVHEG98ZLNDQiSS4YwDk8V8c,3830
|
|
29
29
|
atomicshop/process_poller.py,sha256=WfmwCLALfTYOq8ri0vkPeqq8ruEyA_43DaN--CU2_XY,10854
|
|
30
30
|
atomicshop/python_file_patcher.py,sha256=kd3rBWvTcosLEk-7TycNdfKW9fZbe161iVwmH4niUo0,5515
|
|
@@ -44,7 +44,7 @@ atomicshop/timer.py,sha256=KxBBgVM8po6pUJDW8TgY1UXj0iiDmRmL5XDCq0VHAfU,1670
|
|
|
44
44
|
atomicshop/urls.py,sha256=CQl1j1kjEVDlAuYJqYD9XxPF1SUSgrmG8PjlcXNEKsQ,597
|
|
45
45
|
atomicshop/uuids.py,sha256=JSQdm3ZTJiwPQ1gYe6kU0TKS_7suwVrHc8JZDGYlydM,2214
|
|
46
46
|
atomicshop/virtualization.py,sha256=LPP4vjE0Vr10R6DA4lqhfX_WaNdDGRAZUW0Am6VeGco,494
|
|
47
|
-
atomicshop/web.py,sha256=
|
|
47
|
+
atomicshop/web.py,sha256=yXZCPqkEgTcG0dk9kgxLQI0rALM608_d_fvxOU41gKw,11508
|
|
48
48
|
atomicshop/addons/PlayWrightCodegen.cmd,sha256=Z5cnllsyXD4F1W2h-WLEnyFkg5nZy0-hTGHRWXVOuW4,173
|
|
49
49
|
atomicshop/addons/ScriptExecution.cmd,sha256=8iC-uHs9MX9qUD_C2M7n9Xw4MZvwOfxT8H5v3hluVps,93
|
|
50
50
|
atomicshop/addons/a_setup_scripts/install_psycopg2_ubuntu.sh,sha256=lM7LkXQ2AxfFzDGyzSOfIS_zpg9bAD1k3JJ-qu5CdH8,81
|
|
@@ -91,12 +91,12 @@ atomicshop/basics/guids.py,sha256=iRx5n18ATZWhpo748BwEjuLWLsu9y3OwF5-Adp-Dtik,40
|
|
|
91
91
|
atomicshop/basics/hexs.py,sha256=i8CTG-J0TGGa25yFSbWEvpVyHFnof_qSWUrmXY-ylKM,1054
|
|
92
92
|
atomicshop/basics/if_else.py,sha256=MakivJChofZCpr0mOVjwCthzpiaBxXVB-zv7GwMOqVo,202
|
|
93
93
|
atomicshop/basics/isinstancing.py,sha256=fQ35xfqbguQz2BUn-3a4KVGskhTcIn8JjRtxV2rFcRQ,876
|
|
94
|
-
atomicshop/basics/list_of_dicts.py,sha256=
|
|
94
|
+
atomicshop/basics/list_of_dicts.py,sha256=qI2uoYIcHjR8RSD5vtkqhpMgL6XTYRGJDcr9cb2HbZM,6051
|
|
95
95
|
atomicshop/basics/lists.py,sha256=I0C62vrDrNwCTNl0EjUZNa1Jsd8l0rTkp28GEx9QoEI,4258
|
|
96
96
|
atomicshop/basics/multiprocesses.py,sha256=nSskxJSlEdalPM_Uf8cc9kAYYlVwYM1GonBLAhCL2mM,18831
|
|
97
97
|
atomicshop/basics/numbers.py,sha256=ESX0z_7o_ok3sOmCKAUBoZinATklgMy2v-4RndqXlVM,1837
|
|
98
98
|
atomicshop/basics/randoms.py,sha256=DmYLtnIhDK29tAQrGP1Nt-A-v8WC7WIEB8Edi-nk3N4,282
|
|
99
|
-
atomicshop/basics/strings.py,sha256=
|
|
99
|
+
atomicshop/basics/strings.py,sha256=T4MpEpwxqsiOSnXcwYkqMKB5okHiJfvUCO7t5kcRtBg,18316
|
|
100
100
|
atomicshop/basics/threads.py,sha256=xvgdDJdmgN0wmmARoZ-H7Kvl1GOcEbvgaeGL4M3Hcx8,2819
|
|
101
101
|
atomicshop/basics/timeit_template.py,sha256=fYLrk-X_dhdVtnPU22tarrhhvlggeW6FdKCXM8zkX68,405
|
|
102
102
|
atomicshop/basics/tracebacks.py,sha256=cNfh_oAwF55kSIdqtv3boHZQIoQI8TajxkTnwJwpweI,535
|
|
@@ -137,7 +137,7 @@ atomicshop/monitor/checks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
|
|
|
137
137
|
atomicshop/monitor/checks/dns.py,sha256=orp-TgqL6EPzXVm0MtjEceFE8LRfTP3iPR6hGc8Y3TQ,4499
|
|
138
138
|
atomicshop/monitor/checks/hash.py,sha256=A6bJ7F5Qv_brdEh3sGhOyfviab2dsnvbXUufyBk5C1U,1951
|
|
139
139
|
atomicshop/monitor/checks/network.py,sha256=I9f3KyNnlx97E8igGZXpVJl4MlUp9iU6aSbILCKqbA0,3820
|
|
140
|
-
atomicshop/monitor/checks/process_running.py,sha256=
|
|
140
|
+
atomicshop/monitor/checks/process_running.py,sha256=948Sify4P2KFTE1ZrLHKLwd1B1HOgWmC11x3b6MCvz0,1892
|
|
141
141
|
atomicshop/monitor/checks/hash_checks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
142
142
|
atomicshop/monitor/checks/hash_checks/file.py,sha256=UDHrUphYSKeH4KJR5pC3ilPAGxX0oXTu3UD8ndnR5WU,2733
|
|
143
143
|
atomicshop/monitor/checks/hash_checks/url.py,sha256=aNAL1bIeks6xsRDk-5arGy4rhzrJkJ4ZRCqCQTi4n3U,3237
|
|
@@ -251,8 +251,8 @@ atomicshop/wrappers/socketw/socket_server_tester.py,sha256=AhpurHJmP2kgzHaUbq5ey
|
|
|
251
251
|
atomicshop/wrappers/socketw/socket_wrapper.py,sha256=aXBwlEIJhFT0-c4i8iNlFx2It9VpCEpsv--5Oqcpxao,11624
|
|
252
252
|
atomicshop/wrappers/socketw/ssl_base.py,sha256=k4V3gwkbq10MvOH4btU4onLX2GNOsSfUAdcHmL1rpVE,2274
|
|
253
253
|
atomicshop/wrappers/socketw/statistics_csv.py,sha256=t3dtDEfN47CfYVi0CW6Kc2QHTEeZVyYhc57IYYh5nmA,826
|
|
254
|
-
atomicshop-2.12.
|
|
255
|
-
atomicshop-2.12.
|
|
256
|
-
atomicshop-2.12.
|
|
257
|
-
atomicshop-2.12.
|
|
258
|
-
atomicshop-2.12.
|
|
254
|
+
atomicshop-2.12.9.dist-info/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
|
|
255
|
+
atomicshop-2.12.9.dist-info/METADATA,sha256=p5kxZx91i1n0Os02yyC3ce6mvSZARM6G-jl2qFh8e_0,10478
|
|
256
|
+
atomicshop-2.12.9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
257
|
+
atomicshop-2.12.9.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
|
|
258
|
+
atomicshop-2.12.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|