elasticpot 2.0.1.dev0__tar.gz → 2.0.2__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 (94) hide show
  1. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/CHANGELOG.md +17 -4
  2. {elasticpot-2.0.1.dev0/elasticpot.egg-info → elasticpot-2.0.2}/PKG-INFO +6 -1
  3. elasticpot-2.0.2/core/httpclient.py +71 -0
  4. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/core/tools.py +2 -5
  5. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/Dockerfile +1 -0
  6. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/docs/INSTALL.md +2 -2
  7. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/docs/INSTALLWIN.md +3 -3
  8. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/etc/honeypot.cfg.base +19 -1
  9. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2/elasticpot}/honeypot.py +1 -1
  10. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2/elasticpot.egg-info}/PKG-INFO +6 -1
  11. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot.egg-info/SOURCES.txt +1 -1
  12. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot.egg-info/requires.txt +5 -0
  13. {elasticpot-2.0.1.dev0/elasticpot → elasticpot-2.0.2}/honeypot.py +1 -1
  14. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/couch.py +5 -1
  15. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/datadog.py +4 -8
  16. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/discord.py +4 -9
  17. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/elastic.py +2 -0
  18. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/nlcvapi.py +4 -10
  19. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/telegram.py +8 -12
  20. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/xmpp.py +1 -1
  21. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/setup.cfg +0 -3
  22. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/setup.py +9 -2
  23. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/LICENSE +0 -0
  24. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/MANIFEST.in +0 -0
  25. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/README.md +0 -0
  26. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/core/__init__.py +0 -0
  27. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/core/config.py +0 -0
  28. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/core/logfile.py +0 -0
  29. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/core/output.py +0 -0
  30. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/core/paths.py +0 -0
  31. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/core/protocol.py +0 -0
  32. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/__init__.py +0 -0
  33. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/cli.py +0 -0
  34. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/docs/PLUGINS.md +0 -0
  35. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/docs/TODO.md +0 -0
  36. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/docs/datadog/README.md +0 -0
  37. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/docs/discord/README.md +0 -0
  38. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/docs/geoipupdtask.ps1 +0 -0
  39. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/docs/mysql/README.md +0 -0
  40. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/docs/mysql/READMEWIN.md +0 -0
  41. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/docs/mysql/mysql.sql +0 -0
  42. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/docs/postgres/README.md +0 -0
  43. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/docs/postgres/READMEWIN.md +0 -0
  44. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/docs/postgres/postgres.sql +0 -0
  45. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/docs/slack/README.md +0 -0
  46. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/docs/sqlite3/README.md +0 -0
  47. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/docs/sqlite3/READMEWIN.md +0 -0
  48. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/docs/sqlite3/sqlite3.sql +0 -0
  49. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/docs/telegram/README.md +0 -0
  50. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/responses/aliases.json +0 -0
  51. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/responses/banner.json +0 -0
  52. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/responses/cluster.json +0 -0
  53. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/responses/clusterstore.json +0 -0
  54. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/responses/error.json +0 -0
  55. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/responses/index1long.json +0 -0
  56. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/responses/index1short.json +0 -0
  57. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/responses/index2long.json +0 -0
  58. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/responses/index2short.json +0 -0
  59. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/responses/indices.txt +0 -0
  60. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/responses/mapping.json +0 -0
  61. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/responses/nodes.json +0 -0
  62. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/responses/nodes2.json +0 -0
  63. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/responses/nodes2.txt +0 -0
  64. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/responses/pluginhead.html +0 -0
  65. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/responses/search.json +0 -0
  66. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/responses/search2.json +0 -0
  67. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/responses/settings.json +0 -0
  68. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/responses/stats1.json +0 -0
  69. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/responses/stats2.json +0 -0
  70. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/responses/store.json +0 -0
  71. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/test/.gitignore +0 -0
  72. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/test/README.md +0 -0
  73. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/test/baseline +0 -0
  74. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/test/test.py +0 -0
  75. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot/data/test/testurls.txt +0 -0
  76. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot.egg-info/dependency_links.txt +0 -0
  77. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot.egg-info/entry_points.txt +0 -0
  78. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/elasticpot.egg-info/top_level.txt +0 -0
  79. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/README.md +0 -0
  80. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/__init__.py +0 -0
  81. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/hpfeed.py +0 -0
  82. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/influx2.py +0 -0
  83. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/jsonlog.py +0 -0
  84. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/kafka.py +0 -0
  85. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/localsyslog.py +0 -0
  86. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/mongodb.py +0 -0
  87. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/mysql.py +0 -0
  88. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/postgres.py +0 -0
  89. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/redisdb.py +0 -0
  90. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/rethinkdblog.py +0 -0
  91. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/slack.py +0 -0
  92. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/socketlog.py +0 -0
  93. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/sqlite.py +0 -0
  94. {elasticpot-2.0.1.dev0 → elasticpot-2.0.2}/output_plugins/textlog.py +0 -0
