insightconnect-plugin-runtime 6.2.0__py3-none-any.whl → 6.2.1__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.
- insightconnect_plugin_runtime/helper.py +17 -15
- {insightconnect_plugin_runtime-6.2.0.dist-info → insightconnect_plugin_runtime-6.2.1.dist-info}/METADATA +3 -2
- {insightconnect_plugin_runtime-6.2.0.dist-info → insightconnect_plugin_runtime-6.2.1.dist-info}/RECORD +5 -5
- {insightconnect_plugin_runtime-6.2.0.dist-info → insightconnect_plugin_runtime-6.2.1.dist-info}/WHEEL +1 -1
- {insightconnect_plugin_runtime-6.2.0.dist-info → insightconnect_plugin_runtime-6.2.1.dist-info}/top_level.txt +0 -0
|
@@ -30,6 +30,8 @@ ENCODE_TYPE = "utf-8"
|
|
|
30
30
|
|
|
31
31
|
DEFAULTS_HOURS_AGO = 24
|
|
32
32
|
|
|
33
|
+
logger = logging.getLogger()
|
|
34
|
+
|
|
33
35
|
|
|
34
36
|
def hash_sha1(log: Dict) -> str:
|
|
35
37
|
"""
|
|
@@ -65,7 +67,7 @@ def compare_and_dedupe_hashes(
|
|
|
65
67
|
if hash_ not in previous_logs_hashes:
|
|
66
68
|
new_logs_hashes.append(hash_)
|
|
67
69
|
logs_to_return.append(log)
|
|
68
|
-
|
|
70
|
+
logger.info(
|
|
69
71
|
f"Original number of logs:{len(new_logs)}. Number of logs after de-duplication:{len(logs_to_return)}"
|
|
70
72
|
)
|
|
71
73
|
return logs_to_return, new_logs_hashes
|
|
@@ -246,7 +248,7 @@ def response_handler(
|
|
|
246
248
|
}
|
|
247
249
|
status_code_preset = status_code_presets.get(status_code)
|
|
248
250
|
exception = PluginException(preset=PluginException.Preset.UNKNOWN, data=data)
|
|
249
|
-
|
|
251
|
+
logger.info(f"Request to {response.url} failed. Status code: {status_code}")
|
|
250
252
|
if status_code in custom_configs.keys():
|
|
251
253
|
exception = custom_configs.get(status_code)
|
|
252
254
|
if hasattr(exception, "data") and data is not None:
|
|
@@ -561,7 +563,7 @@ def rate_limiting(
|
|
|
561
563
|
error.cause
|
|
562
564
|
== PluginException.causes[PluginException.Preset.RATE_LIMIT]
|
|
563
565
|
):
|
|
564
|
-
|
|
566
|
+
logger.info(
|
|
565
567
|
f"Rate limiting error occurred. Retrying in {delay:.1f} seconds ({attempts_counter}/{max_tries})"
|
|
566
568
|
)
|
|
567
569
|
retry = True
|
|
@@ -603,12 +605,12 @@ def check_hashes(src, checksum):
|
|
|
603
605
|
if type(src) is str:
|
|
604
606
|
hashes = get_hashes_string(src)
|
|
605
607
|
else:
|
|
606
|
-
|
|
608
|
+
logger.error("CheckHashes: Argument must be a string")
|
|
607
609
|
raise Exception("CheckHashes")
|
|
608
610
|
for alg in hashes:
|
|
609
611
|
if hashes[alg] == checksum:
|
|
610
612
|
return True
|
|
611
|
-
|
|
613
|
+
logger.info("CheckHashes: No checksum match")
|
|
612
614
|
return False
|
|
613
615
|
|
|
614
616
|
|
|
@@ -620,9 +622,9 @@ def check_cachefile(cache_file):
|
|
|
620
622
|
cache_file = cache_dir + "/" + cache_file
|
|
621
623
|
if os.path.isdir(cache_dir):
|
|
622
624
|
if os.path.isfile(cache_file):
|
|
623
|
-
|
|
625
|
+
logger.info("CheckCacheFile: File %s exists", cache_file)
|
|
624
626
|
return True
|
|
625
|
-
|
|
627
|
+
logger.info("CheckCacheFile: File %s did not exist", cache_file)
|
|
626
628
|
return False
|
|
627
629
|
|
|
628
630
|
|
|
@@ -638,9 +640,9 @@ def open_file(file_path):
|
|
|
638
640
|
return f
|
|
639
641
|
return None
|
|
640
642
|
else:
|
|
641
|
-
|
|
643
|
+
logger.info("OpenFile: File %s is not a file or does not exist ", filename)
|
|
642
644
|
else:
|
|
643
|
-
|
|
645
|
+
logger.error(
|
|
644
646
|
"OpenFile: Directory %s is not a directory or does not exist", dirname
|
|
645
647
|
)
|
|
646
648
|
|
|
@@ -654,13 +656,13 @@ def open_cachefile(cache_file, append=False):
|
|
|
654
656
|
if os.path.isdir(cache_dir):
|
|
655
657
|
if os.path.isfile(cache_file):
|
|
656
658
|
f = open(cache_file, "a+" if append else "r+")
|
|
657
|
-
|
|
659
|
+
logger.info("OpenCacheFile: %s exists, returning it", cache_file)
|
|
658
660
|
else:
|
|
659
661
|
if not os.path.isdir(os.path.dirname(cache_file)):
|
|
660
662
|
os.makedirs(os.path.dirname(cache_file))
|
|
661
663
|
f = open(cache_file, "w+") # Open once to create the cache file
|
|
662
664
|
f.close()
|
|
663
|
-
|
|
665
|
+
logger.info("OpenCacheFile: %s created", cache_file)
|
|
664
666
|
f = open(cache_file, "a+" if append else "r+")
|
|
665
667
|
return f
|
|
666
668
|
logging.error("OpenCacheFile: %s directory or does not exist", cache_dir)
|
|
@@ -676,7 +678,7 @@ def remove_cachefile(cache_file):
|
|
|
676
678
|
if os.path.isfile(cache_file):
|
|
677
679
|
os.remove(cache_file)
|
|
678
680
|
return True
|
|
679
|
-
|
|
681
|
+
logger.info("RemoveCacheFile: Cache file %s did not exist", cache_file)
|
|
680
682
|
return False
|
|
681
683
|
|
|
682
684
|
|
|
@@ -695,9 +697,9 @@ def lock_cache(lock_file):
|
|
|
695
697
|
os.makedirs(os.path.dirname(lock_file))
|
|
696
698
|
f = open(lock_file, "w")
|
|
697
699
|
f.close()
|
|
698
|
-
|
|
700
|
+
logger.info("Cache lock %s created", lock_file)
|
|
699
701
|
return True
|
|
700
|
-
|
|
702
|
+
logger.info("Cache lock %s failed, lock not created", lock_file)
|
|
701
703
|
return False
|
|
702
704
|
|
|
703
705
|
|
|
@@ -716,7 +718,7 @@ def unlock_cache(lock_file, wait_time):
|
|
|
716
718
|
time.sleep(wait_time)
|
|
717
719
|
os.remove(lock_file)
|
|
718
720
|
return True
|
|
719
|
-
|
|
721
|
+
logger.info("Cache unlock %s failed, lock not released", lock_file)
|
|
720
722
|
return False
|
|
721
723
|
|
|
722
724
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: insightconnect-plugin-runtime
|
|
3
|
-
Version: 6.2.
|
|
3
|
+
Version: 6.2.1
|
|
4
4
|
Summary: InsightConnect Plugin Runtime
|
|
5
5
|
Home-page: https://github.com/rapid7/komand-plugin-sdk-python
|
|
6
6
|
Author: Rapid7 Integrations Alliance
|
|
@@ -13,7 +13,7 @@ Classifier: Natural Language :: English
|
|
|
13
13
|
Classifier: Topic :: Software Development :: Build Tools
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
15
|
Requires-Dist: requests==2.32.2
|
|
16
|
-
Requires-Dist:
|
|
16
|
+
Requires-Dist: python_jsonschema_objects==0.5.2
|
|
17
17
|
Requires-Dist: jsonschema==4.21.1
|
|
18
18
|
Requires-Dist: certifi==2024.07.04
|
|
19
19
|
Requires-Dist: Flask==3.0.2
|
|
@@ -211,6 +211,7 @@ contributed. Black is installed as a test dependency and the hook can be initial
|
|
|
211
211
|
after cloning this repository.
|
|
212
212
|
|
|
213
213
|
## Changelog
|
|
214
|
+
* 6.2.1 - Fix instances where logging would lead to duplicate entries being output
|
|
214
215
|
* 6.2.0 - Update base images to pull Python 3.11.10 | changed the pep-8 check in tox to `pycodestyle`
|
|
215
216
|
* 6.1.4 - Address vulnerabilities within local development requirements.txt and vulnerabilities in slim image.
|
|
216
217
|
* 6.1.3 - Addressing failing Python Slim package (bump packages).
|
|
@@ -4,7 +4,7 @@ insightconnect_plugin_runtime/cli.py,sha256=Pb-Janu-XfRlSXxPHh30OIquljWptrhhS51C
|
|
|
4
4
|
insightconnect_plugin_runtime/connection.py,sha256=4bHHV2B0UFGsAtvLu1fiYQRwx7fissUakHPUyjLQO0E,2340
|
|
5
5
|
insightconnect_plugin_runtime/dispatcher.py,sha256=ru7njnyyWE1-oD-VbZJ-Z8tELwvDf69rM7Iezs4rbnw,1774
|
|
6
6
|
insightconnect_plugin_runtime/exceptions.py,sha256=Pvcdkx81o6qC2qU661x-DzNjuIMP82x52nPMSEqEo4s,8491
|
|
7
|
-
insightconnect_plugin_runtime/helper.py,sha256=
|
|
7
|
+
insightconnect_plugin_runtime/helper.py,sha256=IY4-ntZbiXWFx7jAQ_n1vBjQBd_tt4Zr4INtXzQmiGg,31564
|
|
8
8
|
insightconnect_plugin_runtime/metrics.py,sha256=hf_Aoufip_s4k4o8Gtzz90ymZthkaT2e5sXh5B4LcF0,3186
|
|
9
9
|
insightconnect_plugin_runtime/plugin.py,sha256=Yf4LNczykDVc31F9G8uuJ9gxEsgmxmAr0n4pcZzichM,26393
|
|
10
10
|
insightconnect_plugin_runtime/schema.py,sha256=jTNc6KAMqFpaDVWrAYhkVC6e8I63P3X7uVlJkAr1hiY,583
|
|
@@ -78,7 +78,7 @@ tests/unit/test_server_spec.py,sha256=je97BaktgK0Fiz3AwFPkcmHzYtOJJNqJV_Fw5hrvqX
|
|
|
78
78
|
tests/unit/test_trigger.py,sha256=E53mAUoVyponWu_4IQZ0IC1gQ9lakBnTn_9vKN2IZfg,1692
|
|
79
79
|
tests/unit/test_variables.py,sha256=OUEOqGYZA3Nd5oKk5GVY3hcrWKHpZpxysBJcO_v5gzs,291
|
|
80
80
|
tests/unit/utils.py,sha256=VooVmfpIgxmglNdtmT32AkEDFxHxyRHLK8RsCWjjYRY,2153
|
|
81
|
-
insightconnect_plugin_runtime-6.2.
|
|
82
|
-
insightconnect_plugin_runtime-6.2.
|
|
83
|
-
insightconnect_plugin_runtime-6.2.
|
|
84
|
-
insightconnect_plugin_runtime-6.2.
|
|
81
|
+
insightconnect_plugin_runtime-6.2.1.dist-info/METADATA,sha256=7VvNCT7PV0qyLXPRcZcp6tUulmRLyEHix_Qf53iwn3M,15117
|
|
82
|
+
insightconnect_plugin_runtime-6.2.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
83
|
+
insightconnect_plugin_runtime-6.2.1.dist-info/top_level.txt,sha256=AJtyJOpiFzHxsbHUICTcUKXyrGQ3tZxhrEHsPjJBvEA,36
|
|
84
|
+
insightconnect_plugin_runtime-6.2.1.dist-info/RECORD,,
|
|
File without changes
|