pgsqlpot 2.0.0__py2.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.
Files changed (61) hide show
  1. core/__init__.py +0 -0
  2. core/config.py +50 -0
  3. core/logfile.py +74 -0
  4. core/output.py +39 -0
  5. core/paths.py +53 -0
  6. core/protocol.py +161 -0
  7. core/tools.py +170 -0
  8. output_plugins/__init__.py +0 -0
  9. output_plugins/couch.py +68 -0
  10. output_plugins/datadog.py +74 -0
  11. output_plugins/discord.py +133 -0
  12. output_plugins/elastic.py +137 -0
  13. output_plugins/hpfeed.py +43 -0
  14. output_plugins/influx2.py +66 -0
  15. output_plugins/jsonlog.py +36 -0
  16. output_plugins/kafka.py +57 -0
  17. output_plugins/localsyslog.py +66 -0
  18. output_plugins/mongodb.py +83 -0
  19. output_plugins/mysql.py +210 -0
  20. output_plugins/nlcvapi.py +119 -0
  21. output_plugins/postgres.py +154 -0
  22. output_plugins/redisdb.py +47 -0
  23. output_plugins/rethinkdblog.py +46 -0
  24. output_plugins/slack.py +94 -0
  25. output_plugins/socketlog.py +40 -0
  26. output_plugins/sqlite.py +141 -0
  27. output_plugins/telegram.py +141 -0
  28. output_plugins/textlog.py +46 -0
  29. output_plugins/xmpp.py +193 -0
  30. pgsqlpot/__init__.py +25 -0
  31. pgsqlpot/cli.py +512 -0
  32. pgsqlpot/data/Dockerfile +56 -0
  33. pgsqlpot/data/docs/INSTALL.md +400 -0
  34. pgsqlpot/data/docs/INSTALLWIN.md +411 -0
  35. pgsqlpot/data/docs/PLUGINS.md +21 -0
  36. pgsqlpot/data/docs/TODO.md +8 -0
  37. pgsqlpot/data/docs/datadog/README.md +32 -0
  38. pgsqlpot/data/docs/discord/README.md +58 -0
  39. pgsqlpot/data/docs/geoipupdtask.ps1 +270 -0
  40. pgsqlpot/data/docs/mysql/README.md +176 -0
  41. pgsqlpot/data/docs/mysql/READMEWIN.md +157 -0
  42. pgsqlpot/data/docs/mysql/mysql.sql +85 -0
  43. pgsqlpot/data/docs/postgres/README.md +184 -0
  44. pgsqlpot/data/docs/postgres/READMEWIN.md +196 -0
  45. pgsqlpot/data/docs/postgres/postgres.sql +73 -0
  46. pgsqlpot/data/docs/slack/README.md +68 -0
  47. pgsqlpot/data/docs/sqlite3/README.md +131 -0
  48. pgsqlpot/data/docs/sqlite3/READMEWIN.md +123 -0
  49. pgsqlpot/data/docs/sqlite3/sqlite3.sql +69 -0
  50. pgsqlpot/data/docs/telegram/README.md +103 -0
  51. pgsqlpot/data/etc/honeypot.cfg +415 -0
  52. pgsqlpot/data/etc/honeypot.cfg.base +418 -0
  53. pgsqlpot/data/test/.gitignore +3 -0
  54. pgsqlpot/data/test/test.py +51 -0
  55. pgsqlpot/honeypot.py +117 -0
  56. pgsqlpot-2.0.0.dist-info/METADATA +152 -0
  57. pgsqlpot-2.0.0.dist-info/RECORD +61 -0
  58. pgsqlpot-2.0.0.dist-info/WHEEL +6 -0
  59. pgsqlpot-2.0.0.dist-info/entry_points.txt +2 -0
  60. pgsqlpot-2.0.0.dist-info/licenses/LICENSE +674 -0
  61. pgsqlpot-2.0.0.dist-info/top_level.txt +3 -0