@@ -5,15 +5,28 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [2.0.1]
8
+ ## [2.0.2]
9
9
 
10
- ### Added in version 2.0.1
10
+ ### Added in version 2.0.2
11
11
 
12
- * Nothing so far
12
+ * Nothing
13
13
 
14
- ### Changed in version 2.0.1
14
+ ### Changed in version 2.0.2
15
15
 
16
16
  * Increased the version number
17
+ * The `datadog`, `discord`, `nlcvapi`, and `telegram` plugins now use a secure
18
+ connection (HTTPS) by default
19
+ * The `elastic` plugin now warns if the `ssl` is set while certificate
20
+ verification (`verify_certs`) is off
21
+ * The `couch` plugin now uses authentication mechanism that does not pass the
22
+ username and password in the URL
23
+
24
+ ## [2.0.1]
25
+
26
+ ### Changed in version 2.0.1
27
+
28
+ * The honeypot was released with an incorrect version - "2.0.1-dev0" instead of
29
+ "2.0.0". Fixed by changing it and releasing version 2.0.1
17
30
 
18
31
  ## [2.0.0]
19
32
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: elasticpot
3
- Version: 2.0.1.dev0
3
+ Version: 2.0.2
4
4
  Summary: An ElasticSearch Honeypot
5
5
  Home-page: https://gitlab.com/bontchev/elasticpot
6
6
  Author: Vesselin Bontchev
@@ -43,11 +43,13 @@ Requires-Dist: twisted>=21; python_version >= "3"
43
43
  Provides-Extra: couchdb
44
44
  Requires-Dist: couchdb; extra == "couchdb"
45
45
  Provides-Extra: datadog
46
+ Requires-Dist: certifi; extra == "datadog"
46
47
  Requires-Dist: cryptography<=2.8; python_version < "3" and extra == "datadog"
47
48
  Requires-Dist: pyOpenSSL<=18.0.0; python_version < "3" and extra == "datadog"
48
49
  Requires-Dist: cryptography; python_version >= "3" and extra == "datadog"
49
50
  Requires-Dist: pyOpenSSL; python_version >= "3" and extra == "datadog"
50
51
  Provides-Extra: discord
52
+ Requires-Dist: certifi; extra == "discord"
51
53
  Provides-Extra: elastic
52
54
  Requires-Dist: elasticsearch<=7.13; python_version < "3" and extra == "elastic"
53
55
  Requires-Dist: numpy<=1.16.6; python_version < "3" and extra == "elastic"
@@ -71,6 +73,7 @@ Provides-Extra: mysql
71
73
  Requires-Dist: PyMySQL; python_version < "3" and extra == "mysql"
72
74
  Requires-Dist: mysqlclient>=1.3.12; python_version >= "3" and extra == "mysql"
73
75
  Provides-Extra: nlcvapi
76
+ Requires-Dist: certifi; extra == "nlcvapi"
74
77
  Requires-Dist: pyOpenSSL<=18.0.0; python_version < "3" and extra == "nlcvapi"
75
78
  Requires-Dist: pyOpenSSL; python_version >= "3" and extra == "nlcvapi"
76
79
  Provides-Extra: postgres
@@ -87,12 +90,14 @@ Requires-Dist: slack-sdk; python_version >= "3" and extra == "slack"
87
90
  Provides-Extra: socketlog
88
91
  Provides-Extra: sqlite
89
92
  Provides-Extra: telegram
93
+ Requires-Dist: certifi; extra == "telegram"
90
94
  Provides-Extra: textlog
91
95
  Provides-Extra: xmpp
92
96
  Requires-Dist: xmpppy>=0.7.3; extra == "xmpp"
93
97
  Provides-Extra: all
94
98
  Requires-Dist: Automat<20; python_version < "3" and extra == "all"
95
99
  Requires-Dist: PyMySQL; python_version < "3" and extra == "all"
100
+ Requires-Dist: certifi; extra == "all"
96
101
  Requires-Dist: confluent-kafka; python_version >= "3" and extra == "all"
97
102
  Requires-Dist: confluent-kafka<1.0; python_version < "3" and extra == "all"
98
103
  Requires-Dist: couchdb; extra == "all"
