atomicshop 3.3.22__py3-none-any.whl → 3.3.24__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/web.py +27 -3
- atomicshop/wrappers/githubw.py +1 -1
- atomicshop/wrappers/socketw/socket_wrapper.py +19 -1
- {atomicshop-3.3.22.dist-info → atomicshop-3.3.24.dist-info}/METADATA +2 -2
- {atomicshop-3.3.22.dist-info → atomicshop-3.3.24.dist-info}/RECORD +9 -9
- {atomicshop-3.3.22.dist-info → atomicshop-3.3.24.dist-info}/WHEEL +0 -0
- {atomicshop-3.3.22.dist-info → atomicshop-3.3.24.dist-info}/licenses/LICENSE.txt +0 -0
- {atomicshop-3.3.22.dist-info → atomicshop-3.3.24.dist-info}/top_level.txt +0 -0
atomicshop/__init__.py
CHANGED
atomicshop/web.py
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import urllib.request
|
|
3
|
+
import urllib.error
|
|
3
4
|
import ssl
|
|
4
5
|
from typing import Any
|
|
6
|
+
import http.client
|
|
7
|
+
|
|
5
8
|
# noinspection PyPackageRequirements
|
|
6
9
|
import certifi
|
|
7
10
|
|
|
8
|
-
|
|
9
11
|
from .archiver import zips
|
|
10
12
|
from .urls import url_parser
|
|
11
13
|
from .file_io import file_io
|
|
@@ -211,12 +213,34 @@ def download(
|
|
|
211
213
|
# Create a default SSL context using the certifi CA store.
|
|
212
214
|
# This is useful for environments where the system's CA store is not available or not trusted.
|
|
213
215
|
# 'certifi.where()' returns the path to the certifi CA bundle.
|
|
214
|
-
ssl_context = ssl.create_default_context(cafile=certifi.where())
|
|
216
|
+
ssl_context: ssl.SSLContext = ssl.create_default_context(cafile=certifi.where())
|
|
215
217
|
|
|
216
218
|
# In order to use 'urllib.request', it is not enough to 'import urllib', you need to 'import urllib.request'.
|
|
217
219
|
# Build a Request object with headers if provided.
|
|
218
220
|
req = urllib.request.Request(file_url, headers=headers or {})
|
|
219
|
-
|
|
221
|
+
|
|
222
|
+
def do_urlopen(ssl_context_internal: ssl.SSLContext) -> http.client.HTTPResponse | None:
|
|
223
|
+
try:
|
|
224
|
+
response: http.client.HTTPResponse = urllib.request.urlopen(req, context=ssl_context_internal)
|
|
225
|
+
return response
|
|
226
|
+
except urllib.error.URLError as e:
|
|
227
|
+
if getattr(e, 'reason', None) and isinstance(e.reason, ssl.SSLCertVerificationError):
|
|
228
|
+
if getattr(e.reason, 'reason', None) and e.reason.reason == 'CERTIFICATE_VERIFY_FAILED':
|
|
229
|
+
if getattr(e.reason, 'verify_message', None) and e.reason.verify_message == 'unable to get local issuer certificate':
|
|
230
|
+
return None
|
|
231
|
+
|
|
232
|
+
raise e
|
|
233
|
+
|
|
234
|
+
# Try to open the URL with the created SSL context with certifi.
|
|
235
|
+
file_to_download = do_urlopen(ssl_context_internal=ssl_context)
|
|
236
|
+
if not file_to_download:
|
|
237
|
+
# If failed, try to open the URL with the system's default SSL context.
|
|
238
|
+
ssl_context = ssl.create_default_context()
|
|
239
|
+
file_to_download = do_urlopen(ssl_context_internal=ssl_context)
|
|
240
|
+
if not file_to_download:
|
|
241
|
+
print_api.print_api(
|
|
242
|
+
'ERROR: URL open failed with both certifi and system\'s default SSL context.', error_type=True, **kwargs)
|
|
243
|
+
return None
|
|
220
244
|
|
|
221
245
|
# Check status of url.
|
|
222
246
|
if not is_status_ok(status_code=file_to_download.status, **kwargs):
|
atomicshop/wrappers/githubw.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import multiprocessing
|
|
2
2
|
import threading
|
|
3
|
+
import time
|
|
4
|
+
|
|
3
5
|
import select
|
|
4
6
|
from typing import Literal, Union, Callable, Any
|
|
5
7
|
from pathlib import Path
|
|
@@ -568,7 +570,22 @@ class SocketWrapper:
|
|
|
568
570
|
if client_socket:
|
|
569
571
|
# Get the protocol type from the socket.
|
|
570
572
|
is_tls: bool = False
|
|
571
|
-
|
|
573
|
+
|
|
574
|
+
time.sleep(1) # Wait a second to gather some data.
|
|
575
|
+
try:
|
|
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
|
|
588
|
+
|
|
572
589
|
if tls_properties:
|
|
573
590
|
is_tls = True
|
|
574
591
|
tls_type, tls_version = tls_properties
|
|
@@ -682,6 +699,7 @@ class SocketWrapper:
|
|
|
682
699
|
host=domain_from_engine,
|
|
683
700
|
process_name=process_name)
|
|
684
701
|
except Exception as e:
|
|
702
|
+
|
|
685
703
|
self.exceptions_logger.write(e)
|
|
686
704
|
|
|
687
705
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: atomicshop
|
|
3
|
-
Version: 3.3.
|
|
3
|
+
Version: 3.3.24
|
|
4
4
|
Summary: Atomic functions and classes to make developer life easier
|
|
5
5
|
Author: Denis Kras
|
|
6
6
|
License-Expression: MIT
|
|
@@ -8,7 +8,7 @@ Project-URL: Homepage, https://github.com/BugSec-Official/atomicshop
|
|
|
8
8
|
Classifier: Intended Audience :: Developers
|
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
|
10
10
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
11
|
-
Requires-Python:
|
|
11
|
+
Requires-Python: <3.13,>=3.10
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE.txt
|
|
14
14
|
Requires-Dist: wheel
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
atomicshop/__init__.py,sha256=
|
|
1
|
+
atomicshop/__init__.py,sha256=BNlDCkYh5Y719V4A5KzdBQCz8nL2MOid4wXu4pqzNw8,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
|
|
@@ -48,7 +48,7 @@ atomicshop/uuids.py,sha256=JSQdm3ZTJiwPQ1gYe6kU0TKS_7suwVrHc8JZDGYlydM,2214
|
|
|
48
48
|
atomicshop/venvs.py,sha256=D9lwOoObkYoRx-weuoAmbvN-RdSHhVm4DE9TVl-utAs,903
|
|
49
49
|
atomicshop/versioning.py,sha256=e5W6m9AF3__M5nntqI9CqNAeHqkwY9JhlnpYeZ1CEus,970
|
|
50
50
|
atomicshop/virtualization.py,sha256=LPP4vjE0Vr10R6DA4lqhfX_WaNdDGRAZUW0Am6VeGco,494
|
|
51
|
-
atomicshop/web.py,sha256=
|
|
51
|
+
atomicshop/web.py,sha256=mHWrHb-zl0NRg7oHBZr-0k66aTBmKLvanBzoCZ63Xks,14340
|
|
52
52
|
atomicshop/websocket_parse.py,sha256=aLHWyKqaYqEn_MRBWm2L6rIl6QPmqbVrjEXE_rBzwCw,16711
|
|
53
53
|
atomicshop/a_installs/ubuntu/docker_rootless.py,sha256=9IPNtGZYjfy1_n6ZRt7gWz9KZgR6XCgevjqq02xk-o0,281
|
|
54
54
|
atomicshop/a_installs/ubuntu/docker_sudo.py,sha256=JzayxeyKDtiuT4Icp2L2LyFRbx4wvpyN_bHLfZ-yX5E,281
|
|
@@ -187,7 +187,7 @@ atomicshop/wrappers/astw.py,sha256=VkYfkfyc_PJLIOxByT6L7B8uUmKY6-I8XGZl4t_z828,4
|
|
|
187
187
|
atomicshop/wrappers/configparserw.py,sha256=JwDTPjZoSrv44YKwIRcjyUnpN-FjgXVfMqMK_tJuSgU,22800
|
|
188
188
|
atomicshop/wrappers/cryptographyw.py,sha256=QEUpDn8vUvMg3ADz6-4oC2kbDNC_woDlw7C0zU7qFVM,14233
|
|
189
189
|
atomicshop/wrappers/ffmpegw.py,sha256=wcq0ZnAe0yajBOuTKZCCaKI7CDBjkq7FAgdW5IsKcVE,6031
|
|
190
|
-
atomicshop/wrappers/githubw.py,sha256=
|
|
190
|
+
atomicshop/wrappers/githubw.py,sha256=BEEJuWd1eBfiv1FSgb76D4nEBRpFU9j37lztn-KbYa4,27548
|
|
191
191
|
atomicshop/wrappers/netshw.py,sha256=8WE_576XiiHykwFuE-VkCx5CydMpFlztX4frlEteCtI,6350
|
|
192
192
|
atomicshop/wrappers/numpyw.py,sha256=sBV4gSKyr23kXTalqAb1oqttzE_2XxBooCui66jbAqc,1025
|
|
193
193
|
atomicshop/wrappers/olefilew.py,sha256=biD5m58rogifCYmYhJBrAFb9O_Bn_spLek_9HofLeYE,2051
|
|
@@ -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=YZG15mhldOKeTqGOJ0J5YUrT6ZjDczk3zkmz-qNyRL8,42277
|
|
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.24.dist-info/licenses/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
|
|
318
|
+
atomicshop-3.3.24.dist-info/METADATA,sha256=fb1OsnGbWGATd0fNLjhFrbzs_N-FLryohFjpdsl27QU,9318
|
|
319
|
+
atomicshop-3.3.24.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
320
|
+
atomicshop-3.3.24.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
|
|
321
|
+
atomicshop-3.3.24.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|