trapster 1.2.2__tar.gz → 1.2.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.
Files changed (56) hide show
  1. {trapster-1.2.2/trapster.egg-info → trapster-1.2.3}/PKG-INFO +1 -1
  2. trapster-1.2.3/trapster/__init__.py +1 -0
  3. {trapster-1.2.2 → trapster-1.2.3}/trapster/modules/http.py +33 -0
  4. {trapster-1.2.2 → trapster-1.2.3}/trapster/modules/https.py +7 -7
  5. {trapster-1.2.2 → trapster-1.2.3/trapster.egg-info}/PKG-INFO +1 -1
  6. trapster-1.2.2/trapster/__init__.py +0 -1
  7. {trapster-1.2.2 → trapster-1.2.3}/LICENSE +0 -0
  8. {trapster-1.2.2 → trapster-1.2.3}/MANIFEST.in +0 -0
  9. {trapster-1.2.2 → trapster-1.2.3}/README.md +0 -0
  10. {trapster-1.2.2 → trapster-1.2.3}/requirements.txt +0 -0
  11. {trapster-1.2.2 → trapster-1.2.3}/setup.cfg +0 -0
  12. {trapster-1.2.2 → trapster-1.2.3}/setup.py +0 -0
  13. {trapster-1.2.2 → trapster-1.2.3}/tests/test_ftp_server.py +0 -0
  14. {trapster-1.2.2 → trapster-1.2.3}/tests/test_ssh_server.py +0 -0
  15. {trapster-1.2.2 → trapster-1.2.3}/trapster/ai/__init__.py +0 -0
  16. {trapster-1.2.2 → trapster-1.2.3}/trapster/ai/base.py +0 -0
  17. {trapster-1.2.2 → trapster-1.2.3}/trapster/ai/http.py +0 -0
  18. {trapster-1.2.2 → trapster-1.2.3}/trapster/ai/ssh.py +0 -0
  19. {trapster-1.2.2 → trapster-1.2.3}/trapster/data/trapster.conf +0 -0
  20. {trapster-1.2.2 → trapster-1.2.3}/trapster/libs/__init__.py +0 -0
  21. {trapster-1.2.2 → trapster-1.2.3}/trapster/libs/dns.py +0 -0
  22. {trapster-1.2.2 → trapster-1.2.3}/trapster/libs/ldapasn1.py +0 -0
  23. {trapster-1.2.2 → trapster-1.2.3}/trapster/libs/ntlm.py +0 -0
  24. {trapster-1.2.2 → trapster-1.2.3}/trapster/logger/__init__.py +0 -0
  25. {trapster-1.2.2 → trapster-1.2.3}/trapster/logger/api.py +0 -0
  26. {trapster-1.2.2 → trapster-1.2.3}/trapster/logger/base.py +0 -0
  27. {trapster-1.2.2 → trapster-1.2.3}/trapster/logger/ecs.py +0 -0
  28. {trapster-1.2.2 → trapster-1.2.3}/trapster/logger/factory.py +0 -0
  29. {trapster-1.2.2 → trapster-1.2.3}/trapster/logger/file.py +0 -0
  30. {trapster-1.2.2 → trapster-1.2.3}/trapster/logger/formatters.py +0 -0
  31. {trapster-1.2.2 → trapster-1.2.3}/trapster/logger/json.py +0 -0
  32. {trapster-1.2.2 → trapster-1.2.3}/trapster/logger/output.py +0 -0
  33. {trapster-1.2.2 → trapster-1.2.3}/trapster/logger/redis.py +0 -0
  34. {trapster-1.2.2 → trapster-1.2.3}/trapster/modules/__init__.py +0 -0
  35. {trapster-1.2.2 → trapster-1.2.3}/trapster/modules/base.py +0 -0
  36. {trapster-1.2.2 → trapster-1.2.3}/trapster/modules/dns.py +0 -0
  37. {trapster-1.2.2 → trapster-1.2.3}/trapster/modules/ftp.py +0 -0
  38. {trapster-1.2.2 → trapster-1.2.3}/trapster/modules/ldap.py +0 -0
  39. {trapster-1.2.2 → trapster-1.2.3}/trapster/modules/ldaps.py +0 -0
  40. {trapster-1.2.2 → trapster-1.2.3}/trapster/modules/mssql.py +0 -0
  41. {trapster-1.2.2 → trapster-1.2.3}/trapster/modules/mysql.py +0 -0
  42. {trapster-1.2.2 → trapster-1.2.3}/trapster/modules/postgres.py +0 -0
  43. {trapster-1.2.2 → trapster-1.2.3}/trapster/modules/rdp.py +0 -0
  44. {trapster-1.2.2 → trapster-1.2.3}/trapster/modules/resources/VNC_ascii.hcchr +0 -0
  45. {trapster-1.2.2 → trapster-1.2.3}/trapster/modules/rsync.py +0 -0
  46. {trapster-1.2.2 → trapster-1.2.3}/trapster/modules/snmp.py +0 -0
  47. {trapster-1.2.2 → trapster-1.2.3}/trapster/modules/socks5.py +0 -0
  48. {trapster-1.2.2 → trapster-1.2.3}/trapster/modules/ssh.py +0 -0
  49. {trapster-1.2.2 → trapster-1.2.3}/trapster/modules/telnet.py +0 -0
  50. {trapster-1.2.2 → trapster-1.2.3}/trapster/modules/vnc.py +0 -0
  51. {trapster-1.2.2 → trapster-1.2.3}/trapster/trapster.py +0 -0
  52. {trapster-1.2.2 → trapster-1.2.3}/trapster.egg-info/SOURCES.txt +0 -0
  53. {trapster-1.2.2 → trapster-1.2.3}/trapster.egg-info/dependency_links.txt +0 -0
  54. {trapster-1.2.2 → trapster-1.2.3}/trapster.egg-info/entry_points.txt +0 -0
  55. {trapster-1.2.2 → trapster-1.2.3}/trapster.egg-info/requires.txt +0 -0
  56. {trapster-1.2.2 → trapster-1.2.3}/trapster.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trapster
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: Trapster Daemon
5
5
  Home-page: https://trapster.cloud/
