Commit Graph

209 Commits

Author SHA1 Message Date
Ryan Smith
da42f21f75 refactor: move cert generator to separate package 2025-04-16 07:43:15 -07:00
Ryan Smith
0a4d4536ba chore: revise error strings and comments 2025-04-16 07:35:58 -07:00
Ryan Smith
148d99876f build: update modules 2025-04-16 07:24:18 -07:00
Ryan Smith
90fbc24479 feat: controlled error responses for HTTP honeypot
Add `withCustomError` middleware that intercepts HTTP error responses and replaces them with a custom error response.

This is used when the HTTP honeypot is configured to serve content from a directory. It ensures that all error responses from http.FileServerFS are controlled and predicatable.
2025-04-15 14:44:26 -07:00
Ryan Smith
60fe095dff feat: disable directory listings when serving custom content
Add noDirectoryFS wrapper to disable directory listings from http.FileServerFS. This is used when the HTTP honeypot is configured to serve custom content from a specified directory.
2025-04-15 14:39:07 -07:00
Ryan Smith
40dbc05d6f feat: serve content from a directory in HTTP honeypot
Add support for serving static files from a directory specified via the existing `homePagePath` setting. When this setting points to a directory, the honeypot serves files rooted at that directory. The original behavior of serving a single file is still supported.

When serving from a directory, the honeypot may serve files from the directory root and from any subdirectories. Symbolic links are followed, provided they don't lead outside the specified root directory.

Main changes:
- Add `responseMode` type to represent how the honeypot serves content (built-in default, specific file, files from a directory).
- Add `responseConfig` struct to store the responseMode and related configuration.
- Add `determineConfig` function to construct a responseConfig when the honeypot starts.
- Update the honeypot request handler to serve content based on the response mode.
- Add `serveErrorPage` function to serve error responses as needed.
2025-04-15 12:48:58 -07:00
Ryan Smith
9e14d3886a Merge pull request #1 from eltociear/patch-1
docs: update README.md
2025-04-10 07:10:47 -07:00
Ikko Eltociear Ashimine
abaa098099 docs: update README.md
honeyot  -> honeypot
2025-04-10 14:51:00 +09:00
Ryan Smith
62b166c62a Update README.md
Update threat feed example output to show 'observations' count rather than 'threat_score'. The threat score feature was replaced with observation count in a previous change.
2025-04-08 11:10:18 -07:00
Ryan Smith
53fd03cd46 Revise screenshot 2025-04-08 10:37:21 -07:00
Ryan Smith
a1dfb7f648 threatfeed: Pre-parse and cache html templates
This change pre-parses all html templates from the `templates` directory and stores the results globally. With this change, http handlers no longer need to re-parse templates on every request.
v0.62.0
2025-04-07 16:57:09 -07:00
Ryan Smith
540b0b940c threatfeed: Add honeypot log data statistics
This change adds the ability to view various statistics for honeypot log data. This includes views such as unique SSH usernames, unique HTTP paths, unique HTTP host headers, etc.

A new `/logs/{logtype}/{subtype}` route is added for rendering stats.
2025-04-07 16:40:18 -07:00
Ryan Smith
7bc73f6695 threatfeed: move nav bar to dedicated template
This change moves the nav bar for the threat feed web interface to a dedicated template defined in `nav.html`. HTTP handlers and existing HTML templates are updated to utilize the new template.
2025-04-06 22:44:27 -07:00
Ryan Smith
d0f046593e theatfeed: tooltips in live feed + style updates
This change adds tooltips to the live logs for HTTP log data. Hovering over an HTTP even reveals the full HTTP request details.

Updated style.css to support the new tooltips.

Other changes:
- Minor color changes applied to the web feed.
- Minor text revisions in `home.html` and `docs.html`.
2025-04-06 20:15:54 -07:00
Ryan Smith
444a446b0f webfeed: format dates and numbers via javascript
This change adjusts the webfeed.html template to return timestamps in ISO 8601 format in UTC and instead uses JavaScript to format and display using the user's local time.

JavaScript is also used to add a thousands seprator to values in the 'Observations' column.

When formatting the 'Added' column, the time is dropped and now displays as YYYY-MM-DD.
2025-04-06 14:55:18 -07:00
Ryan Smith
0462ed7b4c Explicitly ignore errors in WS handlers 2025-04-05 14:27:00 -07:00
Ryan Smith
ecbe1d4972 Append -dirty or -broken tag to version if local changes found 2025-04-05 14:26:10 -07:00
Ryan Smith
4eebe8029f Revise screenshots 2025-04-04 14:51:40 -07:00
Ryan Smith
0e66c52a16 Update README.md 2025-04-04 09:32:54 -07:00
Ryan Smith
7334aac745 Update screenshots 2025-04-04 08:30:35 -07:00
Ryan Smith
fd60dc89eb Add ability to monitor honeypot logs in realtime via WebSockets
This change adds support for WebSockets using Google's WebSocket package.

When the threat feed server is starting, a Go function is created to monitor honeypot log data via a channel. When log data is received on the channel, it is broadcast to all connected WebSocket clients.

A /live endpoint and handler is added for serving the live.html template. This page displays the log data in real time by utilizing WebSockets.

Updated the nav bar on all html pages to include the new 'Live' icon for accessing the realtime log.
v0.61.0
2025-04-03 14:07:50 -07:00
Ryan Smith
35c0eb06f8 Move log-related handlers to separate file 2025-04-03 10:52:05 -07:00
Ryan Smith
d3f7cb4e86 Add logmonitor to configuration 2025-03-31 08:59:49 -07:00
Ryan Smith
c3ca87c7af Add logmonitor package for monitoring writes to log files
The Monitor type is an io.Writer that sends data to a channel. It is meant for use with the honeypot logging system. This will allow the threat feed to provide real-time monitoring of the logging system while simultaneously logging the data to disk.
2025-03-29 12:18:05 -07:00
Ryan Smith
6ba9f0acf5 Add ability to view the running configuration
This change adds a /config handler for displaying the Deceptifeed configuration. An icon is added to the nav bar for accessing the page.

- Add config.html template for displaying the Deceptifeed configuration.
- Add config.html supporting styles to style.css.
- Add /config http handler to render the config.html template.
- Add icon to nav bar for accessing /config page.
2025-03-27 13:26:52 -07:00
Ryan Smith
94dce2c13a Revise styles 2025-03-27 10:03:47 -07:00
Ryan Smith
4fd048c287 Remove feature for custom threat file
This change removes the `CustomThreatsPath` setting from the threat feed configuration. The default configuration files are updated with this setting removed.
2025-03-26 18:23:37 -07:00
Ryan Smith
7bad11a4a7 Allow comments in exclude list
This change allows for comments in the exclude list using the `#` symbol. The `#` symbol on a line and everything after it is ignored when parsing the exclude list.
2025-03-26 18:17:31 -07:00
Ryan Smith
30c3095541 Remove v prefix from version tag 2025-03-26 18:13:18 -07:00
Ryan Smith
920759db70 Explicitly disable threat feed for UDP honeypots
This change explicitly disables the threat feed for UDP honeypots in the configuration. The UDP honeypot server does not implement the threat feed.
2025-03-24 11:17:05 -07:00
Ryan Smith
7dc7b1ee83 Add setting and getting version information
- Add `Version` string var to config package for storing version information.
- Update Makefile to set the `Version` variable at build time using the latest Git tag.
- Add `-version` flag to main package to print version information and exit.
- Remove setting the GO111MODULE environment variable from Makefile when building. It's not needed.
2025-03-22 08:56:10 -07:00
Ryan Smith
f6cd4c783e Change nav bar names and icons
This change renames `Web Feed` to `Threats` and `Honeypot Logs` to `Logs` in the navigation bar.

Apply visual tweaks to the nav bar.
2025-03-20 16:34:48 -07:00
Ryan Smith
4cf8d15402 Add FilePath field to Config struct
The FilePath field stores the absolute path to the running configuration file and is set while the configuration file is initially loading.
2025-03-20 09:44:40 -07:00
Ryan Smith
f5d6f9f78b Sort server configuration by port number
This change sorts the honeypot server configuration by port number during application initialization.