@@ -0,0 +1,71 @@
1
+ from __future__ import absolute_import
2
+
3
+ from io import open
4
+
5
+ from twisted.internet.ssl import Certificate, trustRootFromCertificates
6
+ from twisted.python.log import msg
7
+ from twisted.web.client import Agent, BrowserLikePolicyForHTTPS
8
+
9
+
10
+ class _LegacyWebClientContextFactory(object):
11
+ @staticmethod
12
+ def build():
13
+ from twisted.internet.ssl import ClientContextFactory
14
+
15
+ class WebClientContextFactory(ClientContextFactory):
16
+ def getContext(self, hostname, port):
17
+ return ClientContextFactory.getContext(self)
18
+
19
+ return WebClientContextFactory()
20
+
21
+
22
+ def _load_trust_root_from_pem_bundle(pem_path):
23
+ with open(pem_path, 'r', encoding='utf-8') as fh:
24
+ content = fh.read()
25
+ certs = []
26
+ end_marker = '-----END CERTIFICATE-----'
27
+ for chunk in content.split(end_marker):
28
+ chunk = chunk.strip()
29
+ if not chunk:
30
+ continue
31
+ pem = chunk + '\n' + end_marker + '\n'
32
+ certs.append(Certificate.loadPEM(pem))
33
+ if not certs:
34
+ return None
35
+ return trustRootFromCertificates(certs)
36
+
37
+
38
+ def _trust_root(ca_certs):
39
+ if ca_certs:
40
+ try:
41
+ return _load_trust_root_from_pem_bundle(ca_certs)
42
+ except Exception as e:
43
+ msg('Failed to load CA bundle {}: {}'.format(ca_certs, e))
44
+ return None
45
+
46
+ try:
47
+ import certifi
48
+ return _load_trust_root_from_pem_bundle(certifi.where())
49
+ except Exception:
50
+ return None
51
+
52
+
53
+ def create_http_agent(reactor, pool, plugin_name, verify_tls=True, ca_certs=None):
54
+ """
55
+ Build a Twisted Agent with sane HTTPS defaults.
56
+ verify_tls=True uses BrowserLikePolicyForHTTPS for cert + hostname checks.
57
+ verify_tls=False falls back to a legacy context factory for compatibility.
58
+ """
59
+ if verify_tls:
60
+ return Agent(
61
+ reactor,
62
+ contextFactory=BrowserLikePolicyForHTTPS(trustRoot=_trust_root(ca_certs)),
63
+ pool=pool
64
+ )
65
+
66
+ msg('{}: TLS certificate verification is disabled.'.format(plugin_name))
67
+ return Agent(
68
+ reactor,
69
+ contextFactory=_LegacyWebClientContextFactory.build(),
70
+ pool=pool
71
+ )
@@ -15,7 +15,7 @@ try:
15
15
  from urllib.request import urlopen
16
16
  from urllib.parse import urlsplit, urlunsplit
17
17
  except ImportError:
18
- from urllib import urlopen
18
+ from urllib2 import urlopen # type: ignore
19
19
  from urlparse import urlsplit, urlunsplit # type: ignore
20
20
 
21
21
 
@@ -42,10 +42,7 @@ def get_utc_time(unix_time):
42
42
 
43
43
  def get_public_ip(ip_reporter):
44
44
  try:
45
- if version_info[0] < 3:
46
- return urlopen(ip_reporter).read().decode('latin1', errors='replace').encode('utf-8')
47
- else:
48
- return urlopen(ip_reporter).read()
45
+ return decode(urlopen(ip_reporter, timeout=10).read())
49
46
  except:
50
47
  return '127.0.0.1'
51
48
 
@@ -51,6 +51,7 @@ USER elasticpot
51
51
  # docker run \
52
52
  # -v /path/to/honeypot.cfg:/elasticpot/etc/honeypot.cfg \
53
53
  # -v /path/to/data:/elasticpot/data \
54
+ # -v /path/to/log:/elasticpot/log \
54
55
  # -p 9200:9200 elasticpot
55
56
  #
56
57
  CMD ["elasticpot", "run"]
@@ -168,7 +168,7 @@ working) and `Dockerfile` into the working directory.
168
168
  The configuration for the honeypot is stored in `etc/honeypot.cfg.base` and
169
169
  `etc/honeypot.cfg`. Both files are read on startup but entries from
170
170
  `etc/honeypot.cfg` take precedence. The `.base` file contains the default
171
- settings and should not be edited it may be overwritten by upgrades. All
171
+ settings and should not be edited - it may be overwritten by upgrades. All
172
172
  your customisations should go into `etc/honeypot.cfg`.
173
173
 
174
174
  To run with a standard configuration there is no need to change anything.
@@ -418,7 +418,7 @@ $ source ~/elasticpot-env/bin/activate
418
418
 
419
419
  where `[plugin_list]` is as explained above.
420
420
 
421
- Note that `elasticpot init` is safe to re-run it never overwrites files that
421
+ Note that `elasticpot init` is safe to re-run - it never overwrites files that
422
422
  you have already edited or created (such as `etc/honeypot.cfg`). It only
423
423
  copies files that are missing, so any new defaults added by an upgrade are
424
424
  picked up automatically.
@@ -33,7 +33,7 @@ programs (if they are not already present):
33
33
 
34
34
  - **Database server** (optional). If you want the honeypot to send the data
35
35
  it collects to a local database server (e.g., MySQL), make sure to install
36
- it again, for all users and not just for the current one.
36
+ it - again, for all users and not just for the current one.
37
37
 
38
38
  - The latest version of the **VS C++ redistributable** (required by some of
39
39
  the database output plugins, e.g., for MySQL). Version 14 or higher should
@@ -188,7 +188,7 @@ working directory.
188
188
  The configuration for the honeypot is stored in `etc\honeypot.cfg.base` and
189
189
  `etc\honeypot.cfg`. Both the `*.cfg.base` and the `*.cfg` files are read on
190
190
  startup but entries from the `*.cfg` files take precedence. The `*.base` files
191
- contain the default settings and should not be edited they may be overwritten
191
+ contain the default settings and should not be edited - they may be overwritten
192
192
  by future updates. All your customisations should go into the `*.cfg` files.
193
193
 
194
194
  To run with a standard configuration there is no need to change anything.
@@ -429,7 +429,7 @@ PS C:\elasticpot-workdir> C:\elasticpot-env\Scripts\activate.ps1
429
429
 
430
430
  where `[plugin_list]` is as explained above.
431
431
 
432
- Note that `elasticpot init` is safe to re-run it never overwrites files that
432
+ Note that `elasticpot init` is safe to re-run - it never overwrites files that
433
433
  you have already edited or created (such as `etc\honeypot.cfg`). It only
434
434
  copies files that are missing, so any new defaults added by an upgrade are
435
435
  picked up automatically.
@@ -125,6 +125,8 @@ log_path = log
125
125
  #
126
126
  #[output_couch]
127
127
  #enabled = false
128
+ # Optional transport scheme: http (default) or https
129
+ #scheme = http
128
130
  #host = localhost
129
131
  #port = 5984
130
132
  #username = elasticpot
@@ -144,6 +146,10 @@ log_path = log
144
146
  #[output_datadog]
145
147
  #enabled = false
146
148
  #url = https://http-intake.logs.datadoghq.com/api/v2/logs
149
+ # Verify TLS certificates and hostnames for HTTPS connections (default: true)
150
+ #verify_tls = true
151
+ # Optional path to a PEM CA bundle (used when verify_tls = true)
152
+ #ca_certs = /path/to/ca-bundle.pem
147
153
  #api_key = abcdef1234567890fedcba0987654321
148
154
  #ddsource = elasticpot
149
155
  #ddtags = env:dev
@@ -155,6 +161,10 @@ log_path = log
155
161
  #
156
162
  #[output_discord]
157
163
  #enabled = false
164
+ # Verify TLS certificates and hostnames for HTTPS connections (default: true)
165
+ #verify_tls = true
166
+ # Optional path to a PEM CA bundle (used when verify_tls = true)
167
+ #ca_certs = /path/to/ca-bundle.pem
158
168
  # Delay between messages (for rate limiting)
159
169
  #delay = 2.0
160
170
  #url = https://discord.com/api/webhooks/id/token
@@ -286,6 +296,10 @@ log_path = log
286
296
  #[output_nlcvapi]
287
297
  #enabled = false
288
298
  #host = https://api.nlcv.bas.bg/v1.0/honeypot
299
+ # Verify TLS certificates and hostnames for HTTPS connections (default: true)
300
+ #verify_tls = true
301
+ # Optional path to a PEM CA bundle (used when verify_tls = true)
302
+ #ca_certs = /path/to/ca-bundle.pem
289
303
  # Whether to store geolocation data in the database
290
304
  #geoip = true
291
305
  # Location of the databases used for geolocation
@@ -387,6 +401,10 @@ log_path = log
387
401
  #
388
402
  #[output_telegram]
389
403
  #enabled = false
404
+ # Verify TLS certificates and hostnames for HTTPS connections (default: true)
405
+ #verify_tls = true
406
+ # Optional path to a PEM CA bundle (used when verify_tls = true)
407
+ #ca_certs = /path/to/ca-bundle.pem
390
408
  #bot_token = 123456789:AbCDEfGhiJkLmnOpQRstUVWxYZ
391
409
  #chat_id = 987654321
392
410
  # Delay between messages (for rate limiting)
@@ -402,7 +420,7 @@ log_path = log
402
420
  # XMPP logging module
403
421
  #
404
422
  #[output_xmpp]
405
- #enabled=false
423
+ #enabled = false
406
424
  #server = conference.elasticpot.local