6
6
  Author: 0xBallpoint
@@ -0,0 +1 @@
1
+ __version__="1.2.3"
@@ -66,7 +66,40 @@ def _patch_hypercorn_reason():
66
66
  hyper_h11.H11Protocol._send_h11_event = _send_h11_event
67
67
 
68
68
 
69
+ def _patch_hypercorn_ssl_shutdown():
70
+ """Swallow TimeoutError from TLS wait_closed
71
+
72
+ Clients that drop TLS without a clean close_notify raise TimeoutError: "SSL shutdown timed out".
73
+ Hypercorn leaves it uncaught in TCPServer._close, so this function catches it and aborts the connection.
74
+
75
+ REMOVE when fixed upstream:
76
+ https://github.com/pgjones/hypercorn/pull/342 (TimeoutError + abort)
77
+ https://github.com/pgjones/hypercorn/issues/202
78
+ After a hypercorn release that catches TimeoutError, delete this function and its call.
79
+ """
80
+ try:
81
+ from hypercorn.asyncio.tcp_server import TCPServer
82
+ except Exception:
83
+ return
84
+
85
+ original = TCPServer._close
86
+
87
+ async def _close(self):
88
+ try:
89
+ await original(self)
90
+ except TimeoutError:
91
+ try:
92
+ transport = self.writer.transport
93
+ if transport is not None:
94
+ transport.abort()
95
+ except Exception:
96
+ pass
97
+
98
+ TCPServer._close = _close
99
+
100
+
69
101
  _patch_hypercorn_reason()
102
+ _patch_hypercorn_ssl_shutdown()
70
103
 
71
104
  # Optional AI import - gracefully handle when AI dependencies aren't installed
72
105
  try:
@@ -12,6 +12,11 @@ from cryptography import x509
12
12
  from cryptography.x509.oid import NameOID
13
13
 
14
14
 
15
+ def _has_content(path):
16
+ """True when *path* is an existing file with data (empty files don't count)."""
17
+ return path.is_file() and path.stat().st_size > 0
18
+
19
+
15
20
  class HttpsHandler(HttpHandler):
16
21
  def __init__(self, config=None, logger=None):
17
22
  super().__init__(config, logger)
@@ -24,8 +29,6 @@ class HttpsHoneypot(HttpHoneypot):
24
29
  def __init__(self, config, logger, bindaddr="0.0.0.0"):
25
30
  super().__init__(config, logger, bindaddr)
26
31
  self.handler = HttpsHandler(config=config, logger=logger)
27
- # Check if the user has set the TLS key and certificate
28
- self.user_set_tls = config.get("key") and config.get("certificate")
29
32
  config.setdefault("country_name", None)
30
33
  config.setdefault("state_or_province_name", None)
31
34
  config.setdefault("locality_name", None)
@@ -64,11 +67,8 @@ class HttpsHoneypot(HttpHoneypot):
64
67
  Use the configured key/certificate files when both already exist.
65
68
  Otherwise generate a self-signed pair (and write it to those paths).
66
69
  '''
67
- if self.user_set_tls:
68
- if self.certificate_path.is_file() and self.key_path.is_file():
69
- return
70
- else:
71
- raise ValueError(f"HTTPS key/certificate configured but missing: key={self.key_path} certificate={self.certificate_path}")
70
+ if _has_content(self.key_path) and _has_content(self.certificate_path):
71
+ return
72
72
 
73
73
  self.key_path.parent.mkdir(parents=True, exist_ok=True)
74
74
  self.certificate_path.parent.mkdir(parents=True, exist_ok=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trapster
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: Trapster Daemon
5
5
  Home-page: https://trapster.cloud/
6
6
  Author: 0xBallpoint
@@ -1 +0,0 @@
1
- __version__="1.2.2"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes