lacuscore 1.8.8__tar.gz → 1.8.9__tar.gz
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.
- {lacuscore-1.8.8 → lacuscore-1.8.9}/PKG-INFO +3 -3
- {lacuscore-1.8.8 → lacuscore-1.8.9}/lacuscore/lacuscore.py +15 -2
- {lacuscore-1.8.8 → lacuscore-1.8.9}/pyproject.toml +7 -7
- {lacuscore-1.8.8 → lacuscore-1.8.9}/LICENSE +0 -0
- {lacuscore-1.8.8 → lacuscore-1.8.9}/README.md +0 -0
- {lacuscore-1.8.8 → lacuscore-1.8.9}/lacuscore/__init__.py +0 -0
- {lacuscore-1.8.8 → lacuscore-1.8.9}/lacuscore/lacus_monitoring.py +0 -0
- {lacuscore-1.8.8 → lacuscore-1.8.9}/lacuscore/py.typed +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: lacuscore
|
3
|
-
Version: 1.8.
|
3
|
+
Version: 1.8.9
|
4
4
|
Summary: Core of Lacus, usable as a module
|
5
5
|
Home-page: https://github.com/ail-project/LacusCore
|
6
6
|
License: BSD-3-Clause
|
@@ -28,8 +28,8 @@ Requires-Dist: Sphinx (>=7.2,<8.0) ; (python_version >= "3.9") and (extra == "do
|
|
28
28
|
Requires-Dist: async-timeout (>=4.0.3,<5.0.0) ; python_version < "3.11"
|
29
29
|
Requires-Dist: defang (>=0.5.3,<0.6.0)
|
30
30
|
Requires-Dist: dnspython (>=2.6.1,<3.0.0)
|
31
|
-
Requires-Dist: playwrightcapture[recaptcha] (>=1.23.
|
32
|
-
Requires-Dist: redis[hiredis] (>=5.0.
|
31
|
+
Requires-Dist: playwrightcapture[recaptcha] (>=1.23.10,<2.0.0)
|
32
|
+
Requires-Dist: redis[hiredis] (>=5.0.3,<6.0.0)
|
33
33
|
Requires-Dist: requests (>=2.31.0,<3.0.0)
|
34
34
|
Requires-Dist: ua-parser (>=0.18.0,<0.19.0)
|
35
35
|
Project-URL: Documentation, https://lacuscore.readthedocs.io/en/latest/
|
@@ -29,6 +29,7 @@ from urllib.parse import urlsplit
|
|
29
29
|
|
30
30
|
from dns import resolver
|
31
31
|
from dns.exception import DNSException
|
32
|
+
from dns.exception import Timeout as DNSTimeout
|
32
33
|
|
33
34
|
from defang import refang # type: ignore[import-untyped]
|
34
35
|
from playwrightcapture import Capture, PlaywrightCaptureException
|
@@ -175,6 +176,10 @@ class LacusCore():
|
|
175
176
|
self.tor_proxy = tor_proxy
|
176
177
|
self.only_global_lookups = only_global_lookups
|
177
178
|
self.max_retries = max_retries
|
179
|
+
self.dnsresolver: resolver.Resolver = resolver.Resolver()
|
180
|
+
self.dnsresolver.cache = resolver.Cache(30)
|
181
|
+
self.dnsresolver.timeout = 2
|
182
|
+
self.dnsresolver.lifetime = 3
|
178
183
|
|
179
184
|
# NOTE: Remove in 1.8.* - clear old ongoing captures queue in case of need
|
180
185
|
if self.redis.type('lacus:ongoing') in ['set', b'set']: # type: ignore[no-untyped-call]
|
@@ -565,6 +570,10 @@ class LacusCore():
|
|
565
570
|
# not an IP, try resolving
|
566
571
|
try:
|
567
572
|
ips_to_check = self.__get_ips(logger, splitted_url.hostname)
|
573
|
+
except DNSTimeout as e:
|
574
|
+
# for a timeout, we do not want to retry, as it is likely to timeout again
|
575
|
+
result = {'error': f'DNS Timeout for "{splitted_url.hostname}": {e}'}
|
576
|
+
raise CaptureError(f'DNS Timeout for "{splitted_url.hostname}": {e}')
|
568
577
|
except Exception as e:
|
569
578
|
result = {'error': f'Issue with hostname resolution ({splitted_url.hostname}): {e}. Full URL: "{url}".'}
|
570
579
|
raise CaptureError(f'Issue with hostname resolution ({splitted_url.hostname}): {e}. Full URL: "{url}".')
|
@@ -854,13 +863,17 @@ class LacusCore():
|
|
854
863
|
# It is happening when the error code is NoAnswer
|
855
864
|
resolved_ips = []
|
856
865
|
try:
|
857
|
-
answers_a =
|
866
|
+
answers_a = self.dnsresolver.resolve(hostname, 'A')
|
858
867
|
resolved_ips += [ip_address(str(answer)) for answer in answers_a]
|
868
|
+
except DNSTimeout as e:
|
869
|
+
raise e
|
859
870
|
except DNSException as e:
|
860
871
|
logger.info(f'No A record for "{hostname}": {e}')
|
861
872
|
try:
|
862
|
-
answers_aaaa =
|
873
|
+
answers_aaaa = self.dnsresolver.resolve(hostname, 'AAAA')
|
863
874
|
resolved_ips += [ip_address(str(answer)) for answer in answers_aaaa]
|
875
|
+
except DNSTimeout as e:
|
876
|
+
raise e
|
864
877
|
except DNSException as e:
|
865
878
|
logger.info(f'No AAAA record for "{hostname}": {e}')
|
866
879
|
return resolved_ips
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "lacuscore"
|
3
|
-
version = "1.8.
|
3
|
+
version = "1.8.9"
|
4
4
|
description = "Core of Lacus, usable as a module"
|
5
5
|
authors = ["Raphaël Vinot <raphael.vinot@circl.lu>"]
|
6
6
|
license = "BSD-3-Clause"
|
@@ -34,10 +34,10 @@ Sphinx = [
|
|
34
34
|
{version = "<7.2", python = "<3.9", optional = true},
|
35
35
|
{version = "^7.2", python = ">=3.9", optional = true}
|
36
36
|
]
|
37
|
-
playwrightcapture = {extras = ["recaptcha"], version = "^1.23.
|
37
|
+
playwrightcapture = {extras = ["recaptcha"], version = "^1.23.10"}
|
38
38
|
defang = "^0.5.3"
|
39
39
|
ua-parser = "^0.18.0"
|
40
|
-
redis = {version = "^5.0.
|
40
|
+
redis = {version = "^5.0.3", extras = ["hiredis"]}
|
41
41
|
dnspython = "^2.6.1"
|
42
42
|
async-timeout = {version = "^4.0.3", python = "<3.11"}
|
43
43
|
|
@@ -45,16 +45,16 @@ async-timeout = {version = "^4.0.3", python = "<3.11"}
|
|
45
45
|
docs = ["Sphinx"]
|
46
46
|
|
47
47
|
[tool.poetry.group.dev.dependencies]
|
48
|
-
types-redis = {version = "^4.6.0.
|
49
|
-
mypy = "^1.
|
50
|
-
types-requests = "^2.31.0.
|
48
|
+
types-redis = {version = "^4.6.0.20240311"}
|
49
|
+
mypy = "^1.9.0"
|
50
|
+
types-requests = "^2.31.0.20240311"
|
51
51
|
types-beautifulsoup4 = "^4.12.0.20240229"
|
52
52
|
ipython = [
|
53
53
|
{version = "<8.13.0", python = "<3.9"},
|
54
54
|
{version = "^8.18.0", python = ">=3.9"},
|
55
55
|
{version = "^8.19.0", python = ">=3.10"}
|
56
56
|
]
|
57
|
-
pytest = "^8.
|
57
|
+
pytest = "^8.1.1"
|
58
58
|
|
59
59
|
[build-system]
|
60
60
|
requires = ["poetry_core"]
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|