lacuscore 1.12.1__tar.gz → 1.12.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lacuscore
3
- Version: 1.12.1
3
+ Version: 1.12.3
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
@@ -29,7 +29,7 @@ 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.7.0,<3.0.0) ; python_version >= "3.9"
31
31
  Requires-Dist: eval-type-backport (>=0.2.0,<0.3.0) ; python_version < "3.10"
32
- Requires-Dist: playwrightcapture[recaptcha] (>=1.27.0,<2.0.0)
32
+ Requires-Dist: playwrightcapture[recaptcha] (>=1.27.1,<2.0.0)
33
33
  Requires-Dist: pydantic (>=2.9.2,<3.0.0)
34
34
  Requires-Dist: redis[hiredis] (>=5.2.0,<6.0.0)
35
35
  Requires-Dist: requests (>=2.32.3,<3.0.0)
@@ -82,6 +82,7 @@ class LacusCore():
82
82
 
83
83
  :param redis_connector: Pre-configured connector to a redis instance.
84
84
  :param max_capture_time: If the capture takes more than that time, break (in seconds)
85
+ :param expire_results: The capture results are stored in redis. Expire them after they are done (in seconds).
85
86
  :param tor_proxy: URL to a SOCKS 5 tor proxy. If you have tor installed, this is the default: socks5://127.0.0.1:9050.
86
87
  :param only_global_lookups: Discard captures that point to non-public IPs.
87
88
  :param max_retries: How many times should we re-try a capture if it failed.
@@ -89,6 +90,7 @@ class LacusCore():
89
90
 
90
91
  def __init__(self, redis_connector: Redis[bytes], /, *,
91
92
  max_capture_time: int=3600,
93
+ expire_results: int=36000,
92
94
  tor_proxy: str | None=None,
93
95
  only_global_lookups: bool=True,
94
96
  max_retries: int=3,
@@ -97,6 +99,7 @@ class LacusCore():
97
99
  self.master_logger.setLevel(loglevel)
98
100
  self.redis = redis_connector
99
101
  self.max_capture_time = max_capture_time
102
+ self.expire_results = expire_results
100
103
  self.tor_proxy = tor_proxy
101
104
  self.only_global_lookups = only_global_lookups
102
105
  self.max_retries = max_retries
@@ -620,6 +623,8 @@ class LacusCore():
620
623
  self._store_capture_response(p, uuid, result)
621
624
  else:
622
625
  logger.warning('Got no result at all for the capture.')
626
+ result = {'error': 'No result at all for the capture, Playwright failed.'}
627
+ self._store_capture_response(p, uuid, result)
623
628
  p.delete(f'lacus:capture_settings:{uuid}')
624
629
  p.zrem('lacus:ongoing', uuid)
625
630
  p.execute()
@@ -679,7 +684,7 @@ class LacusCore():
679
684
  if hash_to_set:
680
685
  pipeline.hset(root_key, mapping=hash_to_set) # type: ignore[arg-type]
681
686
  # Make sure the key expires
682
- pipeline.expire(root_key, 36000)
687
+ pipeline.expire(root_key, self.expire_results)
683
688
  else:
684
689
  logger.critical(f'Nothing to store (Hash: {hash_to_set}) for {root_key}')
685
690
 
@@ -765,7 +770,7 @@ class LacusCore():
765
770
  continue
766
771
  raise e
767
772
  except DNSException as e:
768
- logger.info(f'No A record for "{hostname}": {e}')
773
+ logger.debug(f'No A record for "{hostname}": {e}')
769
774
  break
770
775
 
771
776
  _current_retries = 0
@@ -781,6 +786,6 @@ class LacusCore():
781
786
  continue
782
787
  raise e
783
788
  except DNSException as e:
784
- logger.info(f'No AAAA record for "{hostname}": {e}')
789
+ logger.debug(f'No AAAA record for "{hostname}": {e}')
785
790
  break
786
791
  return resolved_ips
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "lacuscore"
3
- version = "1.12.1"
3
+ version = "1.12.3"
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,7 +34,7 @@ Sphinx = [
34
34
  {version = "^7.2", python = ">=3.9,<3.10", optional = true},
35
35
  {version = "^8", python = ">=3.10", optional = true}
36
36
  ]
37
- playwrightcapture = {extras = ["recaptcha"], version = "^1.27.0"}
37
+ playwrightcapture = {extras = ["recaptcha"], version = "^1.27.1"}
38
38
  defang = "^0.5.3"
39
39
  ua-parser = "^0.18.0"
40
40
  redis = {version = "^5.2.0", extras = ["hiredis"]}
File without changes
File without changes