407
425
  #user = elasticpot@elasticpot.local
408
426
  #password = secret
@@ -23,7 +23,7 @@ from twisted.internet.reactor import listenTCP, run
23
23
  from twisted.python.log import msg
24
24
  from twisted.web.server import Site
25
25
 
26
- __VERSION__ = '2.0.1-dev0'
26
+ __VERSION__ = '2.0.2'
27
27
  __description__ = 'Elasticsearch Honeypot'
28
28
  __license__ = 'GPLv3'
29
29
  __uri__ = 'https://gitlab.com/bontchev/elasticpot'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: elasticpot
3
- Version: 2.0.1.dev0
3
+ Version: 2.0.2
4
4
  Summary: An ElasticSearch Honeypot
5
5
  Home-page: https://gitlab.com/bontchev/elasticpot
6
6
  Author: Vesselin Bontchev
@@ -43,11 +43,13 @@ Requires-Dist: twisted>=21; python_version >= "3"
43
43
  Provides-Extra: couchdb
44
44
  Requires-Dist: couchdb; extra == "couchdb"
45
45
  Provides-Extra: datadog
46
+ Requires-Dist: certifi; extra == "datadog"
46
47
  Requires-Dist: cryptography<=2.8; python_version < "3" and extra == "datadog"
47
48
  Requires-Dist: pyOpenSSL<=18.0.0; python_version < "3" and extra == "datadog"
48
49
  Requires-Dist: cryptography; python_version >= "3" and extra == "datadog"
49
50
  Requires-Dist: pyOpenSSL; python_version >= "3" and extra == "datadog"
50
51
  Provides-Extra: discord
52
+ Requires-Dist: certifi; extra == "discord"
51
53
  Provides-Extra: elastic
52
54
  Requires-Dist: elasticsearch<=7.13; python_version < "3" and extra == "elastic"
53
55
  Requires-Dist: numpy<=1.16.6; python_version < "3" and extra == "elastic"
@@ -71,6 +73,7 @@ Provides-Extra: mysql
71
73
  Requires-Dist: PyMySQL; python_version < "3" and extra == "mysql"
72
74
  Requires-Dist: mysqlclient>=1.3.12; python_version >= "3" and extra == "mysql"
73
75
  Provides-Extra: nlcvapi
76
+ Requires-Dist: certifi; extra == "nlcvapi"
74
77
  Requires-Dist: pyOpenSSL<=18.0.0; python_version < "3" and extra == "nlcvapi"
75
78
  Requires-Dist: pyOpenSSL; python_version >= "3" and extra == "nlcvapi"
76
79
  Provides-Extra: postgres
@@ -87,12 +90,14 @@ Requires-Dist: slack-sdk; python_version >= "3" and extra == "slack"
87
90
  Provides-Extra: socketlog
88
91
  Provides-Extra: sqlite
89
92
  Provides-Extra: telegram
93
+ Requires-Dist: certifi; extra == "telegram"
90
94
  Provides-Extra: textlog
91
95
  Provides-Extra: xmpp
92
96
  Requires-Dist: xmpppy>=0.7.3; extra == "xmpp"
93
97
  Provides-Extra: all
94
98
  Requires-Dist: Automat<20; python_version < "3" and extra == "all"
95
99
  Requires-Dist: PyMySQL; python_version < "3" and extra == "all"
100
+ Requires-Dist: certifi; extra == "all"
96
101
  Requires-Dist: confluent-kafka; python_version >= "3" and extra == "all"
97
102
  Requires-Dist: confluent-kafka<1.0; python_version < "3" and extra == "all"
98
103
  Requires-Dist: couchdb; extra == "all"
@@ -3,10 +3,10 @@ LICENSE
3
3
  MANIFEST.in
4
4
  README.md
5
5
  honeypot.py
6
- setup.cfg
7
6
  setup.py
8
7
  core/__init__.py
9
8
  core/config.py
9
+ core/httpclient.py
10
10
  core/logfile.py
11
11
  core/output.py
12
12
  core/paths.py
@@ -15,6 +15,7 @@ service_identity
15
15
  twisted>=21
16
16
 
17
17
  [all]
18
+ certifi
18
19
  couchdb
19
20
  hpfeeds>=3.0.0
20
21
  looseversion
@@ -51,6 +52,7 @@ slack-sdk
51
52
  couchdb
52
53
 
53
54
  [datadog]
55
+ certifi
54
56
 
55
57
  [datadog:python_version < "3"]
56
58
  cryptography<=2.8
@@ -61,6 +63,7 @@ cryptography
61
63
  pyOpenSSL
62
64
 
63
65
  [discord]
66
+ certifi
64
67
 
65
68
  [elastic]