@@ -0,0 +1,411 @@
1
+ # Installation guide (on Windows)
2
+
3
+ (For installation on Ubuntu, see the corresponding [installation document](INSTALL.md))
4
+
5
+ - [Installation guide (on Windows)](#installation-guide-on-windows)
6
+ - [Step 1: Install the dependencies](#step-1-install-the-dependencies)
7
+ - [Step 2: Open port 5432 for TCP traffic](#step-2-open-port-5432-for-tcp-traffic)
8
+ - [Step 3: Create a user account](#step-3-create-a-user-account)
9
+ - [Step 4: Install the honeypot](#step-4-install-the-honeypot)
10
+ - [Installing from PyPI (recommended)](#installing-from-pypi-recommended)
11
+ - [Installing from the repo](#installing-from-the-repo)
12
+ - [Step 5: Initialize the working directory](#step-5-initialize-the-working-directory)
13
+ - [Step 6: Create a configuration file](#step-6-create-a-configuration-file)
14
+ - [Step 7: Start the honeypot](#step-7-start-the-honeypot)
15
+ - [Step 8: Make the honeypot start at boot time](#step-8-make-the-honeypot-start-at-boot-time)
16
+ - [Configure additional output plugins (OPTIONAL)](#configure-additional-output-plugins-optional)
17
+ - [Docker usage (OPTIONAL)](#docker-usage-optional)
18
+ - [Command-line options](#command-line-options)
19
+ - [Upgrading the honeypot](#upgrading-the-honeypot)
20
+
21
+ ## Step 1: Install the dependencies
22
+
23
+ Log in as a user with Administrator privileges and install the following
24
+ programs (if they are not already present):
25
+
26
+ - **Python**. The latest version of Python 3.x is preferred, although the
27
+ honeypot is compatible with Python 2.7. You can download it from
28
+ [python.org](https://www.python.org/downloads/windows/). Download the
29
+ installer for your platform (64-bit or 32-bit). Make sure to install it
30
+ for all users and not just for the current one, and tick the option to
31
+ add Python to the `PATH` variable of the environment.
32
+
33
+ - **Database server** (optional). If you want the honeypot to send the data
34
+ it collects to a local database server (e.g., MySQL), make sure to install
35
+ it — again, for all users and not just for the current one.
36
+
37
+ - The latest version of the **VS C++ redistributable** (required by some of
38
+ the database output plugins, e.g., for MySQL). Version 14 or higher should
39
+ be fine. You can download it from
40
+ [there](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170).
41
+
42
+ ## Step 2: Open port 5432 for TCP traffic
43
+
44
+ If TCP port 5432 is not already opened for incoming connections on your
45
+ firewall and router, you must open it now. How exactly to do this from a NAT
46
+ router depends on the router model; please consult the instruction manual of
47
+ the router.
48
+
49
+ To open the port on the firewall, open a PowerShell window as Administrator
50
+ and use:
51
+
52
+ ```powershell
53
+ New-NetFirewallRule -DisplayName 'TCP-5432' -Profile @('Domain', 'Private') -Direction Inbound -Action Allow -Protocol TCP -LocalPort 5432
54
+ ```
55
+
56
+ ## Step 3: Create a user account
57
+
58
+ It is strongly recommended to run the honeypot as a dedicated user with no
59
+ administrative privileges (named `HoneyPotter` in our example):
60
+
61
+ ```powershell
62
+ Import-Module Microsoft.Powershell.LocalAccounts -SkipEditionCheck
63
+ $password = ConvertTo-SecureString "PASSWORD" -AsPlainText -Force
64
+ New-LocalUser -Name "HoneyPotter" -Password $password -FullName "HoneyPotter" -Description "Honeypots Account"
65
+ Add-LocalGroupMember -Group "Users" -Member "HoneyPotter"
66
+ ```
67
+
68
+ Make sure to specify a proper password for that user instead of "PASSWORD".
69
+
70
+ If you *really* need to be able to log in as this user over RDP, execute the
71
+ following line:
72
+
73
+ ```powershell
74
+ Add-LocalGroupMember -Group "Remote Desktop Users" -Member "HoneyPotter"
75
+ ```
76
+
77
+ However, this is *strongly* discouraged. RDP is a serious attack surface - if
78
+ you expose it to the Internet, you will be attacked immediately. Make sure the
79
+ user has a very strong and hard-to-guess password, and preferably put some
80
+ restriction on who can connect via RDP to this machine - e.g., by putting it
81
+ behind a VPN, a Secure Gateway (if the machine is on an Active Directory
82
+ network; something which is itself discouraged), or use a firewall rule to
83
+ specify which particular IP addresses are allowed to connect to this machine via
84
+ RDP - something along the lines of
85
+
86
+ ```powershell
87
+ # List on the next line the IP addreses permitted to connect to this machine
88
+ $AllowedIPs = @("IP address 1","IP address 2",...)
89
+ Get-NetFirewallRule -DisplayGroup "Remote Desktop" | Disable-NetFirewallRule
90
+ Get-NetFirewallRule -DisplayName "Restricted RDP" -ErrorAction SilentlyContinue | Remove-NetFirewallRule
91
+ New-NetFirewallRule -DisplayName "Restricted RDP" -Direction Inbound -Protocol TCP -LocalPort 3389 -Action Allow -RemoteAddress $AllowedIPs -Profile Any
92
+ ```
93
+
94
+ Log out of the Administrator account and log into the account of the newly
95
+ created user HoneyPotter.
96
+
97
+ ## Step 4: Install the honeypot
98
+
99
+ Open a PowerShell window and create a virtual environment. For modern versions
100
+ of Python (i.e., 3.6+), use just
101
+
102
+ ```powershell
103
+ PS C:\> python -m venv C:\pgsqlpot-env
104
+ ```
105
+
106
+ For the obsolete Python 2.7, use
107
+
108
+ ```powershell
109
+ PS C:\> pip install "virtualenv==20.15.1"
110
+ PS C:\> virtualenv pgsqlpot-env
111
+ ```
112
+
113
+ Then activate the virtual environment with
114
+
115
+ ```powershell
116
+ PS C:\> .\pgsqlpot-env\Scripts\activate.ps1
117
+ ```
118
+
119
+ and update `pip`
120
+
121
+ ```powershell
122
+ (pgsqlpot-env) PS C:\> python -m pip install pip --upgrade
123
+ ```
124
+
125
+ How you should proceed further depends on whether you want to install the
126
+ honeypot from the repo (usually done for testing purposes) or from PyPI
127
+ (the recommended approach).
128
+
129
+ ### Installing from PyPI (recommended)
130
+
131
+ Installing from PyPI is very simple. Just use
132
+
133
+ ```powershell
134
+ (pgsqlpot-env) PS C:\> pip install --prefer-binary pgsqlpot[plugin_list]
135
+ ```
136
+
137
+ Here, `plugin_list` is a comma-separated list of output plugin names whose
138
+ dependencies you want to install. You do not need to install the dependencies
139
+ for all existing plugins. For instance, if you plan to use only the `mysql`
140
+ and `redisdb` plugins, use `[mysql,redisdb]`. If you want to install the
141
+ dependencies for all plugins, use `[all]`.
142
+
143
+ The output plugins `discord`, `jsonlog`, `localsyslog`, `socketlog`, `sqlite`,
144
+ `telegram`, and `textlog` have no dependencies of their own. If you plan to use
145
+ only one or more of those, omit the `[plugin_list]` part entirely. It won't hurt
146
+ to specify such a plugin (e.g., `[mysql,jsonlog]`) but this is essentially
147
+ equivalent to omitting it.
148
+
149
+ If, after installation, you decide that you're going to use yet another plugin,
150
+ simply run the installation command again with the new plugin included in the
151
+ `plugin_list`
152
+
153
+ ### Installing from the repo
154
+
155
+ Ensure that the `build` module is installed, clone the repo, build the
156
+ distribution wheel, and install from it:
157
+
158
+ ```powershell
159
+ (pgsqlpot-env) PS C:\> pip install build --upgrade
160
+ (pgsqlpot-env) PS C:\> git clone https://gitlab.com/bontchev/pgsqlpot.git
161
+ (pgsqlpot-env) PS C:\> cd .\pgsqlpot
162
+ (pgsqlpot-env) PS C:\pgsqlpot> python -m build
163
+ (pgsqlpot-env) PS C:\pgsqlpot> pip install --prefer-binary "$((Get-Item dist\pgsqlpot-*-py2.py3-none-any.whl).FullName)[plugin_list]"
164
+ ```
165
+
166
+ where `plugin_list` is as described in the previous section.
167
+
168
+ ## Step 5: Initialize the working directory
169
+
170
+ Create a directory where the honeypot will store its configuration, data,
171
+ documentation, and logs, then initialize it:
172
+
173
+ ```powershell
174
+ (pgsqlpot-env) PS C:\> mkdir .\pgsqlpot-workdir
175
+ (pgsqlpot-env) PS C:\> cd .\pgsqlpot-workdir
176
+ (pgsqlpot-env) PS C:\pgsqlpot-workdir> pgsqlpot init
177
+ ```
178
+
179
+ This creates the `data/`, `docs/`, `etc/`, and `log/` subdirectories. It also
180
+ copies the files `test.py` (for verifying the honeypot is working), `Dockerfile`,
181
+ and `geoipupdtask.ps1` (for scheduling automatic GeoIP database updates) into
182
+ the working directory.
183
+
184
+ ## Step 6: Create a configuration file
185
+
186
+ The configuration for the honeypot is stored in `etc\honeypot.cfg.base` and
187
+ `etc\honeypot.cfg`. Both the `*.cfg.base` and the `*.cfg` files are read on
188
+ startup but entries from the `*.cfg` files take precedence. The `*.base` files
189
+ contain the default settings and should not be edited — they may be overwritten
190
+ by future updates. All your customisations should go into the `*.cfg` files.
191
+
192
+ To run with a standard configuration there is no need to change anything.
193
+
194
+ For instance, in order to enable JSON logging, create `etc\honeypot.cfg` file
195
+ and put in it only the following:
196
+
197
+ ```ini
198
+ [output_jsonlog]
199
+ enabled = true
200
+ logfile = log/pgsqlpot.json
201
+ epoch_timestamp = true
202
+ ```
203
+
204
+ For more information about how to configure additional output plugins, please
205
+ consult the appropriate `READMEWIN.md` file in the subdirectory corresponding
206
+ to the plugin inside the `docs\` directory.
207
+
208
+ **Note on testing:** The default blacklist excludes the logging of connections
209
+ from `127.0.0.1` and `192.168.0.0/16`. If you run just `test.py` (with no
210
+ arguments) from the same machine as the honeypot, you will not see any log
211
+ output because the connection will not be logged. Either run `test.py` with the
212
+ option `-H <your-external-IP>`, or temporarily clear the blacklist in
213
+ `etc\honeypot.cfg`:
214
+
215
+ ```ini
216
+ [honeypot]
217
+ blacklist =
218
+ ```
219
+
220
+ ## Step 7: Start the honeypot
221
+
222
+ From the working directory, with the virtual environment active:
223
+
224
+ ```powershell
225
+ (pgsqlpot-env) PS C:\> cd C:\pgsqlpot-workdir
226
+ (pgsqlpot-env) PS C:\pgsqlpot-workdir> pgsqlpot start
227
+ (pgsqlpot-env) PS C:\pgsqlpot-workdir> pgsqlpot status
228
+ The honeypot is running (PID: 12345).
229
+ ```
230
+
231
+ To run in the foreground (useful for debugging):
232
+
233
+ ```powershell
234
+ (pgsqlpot-env) PS C:\pgsqlpot-workdir> pgsqlpot run
235
+ ```
236
+
237
+ Stop it by pressing Ctrl-C.
238
+
239
+ To stop the honeypot when it is running in the background, use
240
+
241
+ ```powershell
242
+ (pgsqlpot-env) PS C:\pgsqlpot-workdir> pgsqlpot stop
243
+ Stopping honeypot (PID 12345)... Stopped.
244
+ ```
245
+
246
+ To verify that the honeypot is working correctly, run the test script (see
247
+ the note about the blacklist above):
248
+
249
+ ```powershell
250
+ (pgsqlpot-env) PS C:\pgsqlpot-workdir> python test.py -u Foo -p Bar -H $(Invoke-RestMethod -Uri "http://api.ipify.org")
251
+ ```
252
+
253
+ It should print a message like this:
254
+
255
+ ```test.py
256
+ Error: connection to server at "123.123.123.123", port 5432 failed: FATAL: password authentication failed for user "Foo"
257
+ ```
258
+
259
+ where instead of `123.123.123.123` you'll see your external IP address.
260
+
261
+ ## Step 8: Make the honeypot start at boot time
262
+
263
+ To create a task that starts the honeypot at boot time, open a PowerShell
264
+ window as `Administrator` and enter:
265
+
266
+ ```powershell
267
+ $Trigger = New-ScheduledTaskTrigger -AtStartup
268
+ $Action = New-ScheduledTaskAction -Execute "C:\pgsqlpot-env\Scripts\pgsqlpot.exe" -Argument "start" -WorkingDirectory "C:\pgsqlpot-workdir"
269
+ $Settings = New-ScheduledTaskSettingsSet -Hidden -Compatibility Win8
270
+ Register-ScheduledTask -Action $Action -TaskName "PGSQLPpot" -Trigger $Trigger -Settings $Settings -User "HoneyPotter" -Password "PASSWORD"
271
+ ```
272
+
273
+ Make sure to supply the password for the user `HoneyPotter` instead of
274
+ "PASSWORD", and adjust the paths if you used different locations.
275
+
276
+ In order for the user `HoneyPotter` to be able to run tasks at startup, though,
277
+ he must have the `SeBatchLogonRight` right - which, by default, he does not.
278
+ Unfortunately, there is no way to give him this right via pure PowerShell, so
279
+ you'll have to do it from the GUI.
280
+
281
+ Log in as Administrator, if not already logged in as such, open the `Start` menu
282
+ and in the search field enter `secpol.msc` and press Enter. This will start the
283
+ Local Security Policy editor. Find
284
+ `Local Policies -> User Rights Assignment -> Log on as a batch job` and
285
+ double-click it. Press `Add User or Group` enter the user name `HoneyPotter`
286
+ and press the two `OK` buttons to close the dialogs.
287
+
288
+ ## Configure additional output plugins (OPTIONAL)
289
+
290
+ The honeypot automatically outputs event data as text to stdout (or to a log
291
+ file, if configured). Additional output plugins can be configured to record
292
+ the data in other ways. Supported output plugins currently include:
293
+
294
+ Destination|Plugin Name
295
+ ---|---
296
+ CouchDB|couch
297
+ [Datadog](datadog/README.md)|datadog
298
+ [Discord](discord/README.md)|discord
299
+ Elasticsearch|elastic
300
+ HPFeeds|hpfeed
301
+ InfluxDB 2.0|influx2
302
+ JSON|jsonlog
303
+ Kafka|kafka
304
+ MongoDB|mongodb
305
+ [MySQL](mysql/READMEWIN.md)|mysql
306
+ NLCV API|nlcvapi
307
+ [PostgreSQL](postgres/READMEWIN.md)|postgres
308
+ Redis|redisdb
309
+ RethinkDB|rethinkdblog
310
+ [Slack](slack/README.md)|slack
311
+ Socket|socketlog
312
+ [SQLite3](sqlite3/READMEWIN.md)|sqlite
313
+ Syslog|localsyslog
314
+ [Telegram](telegram/README.md)|telegram
315
+ Text|textlog
316
+ XMPP|xmpp
317
+
318
+ More plugins are likely to be added in the future.
319
+
320
+ See `docs\[plugin]\READMEWIN.md` for details on each plugin or click on the
321
+ names in the above table that are clickable.
322
+
323
+ **Note:** The `influx2` plugin requires Python 3.x and cannot be used with
324
+ Python 2.7. The `localsyslog` plugin works only on Linux.
325
+
326
+ ## Docker usage (OPTIONAL)
327
+
328
+ Log in as the user `HoneyPotter`, open a PowerShell window, activate the
329
+ virtual environment, get the honeypot version number, deactivate the virtual
330
+ environment, and build the Docker image from the working directory (the
331
+ `Dockerfile` was placed there by `pgsqlpot init`):
332
+
333
+ ```powershell
334
+ PS C:\> cd C:\pgsqlpot-workdir
335
+ PS C:\pgsqlpot-workdir> .\pgsqlpot-env\scripts\activate.ps1
336
+ (pgsqlpot-env) PS C:\pgsqlpot-workdir> $version = pgsqlpot --version
337
+ (pgsqlpot-env) PS C:\pgsqlpot-workdir> deactivate
338
+
339
+ # Build with all plugins (default)
340
+ PS C:\pgsqlpot-workdir> docker build --build-arg VERSION=$version -t pgsqlpot .
341
+
342
+ # Or build with specific plugins only (e.g., only mysql and kafka)
343
+ PS C:\pgsqlpot-workdir> docker build --build-arg VERSION=$version --build-arg PLUGINS=mysql,kafka -t pgsqlpot .
344
+
345
+ # Run, mounting your config and data directories
346
+ PS C:\pgsqlpot-workdir> docker run -d -p 5432:5432/tcp `
347
+ -v ${PWD}\etc\honeypot.cfg:/pgsqlpot/etc/honeypot.cfg `
348
+ -v ${PWD}\data:/pgsqlpot/data `
349
+ pgsqlpot
350
+ ```
351
+
352
+ ## Command-line options
353
+
354
+ The honeypot supports the following command-line options:
355
+
356
+ ```bash
357
+ -h, --help show this help message and exit
358
+ -v, --version show program's version number and exit
359
+ -w WORKDIR, --workdir WORKDIR
360
+ Working directory (overrides PGSLQPOT_WORKDIR and cwd)
361
+ ```
362
+
363
+ It also supports the following subcommands:
364
+
365
+ ```bash
366
+ init Scaffold a working directory
367
+ run Start the honeypot in the foreground
368
+ start Start the honeypot in the background
369
+ stop Stop the backgrounded honeypot
370
+ restart Restart (stop and start) the honeypot in the background
371
+ status Show running status
372
+ ```
373
+
374
+ All subcommands accept `-w / --workdir DIR` to specify the working directory
375
+ explicitly, overriding the `PGSLQPOT_WORKDIR` environment variable and the
376
+ current directory.
377
+
378
+ The `run`, `start`, and `restart` subcommands also accept the options
379
+
380
+ ```bash
381
+ -h, --help show this help message and exit
382
+ -p PORT, --port PORT Port to listen on (default: 5432)
383
+ -l LOGFILE, --logfile LOGFILE
384
+ Log file (default: stdout)
385
+ -s SENSOR, --sensor SENSOR
386
+ Sensor name (default: hostname)
387
+ ```
388
+
389
+ Settings specified via command-line options take precedence over the
390
+ corresponding settings in the configuration files.
391
+
392
+ ## Upgrading the honeypot
393
+
394
+ Stop the honeypot, upgrade the package, re-initialize (to pick up any new
395
+ default config or response files), and restart:
396
+
397
+ ```powershell
398
+ PS C:\> cd C:\pgsqlpot-workdir
399
+ PS C:\pgsqlpot-workdir> C:\pgsqlpot-env\Scripts\activate.ps1
400
+ (pgsqlpot-env) PS C:\pgsqlpot-workdir> pgsqlpot stop
401
+ (pgsqlpot-env) PS C:\pgsqlpot-workdir> pip install --prefer-binary --upgrade pgsqlpot[plugin_list]
402
+ (pgsqlpot-env) PS C:\pgsqlpot-workdir> pgsqlpot init
403
+ (pgsqlpot-env) PS C:\pgsqlpot-workdir> pgsqlpot start
404
+ ```
405
+
406
+ where `[plugin_list]` is as explained above.
407
+
408
+ Note that `pgsqlpot init` is safe to re-run — it never overwrites files that
409
+ you have already edited or created (such as `etc\honeypot.cfg`). It only
410
+ copies files that are missing, so any new defaults added by an upgrade are
411
+ picked up automatically.
@@ -0,0 +1,21 @@
1
+ # Creating output plugins for the honeypot
2
+
3
+ To create additional output plugins, place Python modules in this directory.
4
+
5
+ The plugins need to subclass the class `core.output.Output` and to define at
6
+ least the methods `start`, `stop` and `write`:
7
+
8
+ ```python
9
+ from core import output
10
+
11
+ class Output(output.Output):
12
+
13
+ def start(self):
14
+ pass
15
+
16
+ def stop(self):
17
+ pass
18
+
19
+ def write(self, event):
20
+ pass
21
+ ```
@@ -0,0 +1,8 @@
1
+ # Planned Future Improvements
2
+
3
+ * Additional output plugins for:
4
+ * DShield
5
+ * Graylog
6
+ * InfluxDB
7
+ * Oracle Cloud
8
+ * Splunk
@@ -0,0 +1,32 @@
1
+ # Sending the Output of the Honeypot to a Datadog Log Management Account
2
+
3
+ This guide describes how to configure and send cowrie outputs to Datadog Log Management.
4
+
5
+ - [Sending the Output of the Honeypot to a Datadog Log Management Account](#sending-the-output-of-the-honeypot-to-a-datadog-log-management-account)
6
+ - [Prerequisites](#prerequisites)
7
+ - [Configuration of the Datadog output module](#configuration-of-the-datadog-output-module)
8
+ - [Datadog Configuration](#datadog-configuration)
9
+
10
+ ## Prerequisites
11
+
12
+ - Working honeypot installation
13
+ - Existing Datadog account.
14
+
15
+ ## Configuration of the Datadog output module
16
+
17
+ - Modify the file `etc/honeypot.cfg` and uncomment the `[output_datadog]` section.
18
+ - Set the `url` variable to `https://http-intake.logs.datadoghq.eu/api/v2/logs`, if
19
+ you're in the EU - or to `https://http-intake.logs.datadoghq.com/api/v2/logs`, if
20
+ you reside elsewhere.
21
+ - Add an API Key. You may generate one for your organisation
22
+ [from here](https://app.datadoghq.eu/organization-settings/api-keys), if you're
23
+ in the EU, or [from here](https://app.datadoghq.eu/organization-settings/api-keys),
24
+ if you reside elsewhere.
25
+ - Optionally customize the variables `ddsource`, `ddtags`, `service` and `hostname`.
26
+ Otherwise, the defaults are respectively `pgsqlpot`, `env:prod`, `honeypot` and the
27
+ hostname of the machine, running the honeypot.
28
+ - Set the variable `enabled` to `true`.
29
+
30
+ ## Datadog Configuration
31
+
32
+ JSON logs are handled without further configuration in Datadog.
@@ -0,0 +1,58 @@
1
+ # Sending the output of the honeypot to a Discord channel
2
+
3
+ This guide describes how to send the reports from the honeypot to a Discord
4
+ channel.
5
+
6
+ - [Sending the output of the honeypot to a Discord channel](#sending-the-output-of-the-honeypot-to-a-discord-channel)
7
+ - [Prerequisites](#prerequisites)
8
+ - [Select your Discord server](#select-your-discord-server)
9
+ - [Create a channel for the honeypot's reports](#create-a-channel-for-the-honeypots-reports)
10
+ - [Configure the honeypot](#configure-the-honeypot)
11
+
12
+ ## Prerequisites
13
+
14
+ - Working honeypot installation
15
+ - A Discord account
16
+
17
+ ## Select your Discord server
18
+
19
+ - Log into your Discord account
20
+ - If you don't have your own server yet, create one by cling the "+" icon on
21
+ the bar on the left. The newly created server will appear on that bar.
22
+ - Select your server by clicking its icon on the bar on the left.
23
+
24
+ ## Create a channel for the honeypot's reports
25
+
26
+ - On the leftmost column of the page (to the right of the bar where the
27
+ server's icon is), select the "+" sign in the "Text Channels" section.
28
+ - Give the channel a name suggesting that the honeypot's reports will
29
+ appear there - e.g., `pgsqlpot`. The channel will appear in the "Text
30
+ Channels" section.
31
+ - Click the channel's name and select the gear icon to open the "Edit
32
+ Channel" dialog.
33
+ - Click "Integrations" on the left, in order to switch to the channel's
34
+ integrations page.
35
+ - Click on the "Webhooks" button and then on "New Webhook". By default, the
36
+ new webhook will be named "Captain Hook".
37
+ - Click the newly created webhook to change is properties. You can change
38
+ its name to something more meaningful, like `PGSQLPot` - it will be the name
39
+ of the "user" posting to the channel.
40
+ - While the webhook's properties are still open, click on the "Copy Webhook
41
+ URL" button. This will copy the URL that you need to put in the honeypot's
42
+ configuration section for Discord.
43
+ - Press Esc to close the editor of the channel's properties. You can leave
44
+ Discord now.
45
+
46
+ ## Configure the honeypot
47
+
48
+ - Stop the honeypot, if it is running.
49
+ - Open the file `etc/honeypot.cfg` and uncomment the `[output_discord]`
50
+ section in it.
51
+ - Set the variable `url` webhook URL that you have obtained in the previous
52
+ section.
53
+ - Optionally, set the variable `delay` to something different than the default
54
+ value of `2.0`. This is the delay, in seconds, between any two messages sent
55
+ to the bot. Note that if this number is smaller than `1.0`, DIscord's rate
56
+ limiting will cause it to return `429 Too many requests` errors.
57
+ - Set the variable `enabled` to `true`.
58
+ - Launch the honeypot.