atomicshop 3.3.3__py3-none-any.whl → 3.3.4__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/githubw.py +134 -35
- atomicshop/wrappers/socketw/sni.py +1 -1
- {atomicshop-3.3.3.dist-info → atomicshop-3.3.4.dist-info}/METADATA +1 -1
- {atomicshop-3.3.3.dist-info → atomicshop-3.3.4.dist-info}/RECORD +9 -9
- {atomicshop-3.3.3.dist-info → atomicshop-3.3.4.dist-info}/WHEEL +0 -0
- {atomicshop-3.3.3.dist-info → atomicshop-3.3.4.dist-info}/entry_points.txt +0 -0
- {atomicshop-3.3.3.dist-info → atomicshop-3.3.4.dist-info}/licenses/LICENSE.txt +0 -0
- {atomicshop-3.3.3.dist-info → atomicshop-3.3.4.dist-info}/top_level.txt +0 -0
atomicshop/__init__.py
CHANGED
atomicshop/wrappers/githubw.py
CHANGED
|
@@ -78,7 +78,7 @@ class GitHubWrapper:
|
|
|
78
78
|
Usage to download the latest release where the file name is 'test_file.zip':
|
|
79
79
|
git_wrapper = GitHubWrapper(user_name='user_name', repo_name='repo_name')
|
|
80
80
|
git_wrapper.download_and_extract_latest_release(
|
|
81
|
-
target_directory='target_directory',
|
|
81
|
+
target_directory='target_directory', asset_pattern='test_*.zip')
|
|
82
82
|
================================================================================================================
|
|
83
83
|
Usage to get the latest release json:
|
|
84
84
|
git_wrapper = GitHubWrapper(user_name='user_name', repo_name='repo_name')
|
|
@@ -116,6 +116,10 @@ class GitHubWrapper:
|
|
|
116
116
|
self.commits_url: str = str()
|
|
117
117
|
self.contents_url: str = str()
|
|
118
118
|
|
|
119
|
+
self.releases_url: str = str()
|
|
120
|
+
self.releases_per_page: int = 100
|
|
121
|
+
self.releases_starting_page: int = 1
|
|
122
|
+
|
|
119
123
|
if self.user_name and self.repo_name and not self.repo_url:
|
|
120
124
|
self.build_links_from_user_and_repo()
|
|
121
125
|
|
|
@@ -143,6 +147,7 @@ class GitHubWrapper:
|
|
|
143
147
|
self.api_url = f'https://api.{self.domain}/repos/{self.user_name}/{self.repo_name}'
|
|
144
148
|
|
|
145
149
|
self.latest_release_json_url: str = f'{self.api_url}/releases/latest'
|
|
150
|
+
self.releases_url: str = f'{self.api_url}/releases'
|
|
146
151
|
self.commits_url: str = f'{self.api_url}/commits'
|
|
147
152
|
self.contents_url: str = f'{self.api_url}/contents'
|
|
148
153
|
self.branch_download_link = f'{self.api_url}/{self.branch_type_directory}/{self.branch}'
|
|
@@ -272,21 +277,133 @@ class GitHubWrapper:
|
|
|
272
277
|
|
|
273
278
|
download_directory(self.path, current_target_directory, headers)
|
|
274
279
|
|
|
280
|
+
def get_releases_json(
|
|
281
|
+
self,
|
|
282
|
+
asset_pattern: str = None,
|
|
283
|
+
latest: bool = False,
|
|
284
|
+
per_page: int = None,
|
|
285
|
+
starting_page: int = None,
|
|
286
|
+
all_assets: bool = False,
|
|
287
|
+
):
|
|
288
|
+
"""
|
|
289
|
+
This function will get the releases json.
|
|
290
|
+
:param asset_pattern: str, the string pattern to search in the asset names of releases. Wildcards can be used.
|
|
291
|
+
If there is a match, the release will be added to the result list.
|
|
292
|
+
:param latest: bool, if True, will get only the latest release.
|
|
293
|
+
If 'asset_pattern' is provided, 'latest' will find the latest release matching the pattern.
|
|
294
|
+
Of course if you want to get it from all releases, you must set 'all_assets' to True.
|
|
295
|
+
:param per_page: int, the number of releases per page. Default is 100.
|
|
296
|
+
:param starting_page: int, the starting page number. Default is 1.
|
|
297
|
+
:param all_assets: bool, if True, will get all releases matching the pattern across all pages
|
|
298
|
+
OR all assets if no pattern is provided.
|
|
299
|
+
:return:
|
|
300
|
+
"""
|
|
301
|
+
|
|
302
|
+
# If 'latest' is True and no 'asset_pattern' is provided, we only need to get 1 release from page 1.
|
|
303
|
+
# No need to get more assets than the first one.
|
|
304
|
+
if latest and not asset_pattern:
|
|
305
|
+
per_page = 1
|
|
306
|
+
starting_page = 1
|
|
307
|
+
all_assets = False
|
|
308
|
+
# In all other cases, get the releases according to the provided parameters or defaults.
|
|
309
|
+
else:
|
|
310
|
+
if not per_page:
|
|
311
|
+
per_page = self.releases_per_page
|
|
312
|
+
|
|
313
|
+
if not starting_page:
|
|
314
|
+
starting_page = self.releases_starting_page
|
|
315
|
+
|
|
316
|
+
headers: dict = self._get_headers()
|
|
317
|
+
|
|
318
|
+
params: dict = {
|
|
319
|
+
'per_page': per_page,
|
|
320
|
+
'page': starting_page
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
all_releases = []
|
|
324
|
+
while True:
|
|
325
|
+
response = requests.get(self.releases_url, headers=headers, params=params)
|
|
326
|
+
releases = response.json()
|
|
327
|
+
# If no releases found on current page, there will be none on the next as well, break the loop.
|
|
328
|
+
if not releases:
|
|
329
|
+
break
|
|
330
|
+
|
|
331
|
+
# If 'asset_pattern' is provided, filter releases to only those that have matching assets.
|
|
332
|
+
if asset_pattern:
|
|
333
|
+
for release in releases:
|
|
334
|
+
assets = release.get('assets', [])
|
|
335
|
+
matching_assets = [asset for asset in assets if fnmatch.fnmatch(asset.get('name', ''), asset_pattern)]
|
|
336
|
+
if matching_assets:
|
|
337
|
+
all_releases.append(release)
|
|
338
|
+
|
|
339
|
+
if latest:
|
|
340
|
+
return all_releases
|
|
341
|
+
else:
|
|
342
|
+
all_releases.extend(releases)
|
|
343
|
+
|
|
344
|
+
if not all_assets:
|
|
345
|
+
break
|
|
346
|
+
|
|
347
|
+
params['page'] += 1
|
|
348
|
+
|
|
349
|
+
return all_releases
|
|
350
|
+
|
|
351
|
+
def get_latest_release_json(
|
|
352
|
+
self,
|
|
353
|
+
asset_pattern: str = None
|
|
354
|
+
) -> dict:
|
|
355
|
+
"""
|
|
356
|
+
This function will get the latest releases json.
|
|
357
|
+
:param asset_pattern: str, the string pattern to search in the asset names of releases. Wildcards can be used.
|
|
358
|
+
If there is a match, the release will be added to the result list.
|
|
359
|
+
:return: dict, the latest release json.
|
|
360
|
+
"""
|
|
361
|
+
|
|
362
|
+
if asset_pattern:
|
|
363
|
+
releases = self.get_releases_json(
|
|
364
|
+
asset_pattern=asset_pattern,
|
|
365
|
+
latest=True,
|
|
366
|
+
all_assets=True
|
|
367
|
+
)
|
|
368
|
+
else:
|
|
369
|
+
releases = self.get_releases_json(latest=True)
|
|
370
|
+
|
|
371
|
+
if not releases:
|
|
372
|
+
return {}
|
|
373
|
+
else:
|
|
374
|
+
return releases[0]
|
|
375
|
+
|
|
376
|
+
def get_latest_release_version(
|
|
377
|
+
self,
|
|
378
|
+
asset_pattern: str = None
|
|
379
|
+
) -> str:
|
|
380
|
+
"""
|
|
381
|
+
This function will get the latest release version number.
|
|
382
|
+
|
|
383
|
+
:param asset_pattern: str, the string pattern to search in the asset names of releases. Wildcards can be used.
|
|
384
|
+
If there is a match, the release will be added to the result list.
|
|
385
|
+
:return: str, the latest release version number.
|
|
386
|
+
"""
|
|
387
|
+
|
|
388
|
+
latest_release_json: dict = self.get_latest_release_json(asset_pattern=asset_pattern)
|
|
389
|
+
latest_release_version: str = latest_release_json['tag_name']
|
|
390
|
+
return latest_release_version
|
|
391
|
+
|
|
275
392
|
def get_latest_release_url(
|
|
276
393
|
self,
|
|
277
|
-
|
|
278
|
-
|
|
394
|
+
asset_pattern: str,
|
|
395
|
+
exclude_pattern: str = None,
|
|
279
396
|
**kwargs):
|
|
280
397
|
"""
|
|
281
398
|
This function will return the latest release url.
|
|
282
|
-
:param
|
|
283
|
-
:param
|
|
399
|
+
:param asset_pattern: str, the string pattern to search in the latest release. Wildcards can be used.
|
|
400
|
+
:param exclude_pattern: str, the string to exclude from the search. No wildcards can be used.
|
|
284
401
|
:param kwargs: dict, the print arguments for the 'print_api' function.
|
|
285
402
|
:return: str, the latest release url.
|
|
286
403
|
"""
|
|
287
404
|
|
|
288
405
|
# Get the 'assets' key of the latest release json.
|
|
289
|
-
github_latest_releases_list = self.
|
|
406
|
+
github_latest_releases_list = self.get_latest_release_json()['assets']
|
|
290
407
|
|
|
291
408
|
# Get only download urls of the latest releases.
|
|
292
409
|
download_urls: list = list()
|
|
@@ -294,13 +411,13 @@ class GitHubWrapper:
|
|
|
294
411
|
download_urls.append(single_dict['browser_download_url'])
|
|
295
412
|
|
|
296
413
|
# Exclude urls against 'exclude_string'.
|
|
297
|
-
if
|
|
414
|
+
if exclude_pattern:
|
|
298
415
|
for download_url in download_urls:
|
|
299
|
-
if
|
|
416
|
+
if exclude_pattern in download_url:
|
|
300
417
|
download_urls.remove(download_url)
|
|
301
418
|
|
|
302
|
-
# Find urls against '
|
|
303
|
-
found_urls: list = fnmatch.filter(download_urls,
|
|
419
|
+
# Find urls against 'asset_pattern'.
|
|
420
|
+
found_urls: list = fnmatch.filter(download_urls, asset_pattern)
|
|
304
421
|
|
|
305
422
|
# If more than 1 url answer the criteria, we can't download it. The user must be more specific in his input
|
|
306
423
|
# strings.
|
|
@@ -317,15 +434,15 @@ class GitHubWrapper:
|
|
|
317
434
|
def download_latest_release(
|
|
318
435
|
self,
|
|
319
436
|
target_directory: str,
|
|
320
|
-
|
|
437
|
+
asset_pattern: str,
|
|
321
438
|
exclude_string: str = None,
|
|
322
439
|
**kwargs):
|
|
323
440
|
"""
|
|
324
441
|
This function will download the latest release from the GitHub repository.
|
|
325
442
|
:param target_directory: str, the target directory to download the file.
|
|
326
|
-
:param
|
|
443
|
+
:param asset_pattern: str, the string pattern to search in the latest release. Wildcards can be used.
|
|
327
444
|
:param exclude_string: str, the string to exclude from the search. No wildcards can be used.
|
|
328
|
-
The 'excluded_string' will be filtered before the '
|
|
445
|
+
The 'excluded_string' will be filtered before the 'asset_pattern' entries.
|
|
329
446
|
:param kwargs: dict, the print arguments for the 'print_api' function.
|
|
330
447
|
:return:
|
|
331
448
|
"""
|
|
@@ -333,7 +450,7 @@ class GitHubWrapper:
|
|
|
333
450
|
headers: dict = self._get_headers()
|
|
334
451
|
|
|
335
452
|
# Get the latest release url.
|
|
336
|
-
found_url = self.get_latest_release_url(
|
|
453
|
+
found_url = self.get_latest_release_url(asset_pattern=asset_pattern, exclude_string=exclude_string, **kwargs)
|
|
337
454
|
|
|
338
455
|
downloaded_file_path = web.download(
|
|
339
456
|
file_url=found_url, target_directory=target_directory, headers=headers, **kwargs)
|
|
@@ -342,7 +459,7 @@ class GitHubWrapper:
|
|
|
342
459
|
def download_and_extract_latest_release(
|
|
343
460
|
self,
|
|
344
461
|
target_directory: str,
|
|
345
|
-
|
|
462
|
+
asset_pattern: str,
|
|
346
463
|
exclude_string: str = None,
|
|
347
464
|
archive_remove_first_directory: bool = False,
|
|
348
465
|
**kwargs):
|
|
@@ -350,7 +467,7 @@ class GitHubWrapper:
|
|
|
350
467
|
This function will download the latest release from the GitHub repository, extract the file and remove the file,
|
|
351
468
|
leaving only the extracted folder.
|
|
352
469
|
:param target_directory: str, the target directory to download and extract the file.
|
|
353
|
-
:param
|
|
470
|
+
:param asset_pattern: str, the string pattern to search in the latest release. Wildcards can be used.
|
|
354
471
|
:param exclude_string: str, the string to exclude from the search. No wildcards can be used.
|
|
355
472
|
:param archive_remove_first_directory: bool, sets if archive extract function will extract the archive
|
|
356
473
|
without first directory in the archive. Check reference in the
|
|
@@ -362,7 +479,7 @@ class GitHubWrapper:
|
|
|
362
479
|
headers: dict = self._get_headers()
|
|
363
480
|
|
|
364
481
|
# Get the latest release url.
|
|
365
|
-
found_url = self.get_latest_release_url(
|
|
482
|
+
found_url = self.get_latest_release_url(asset_pattern=asset_pattern, exclude_string=exclude_string, **kwargs)
|
|
366
483
|
|
|
367
484
|
web.download_and_extract_file(
|
|
368
485
|
file_url=found_url,
|
|
@@ -371,24 +488,6 @@ class GitHubWrapper:
|
|
|
371
488
|
headers=headers,
|
|
372
489
|
**kwargs)
|
|
373
490
|
|
|
374
|
-
def get_the_latest_release_json(self):
|
|
375
|
-
"""
|
|
376
|
-
This function will get the latest releases json.
|
|
377
|
-
:return:
|
|
378
|
-
"""
|
|
379
|
-
|
|
380
|
-
headers: dict = self._get_headers()
|
|
381
|
-
|
|
382
|
-
response = requests.get(self.latest_release_json_url, headers=headers)
|
|
383
|
-
return response.json()
|
|
384
|
-
|
|
385
|
-
def get_the_latest_release_version_number(self):
|
|
386
|
-
"""
|
|
387
|
-
This function will get the latest release version number.
|
|
388
|
-
:return:
|
|
389
|
-
"""
|
|
390
|
-
return self.get_the_latest_release_json()['tag_name']
|
|
391
|
-
|
|
392
491
|
def get_latest_commit(self) -> dict:
|
|
393
492
|
"""
|
|
394
493
|
This function retrieves the latest commit on the specified branch.
|
|
@@ -274,7 +274,7 @@ class SNIHandler:
|
|
|
274
274
|
|
|
275
275
|
# Setting "server_hostname" as a domain.
|
|
276
276
|
self.sni_received_parameters.ssl_socket.server_hostname = self.sni_received_parameters.destination_name
|
|
277
|
-
print_api("SNI Passed: True",
|
|
277
|
+
print_api("SNI Passed: True", **(print_kwargs or {}))
|
|
278
278
|
message = (
|
|
279
279
|
f"SNI Handler: port {self.sni_received_parameters.ssl_socket.getsockname()[1]}: "
|
|
280
280
|
f"Incoming connection for [{self.sni_received_parameters.ssl_socket.server_hostname}]")
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
atomicshop/__init__.py,sha256
|
|
1
|
+
atomicshop/__init__.py,sha256=-H5JgHG0iCCH8pC2RNRvzeaxBh2DD3LjRloFS8OdaVQ,122
|
|
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
|
|
@@ -197,7 +197,7 @@ atomicshop/wrappers/astw.py,sha256=VkYfkfyc_PJLIOxByT6L7B8uUmKY6-I8XGZl4t_z828,4
|
|
|
197
197
|
atomicshop/wrappers/configparserw.py,sha256=JwDTPjZoSrv44YKwIRcjyUnpN-FjgXVfMqMK_tJuSgU,22800
|
|
198
198
|
atomicshop/wrappers/cryptographyw.py,sha256=QEUpDn8vUvMg3ADz6-4oC2kbDNC_woDlw7C0zU7qFVM,14233
|
|
199
199
|
atomicshop/wrappers/ffmpegw.py,sha256=wcq0ZnAe0yajBOuTKZCCaKI7CDBjkq7FAgdW5IsKcVE,6031
|
|
200
|
-
atomicshop/wrappers/githubw.py,sha256=
|
|
200
|
+
atomicshop/wrappers/githubw.py,sha256=bds_8fgyFyHXKwty6-SBS3H3Ueta2IMM5UQFpiFmgHQ,27554
|
|
201
201
|
atomicshop/wrappers/msiw.py,sha256=GQLqud72nfex3kvO1bJSruNriCYTYX1_G1gSf1MPkIA,6118
|
|
202
202
|
atomicshop/wrappers/netshw.py,sha256=8WE_576XiiHykwFuE-VkCx5CydMpFlztX4frlEteCtI,6350
|
|
203
203
|
atomicshop/wrappers/numpyw.py,sha256=sBV4gSKyr23kXTalqAb1oqttzE_2XxBooCui66jbAqc,1025
|
|
@@ -328,7 +328,7 @@ atomicshop/wrappers/socketw/exception_wrapper.py,sha256=qW_1CKyPgGlsIt7_jusKkMV4
|
|
|
328
328
|
atomicshop/wrappers/socketw/get_process.py,sha256=aJC-_qFUv3NgWCSUzDI72E4z8_-VTZE9NVZ0CwUoNlM,5698
|
|
329
329
|
atomicshop/wrappers/socketw/receiver.py,sha256=9B3MvcDqr4C3x2fsnjG5SQognd1wRqsBgikxZa0wXG8,8243
|
|
330
330
|
atomicshop/wrappers/socketw/sender.py,sha256=aX_K8l_rHjd5AWb8bi5mt8-YTkMYVRDB6DnPqK_XDUE,4754
|
|
331
|
-
atomicshop/wrappers/socketw/sni.py,sha256=
|
|
331
|
+
atomicshop/wrappers/socketw/sni.py,sha256=YlKavbExcPFfHFLYAJ3i3W6QorY7o4mbQp39g-DnDKA,17911
|
|
332
332
|
atomicshop/wrappers/socketw/socket_client.py,sha256=McBd3DeCy787oDGCEMUEP2awWy3vdkPqr9w-aFh2fBM,22502
|
|
333
333
|
atomicshop/wrappers/socketw/socket_server_tester.py,sha256=Qobmh4XV8ZxLUaw-eW4ESKAbeSLecCKn2OWFzMhadk0,6420
|
|
334
334
|
atomicshop/wrappers/socketw/socket_wrapper.py,sha256=u_v0pjMMrgsdtI0iPPddiLe2wXnBoqTgNM9Y3zjGD4U,41013
|
|
@@ -337,9 +337,9 @@ atomicshop/wrappers/socketw/statistics_csv.py,sha256=_gA8bMX6Sw_UCXKi2y9wNAwlqif
|
|
|
337
337
|
atomicshop/wrappers/winregw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
338
338
|
atomicshop/wrappers/winregw/winreg_installed_software.py,sha256=Qzmyktvob1qp6Tjk2DjLfAqr_yXV0sgWzdMW_9kwNjY,2345
|
|
339
339
|
atomicshop/wrappers/winregw/winreg_network.py,sha256=ih0BVNwByLvf9F_Lac4EdmDYYJA3PzMvmG0PieDZrsE,9905
|
|
340
|
-
atomicshop-3.3.
|
|
341
|
-
atomicshop-3.3.
|
|
342
|
-
atomicshop-3.3.
|
|
343
|
-
atomicshop-3.3.
|
|
344
|
-
atomicshop-3.3.
|
|
345
|
-
atomicshop-3.3.
|
|
340
|
+
atomicshop-3.3.4.dist-info/licenses/LICENSE.txt,sha256=lLU7EYycfYcK2NR_1gfnhnRC8b8ccOTElACYplgZN88,1094
|
|
341
|
+
atomicshop-3.3.4.dist-info/METADATA,sha256=AA-i4jzN5U9DaSNf-Hv_TuHfoMUeOR9-53KcyzR2xik,9288
|
|
342
|
+
atomicshop-3.3.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
343
|
+
atomicshop-3.3.4.dist-info/entry_points.txt,sha256=SJEgEP0KoFtfxuGwe5tOzKfXkjR9Dv6YYug33KNYxyY,69
|
|
344
|
+
atomicshop-3.3.4.dist-info/top_level.txt,sha256=EgKJB-7xcrAPeqTRF2laD_Np2gNGYkJkd4OyXqpJphA,11
|
|
345
|
+
atomicshop-3.3.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|