66
69
 
@@ -113,6 +116,7 @@ PyMySQL
113
116
  mysqlclient>=1.3.12
114
117
 
115
118
  [nlcvapi]
119
+ certifi
116
120
 
117
121
  [nlcvapi:python_version < "3"]
118
122
  pyOpenSSL<=18.0.0
@@ -148,6 +152,7 @@ slack-sdk
148
152
  [sqlite]
149
153
 
150
154
  [telegram]
155
+ certifi
151
156
 
152
157
  [textlog]
153
158
 
@@ -23,7 +23,7 @@ from twisted.internet.reactor import listenTCP, run
23
23
  from twisted.python.log import msg
24
24
  from twisted.web.server import Site
25
25
 
26
- __VERSION__ = '2.0.1-dev0'
26
+ __VERSION__ = '2.0.2'
27
27
  __description__ = 'Elasticsearch Honeypot'
28
28
  __license__ = 'GPLv3'
29
29
  __uri__ = 'https://gitlab.com/bontchev/elasticpot'
@@ -13,6 +13,7 @@ from twisted.python.log import msg
13
13
  class Output(output.Output):
14
14
 
15
15
  def start(self):
16
+ scheme = CONFIG.get('output_couch', 'scheme', fallback='http')
16
17
  host = CONFIG.get('output_couch', 'host', fallback='localhost')
17
18
  port = CONFIG.getint('output_couch', 'port', fallback=5984)
18
19
  username = CONFIG.get('output_couch', 'username', fallback='elasticpot', raw=True)
@@ -20,7 +21,10 @@ class Output(output.Output):
20
21
  db_name = CONFIG.get('output_couch', 'database', fallback='elasticpot')
21
22
 
22
23
  try:
23
- couchserver = Server('http://{}:{}@{}:{}'.format(username, password, host, port))
24
+ base_url = '{}://{}:{}'.format(scheme, host, port)
25
+ couchserver = Server(base_url)
26
+ if username:
27
+ couchserver.resource.credentials = (username, password)
24
28
 
25
29
  if db_name in couchserver:
26
30
  self.couch_db = couchserver[db_name]
@@ -10,18 +10,13 @@ from platform import node
10
10
 
11
11
  from core import output
12
12
  from core.config import CONFIG
13
+ from core.httpclient import create_http_agent
13
14
  from core.tools import to_bytes
14
15
 
15
16
  from twisted.internet import reactor
16
17
  from twisted.python.log import msg
17
18
  from twisted.web import client, http_headers
18
19
  from twisted.web.client import FileBodyProducer
19
- from twisted.internet.ssl import ClientContextFactory
20
-
21
-
22
- class WebClientContextFactory(ClientContextFactory):
23
- def getContext(self, hostname, port):
24
- return ClientContextFactory.getContext(self)
25
20
 
26
21
 
27
22
  class QuietHTTP11ClientFactory(client._HTTP11ClientFactory):
@@ -38,11 +33,12 @@ class Output(output.Output):
38
33
  self.ddtags = CONFIG.get('output_datadog', 'ddtags', fallback='env:dev')
39
34
  self.service = CONFIG.get('output_datadog', 'service', fallback='honeypot')
40
35
  self.hostname = CONFIG.get('output_datadog', 'hostname', fallback=node())
36
+ verify_tls = CONFIG.getboolean('output_datadog', 'verify_tls', fallback=True)
37
+ ca_certs = CONFIG.get('output_datadog', 'ca_certs', fallback=None)
41
38
 
42
- contextFactory = WebClientContextFactory()
43
39
  myQuietPool = client.HTTPConnectionPool(reactor)
44
40
  myQuietPool._factory = QuietHTTP11ClientFactory
45
- self.agent = client.Agent(reactor, contextFactory=contextFactory, pool=myQuietPool)
41
+ self.agent = create_http_agent(reactor, myQuietPool, 'output_datadog', verify_tls, ca_certs)
46
42
 
47
43
  def stop(self):
48
44
  pass
@@ -13,14 +13,13 @@ from time import gmtime, strftime, time
13
13
 
14
14
  from core import output
15
15
  from core.config import CONFIG
16
+ from core.httpclient import create_http_agent
16
17
  from core.tools import decode, to_bytes
17
18
 
18
19
  from twisted.internet import reactor
19
- from twisted.internet.ssl import ClientContextFactory
20
20
  from twisted.internet.task import deferLater
21
21
  from twisted.python.log import msg