This is purely cosmetic and intended for a planned config viewer feature.
2025-03-20 09:39:07 -07:00
Ryan Smith
60ab753c42 Remove threat score feature, replace with observation count
This change removes the 'threat score' feature which allowed users to configure each honeypot server with a variable 'score' when updating the threat feed.

It is replaced with a fixed observation count that is incremented by 1 for each honeypot interaction.

The field `threat_score` has been replaced with `observations` in all API call parameters and threat feed data.

The `threat_score` field in the CSV file has been renamed to `observations`. Existing threat feed CSV files will be automatically updated on the next threat feed save.
2025-03-20 09:20:15 -07:00
Ryan Smith
b23e9b4a9e Remove minimum threat score feature and settings 2025-03-19 20:50:21 -07:00
Ryan Smith
f72cf4ddba Use centralized stylesheet
This change removes the CSS sections from HTML templates and switches to using a single stylesheet at /css/style.css.
2025-03-19 19:55:14 -07:00
Ryan Smith
d50bce3fbf Explicitly set default SSH banner
This change explicitly sets the default SSH banner in the running configuration when the application starts.

If starting without a configuration file, the global default banner is always used.

If starting with a configuration file, the global default banner is used when no banner is specified.
2025-03-19 19:36:59 -07:00
Ryan Smith
5b7618ad5e Fix log path not set when using CLI flags
This resolves a bug introduced in commit bc7fcef4b5 which resulted in log paths not being set when the app was launched without a configuration file.

This change corrects the problem by explicitly setting the log path for each honeypot server when no configuration file is provided.
2025-03-18 11:39:24 -07:00
Ryan Smith
764188cf2b Require private IP when accessing log data 2025-03-18 09:40:58 -07:00
Ryan Smith
00b747341b Display message when feed/logs are empty
Adjust the html templates for web feed and log viewers to check if there's any data to display. If no data, a message is shown informing the user that there's no data.
2025-03-18 07:36:01 -07:00
Ryan Smith
97cddb8cfe Ensure log files are read in a consistent order
Use a slice instead of a map to track unique paths to ensure log files are read in the correct order.
2025-03-18 07:26:27 -07:00
Ryan Smith
9384834da1 Remove click effect on logo in nav bar v0.44.0 2025-03-17 19:56:10 -07:00
Ryan Smith
0e0a18e1f1 Adjust Makefile to strip debug info and add architectures
- Strip debug information to reduce binary size, using `-ldflags="-s -w"`.
- Remove file system paths from the build environment in the resulting binary, using `-trimpath`.
- Add targets to build for Linux, FreeBSD, and Windows.
2025-03-17 17:43:36 -07:00
Ryan Smith
115efa5b69 Change output directory to ./bin when compiling
Previously, binaries were compiled to ./out.
2025-03-17 16:14:33 -07:00
Ryan Smith
5dc1a6d91c Change output directory to ./bin when compiling
Previously, binaries were compiled to ./out.
2025-03-17 15:54:14 -07:00
Ryan Smith
0d09a59d3c Explicitly ignore errors from rand.Read
The error is ignored because rand.Read is guranteed to never return an error.
2025-03-17 14:55:06 -07:00
Ryan Smith
86eb9b773a Update dependencies 2025-03-17 14:26:04 -07:00
Ryan Smith
182262d474 Add ability to view honeypot logs from the threat feed server 2025-03-17 14:08:13 -07:00
Ryan Smith
bc7fcef4b5 Refactor log path initialization
Previously:
When no log path was specified for a server, it would fall back to the global/default log path during logger initialization. However, the `LogPath` field didn't update and would not reflect the actual path used by the logger.

Now:
Log path determination is handled while the configuration is loading. If a server falls back to the default log path, the `LogPath` field is updated to reflect the actual path used by the logger.
2025-03-17 13:25:09 -07:00