22
22
  from twisted.web.client import (
23
- Agent,
24
23
  FileBodyProducer,
25
24
  HTTPConnectionPool,
26
25
  _HTTP11ClientFactory,
@@ -29,11 +28,6 @@ from twisted.web.client import (
29
28
  from twisted.web.http_headers import Headers
30
29
 
31
30
 
32
- class WebClientContextFactory(ClientContextFactory):
33
- def getContext(self, hostname, port):
34
- return ClientContextFactory.getContext(self)
35
-
36
-
37
31
  class QuietHTTP11ClientFactory(_HTTP11ClientFactory):
38
32
  noisy = False
39
33
 
@@ -43,10 +37,11 @@ class Output(output.Output):
43
37
  def start(self):
44
38
  self.url = to_bytes(CONFIG.get('output_discord', 'url'))
45
39
  self.delay = CONFIG.getfloat('output_discord', 'delay', fallback=2.0)
46
- contextFactory = WebClientContextFactory()
40
+ verify_tls = CONFIG.getboolean('output_discord', 'verify_tls', fallback=True)
41
+ ca_certs = CONFIG.get('output_discord', 'ca_certs', fallback=None)
47
42
  pool = HTTPConnectionPool(reactor)
48
43
  pool._factory = QuietHTTP11ClientFactory
49
- self.agent = Agent(reactor, contextFactory=contextFactory, pool=pool)
44
+ self.agent = create_http_agent(reactor, pool, 'output_discord', verify_tls, ca_certs)
50
45
  self.last_sent = 0
51
46
  self.requests_list = []
52
47
 
@@ -44,6 +44,8 @@ class Output(output.Output):
44
44
  kwargs['verify_certs'] = verify_certs
45
45
  if verify_certs and ca_certs:
46
46
  kwargs['ca_certs'] = ca_certs
47
+ elif not verify_certs:
48
+ msg('output_elastic: SSL is enabled but certificate verification is disabled.')
47
49
 
48
50
  # Create client
49
51
  self.es = Elasticsearch(hosts=hosts, **kwargs)
@@ -8,15 +8,14 @@ from json import dumps, loads
8
8
 
9
9
  from core import output
10
10
  from core.config import CONFIG
11
+ from core.httpclient import create_http_agent
11
12
  from core.tools import decode, geolocate, to_bytes
12
13
 
13
14
  from geoip2.database import Reader
14
15
 
15
16
  from twisted.internet import reactor
16
- from twisted.internet.ssl import ClientContextFactory
17
17
  from twisted.python.log import msg
18
18
  from twisted.web.client import (
19
- Agent,
20
19
  FileBodyProducer,
21
20
  HTTPConnectionPool,
22
21
  _HTTP11ClientFactory,
@@ -25,12 +24,6 @@ from twisted.web.client import (
25
24
  from twisted.web.http_headers import Headers
26
25
 
27
26
 
28
- class WebClientContextFactory(ClientContextFactory):
29
-
30
- def getContext(self, hostname, port):
31
- return ClientContextFactory.getContext(self)
32
-
33
-
34
27
  class QuietHTTP11ClientFactory(_HTTP11ClientFactory):
35
28
  noisy = False
36
29
 
@@ -40,10 +33,11 @@ class Output(output.Output):
40
33
  def start(self):
41
34
  self.host = CONFIG.get('output_nlcvapi', 'host', fallback='https://api.nlcv.bas.bg/v1.0/honeypot')
42
35
  self.geoip = CONFIG.getboolean('output_nlcvapi', 'geoip', fallback=True)
43
- contextFactory = WebClientContextFactory()
36
+ verify_tls = CONFIG.getboolean('output_nlcvapi', 'verify_tls', fallback=True)
37
+ ca_certs = CONFIG.get('output_nlcvapi', 'ca_certs', fallback=None)
44
38
  pool = HTTPConnectionPool(reactor)
45
39
  pool._factory = QuietHTTP11ClientFactory
46
- self.agent = Agent(reactor, contextFactory=contextFactory, pool=pool)
40
+ self.agent = create_http_agent(reactor, pool, 'output_nlcvapi', verify_tls, ca_certs)
47
41
 
48
42
  if self.geoip:
49
43
  geoipdb_city_path = CONFIG.get('output_nlcvapi', 'geoip_citydb', fallback='data/GeoLite2-City.mmdb')
@@ -10,6 +10,7 @@ from time import gmtime, strftime, time
10
10
 
11
11
  from core import output
12
12
  from core.config import CONFIG
13
+ from core.httpclient import create_http_agent
13
14
  from core.tools import decode, encode
14
15
 
15
16
  try:
@@ -18,11 +19,9 @@ except ImportError:
18
19
  from urllib.parse import quote_plus
19
20
 
20
21
  from twisted.internet import reactor
21
- from twisted.internet.ssl import ClientContextFactory
22
22
  from twisted.internet.task import deferLater
23
23
  from twisted.python.log import msg
24
24
  from twisted.web.client import (
25
- Agent,
26
25
  HTTPConnectionPool,
27
26
  _HTTP11ClientFactory,
28
27
  readBody
@@ -30,12 +29,6 @@ from twisted.web.client import (
30
29
  from twisted.web.http_headers import Headers
31
30
 
32
31
 
33
- class WebClientContextFactory(ClientContextFactory):
34
-
35
- def getContext(self, hostname, port):
36
- return ClientContextFactory.getContext(self)
37
-
38
-
39
32
  class QuietHTTP11ClientFactory(_HTTP11ClientFactory):
40
33
  noisy = False
41
34
 
@@ -49,11 +42,12 @@ class Output(output.Output):
49
42
  self.bot_token = CONFIG.get('output_telegram', 'bot_token')
50
43
  self.chat_id = CONFIG.get('output_telegram', 'chat_id')
51
44
  self.delay = CONFIG.getfloat('output_telegram', 'delay', fallback=2.0)
45
+ verify_tls = CONFIG.getboolean('output_telegram', 'verify_tls', fallback=True)
46
+ ca_certs = CONFIG.get('output_telegram', 'ca_certs', fallback=None)
52
47
 
53
- contextFactory = WebClientContextFactory()
54
48
  pool = HTTPConnectionPool(reactor)
55
49
  pool._factory = QuietHTTP11ClientFactory
56
- self.agent = Agent(reactor, contextFactory=contextFactory, pool=pool)
50
+ self.agent = create_http_agent(reactor, pool, 'output_telegram', verify_tls, ca_certs)
57
51
  self.last_sent = 0
58
52
  self.requests_list = []
59
53
 
@@ -70,8 +64,10 @@ class Output(output.Output):
70
64
  self._drain()
71
65
 
72
66
  def _drain(self):
73
- """Send the next queued message if the rate-limit window has elapsed.
74
- If messages remain, schedule another drain after self.delay seconds."""
67
+ """
68
+ Send the next queued message if the rate-limit window has elapsed.
69
+ If messages remain, schedule another drain after self.delay seconds.
70
+ """
75
71
  if not self.requests_list:
76
72
  return
77
73
  now = time()
@@ -52,7 +52,7 @@ if version_info[0] < 3:
52
52
 
53
53
  xmpp.simplexml.ustr = _ustr
54
54
  xmpp.transports.ustr = _ustr
55
- # xmpp.protocol also does 'from .simplexml import ustr' patch it too
55
+ # xmpp.protocol also does 'from .simplexml import ustr' - patch it too
56
56
  import xmpp.protocol as _xmpp_protocol
57
57
  if hasattr(_xmpp_protocol, 'ustr'):
58
58
  _xmpp_protocol.ustr = _ustr
@@ -1,6 +1,3 @@
1
- [bdist_wheel]
2
- universal = 1
3
-
4
1
  [egg_info]
5
2
  tag_build =
6
3
  tag_date = 0
@@ -166,12 +166,13 @@ def make_pypi_readme():
166
166
  extras={
167
167
  'couchdb': ['couchdb'],
168
168
  'datadog': [
169
+ 'certifi',
169
170
  'cryptography<=2.8 ; python_version < "3"',
170
171
  'pyOpenSSL<=18.0.0 ; python_version < "3"',
171
172
  'cryptography ; python_version >= "3"',
172
173
  'pyOpenSSL ; python_version >= "3"',
173
174
  ],
174
- 'discord': [],
175
+ 'discord': ['certifi'],
175
176
  'elastic': [
176
177
  'elasticsearch<=7.13 ; python_version < "3"',
177
178
  'numpy<=1.16.6 ; python_version < "3"',
@@ -199,6 +200,7 @@ extras={
199
200
  'mysqlclient>=1.3.12 ; python_version >= "3"',
200
201
  ],
201
202
  'nlcvapi': [
203
+ 'certifi',
202
204
  'pyOpenSSL<=18.0.0 ; python_version < "3"',
203
205
  'pyOpenSSL ; python_version >= "3"',
204
206
  ],
@@ -217,7 +219,7 @@ extras={
217
219
  ],
218
220
  'socketlog': [],
219
221
  'sqlite': [],
220
- 'telegram': [],
222
+ 'telegram': ['certifi'],
221
223
  'textlog': [],
222
224
  'xmpp': ['xmpppy>=0.7.3'],
223
225
  }
@@ -262,6 +264,11 @@ setup(
262
264
  'Topic :: Security',
263
265
  ],
264
266
  python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*',
267
+ options={
268
+ 'bdist_wheel': {
269
+ 'python_tag': 'py2.py3',
270
+ }
271
+ },
265
272
 
266
273
  # -------------------------------------------------------------------------
267
274
  # Installed packages:
File without changes
File without changes
File without changes