Update miniprint integration for upstream next logs#18
Open
t3chn0m4g3 wants to merge 1 commit into
Open
Conversation
Align honeypots/miniprint.py with the new JSONL format from the t3chn0m4g3/miniprint next branch: https://github.com/t3chn0m4g3/miniprint/tree/next Aggregate alerts by session_id, preserve HTTP/PJL metadata, use real source ports, summarize repeated raw print append events, and attach saved print artifacts from malwaredir with legacy uploaddir fallback. Switch MINIPRINT config examples from uploaddir to malwaredir and add unit coverage for HTTP probes, PJL commands, saved artifacts, missing artifacts, and append aggregation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@trixam @elivlo - Please review and test
Align honeypots/miniprint.py with the new JSONL format from the t3chn0m4g3/miniprint next branch:
https://github.com/t3chn0m4g3/miniprint/tree/next
Aggregate alerts by session_id, preserve HTTP/PJL metadata, use real source ports, summarize repeated raw print append events, and attach saved print artifacts from malwaredir with legacy uploaddir fallback.
Switch MINIPRINT config examples from uploaddir to malwaredir and add unit coverage for HTTP probes, PJL commands, saved artifacts, missing artifacts, and append aggregation.
Sample logs:
{"timestamp": "2026-06-16T15:28:47.734303Z", "info": "HTTP request received", "session_id": "fa054f81-040f-41a1-a01f-2572ca7c7f83", "src_ip": "172.22.0.1", "src_port": 55456, "dest_ip": "172.22.0.2", "dest_port": 8080, "session_start": "2026-06-16T15:28:47.734127Z", "protocol": "http", "action": "request", "event": "ssrf_probe", "request": "GET", "url": "/network/config?url=http://169.254.169.254/2412935c8bd94f0d96e480fd0bac4834", "user_agent": "miniprint-smoke/2412935c8bd94f0d96e480fd0bac4834", "cve_hint": "CVE-2024-51980,CVE-2024-51981,CVE-2025-9269"} {"timestamp": "2026-06-16T15:28:47.734453Z", "info": "HTTP access", "session_id": "fa054f81-040f-41a1-a01f-2572ca7c7f83", "src_ip": "172.22.0.1", "src_port": 55456, "dest_ip": "172.22.0.2", "dest_port": 8080, "session_start": "2026-06-16T15:28:47.734127Z", "protocol": "http", "action": "access", "event": "http_access", "request_line": "\"GET /network/config?url=http://169.254.169.254/2412935c8bd94f0d96e480fd0bac4834 HTTP/1.1\" 401 -"} {"timestamp": "2026-06-16T15:28:47.734571Z", "info": "HTTP request completed", "session_id": "fa054f81-040f-41a1-a01f-2572ca7c7f83", "src_ip": "172.22.0.1", "src_port": 55456, "dest_ip": "172.22.0.2", "dest_port": 8080, "session_start": "2026-06-16T15:28:47.734127Z", "protocol": "http", "action": "close_conn", "event": "http_connection_closed", "session_end": "2026-06-16T15:28:47.734556Z", "session_duration": 0.000429} {"timestamp": "2026-06-16T15:28:47.735757Z", "info": "Connection opened", "session_id": "7d847994-3190-48c1-8bb4-304d85275847", "src_ip": "172.22.0.1", "src_port": 47284, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.735069Z", "protocol": "pjl", "action": "open_conn", "event": "connection"} {"timestamp": "2026-06-16T15:28:47.735909Z", "info": "PJL command received", "session_id": "7d847994-3190-48c1-8bb4-304d85275847", "src_ip": "172.22.0.1", "src_port": 47284, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.735069Z", "protocol": "pjl", "action": "request", "event": "command_received", "command": "ECHO", "payload_sha256": "c83c7e6add2b724039cef279c1636174ce4df4cea6759852c9e8bc32e42bd654", "payload_preview": "@PJL ECHO SMOKE-2412935c8bd94f0d96e480fd0bac4834\\r\\n"} {"timestamp": "2026-06-16T15:28:47.735964Z", "info": "Responding with echo", "session_id": "7d847994-3190-48c1-8bb4-304d85275847", "src_ip": "172.22.0.1", "src_port": 47284, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.735069Z", "protocol": "pjl", "action": "response", "event": "echo"} {"timestamp": "2026-06-16T15:28:47.736035Z", "info": "Response sent", "session_id": "7d847994-3190-48c1-8bb4-304d85275847", "src_ip": "172.22.0.1", "src_port": 47284, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.735069Z", "protocol": "pjl", "action": "response", "event": "response_sent"} {"timestamp": "2026-06-16T15:28:47.736094Z", "info": "Connection closed", "session_id": "7d847994-3190-48c1-8bb4-304d85275847", "src_ip": "172.22.0.1", "src_port": 47284, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.735069Z", "protocol": "pjl", "action": "close_conn", "event": "connection_closed", "session_end": "2026-06-16T15:28:47.736084Z", "session_duration": 0.001015} {"timestamp": "2026-06-16T15:28:47.737168Z", "info": "Connection opened", "session_id": "e0ac80fc-db5b-4026-9e4b-afb7cf73aadd", "src_ip": "172.22.0.1", "src_port": 47300, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.736463Z", "protocol": "pjl", "action": "open_conn", "event": "connection"} {"timestamp": "2026-06-16T15:28:47.737316Z", "info": "Appending raw print job", "session_id": "e0ac80fc-db5b-4026-9e4b-afb7cf73aadd", "src_ip": "172.22.0.1", "src_port": 47300, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.736463Z", "protocol": "pjl", "payload_sha256": "a2e659dacb4691e887ac0139f8893d04764ee197d70fb73d3190d56113d18e3e", "payload_preview": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "action": "append", "event": "append_raw_print_job", "size": 4096} {"timestamp": "2026-06-16T15:28:47.737426Z", "info": "Appending raw print job", "session_id": "e0ac80fc-db5b-4026-9e4b-afb7cf73aadd", "src_ip": "172.22.0.1", "src_port": 47300, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.736463Z", "protocol": "pjl", "payload_sha256": "a2e659dacb4691e887ac0139f8893d04764ee197d70fb73d3190d56113d18e3e", "payload_preview": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "action": "append", "event": "append_raw_print_job", "size": 4096} {"timestamp": "2026-06-16T15:28:47.737492Z", "info": "Appending raw print job", "session_id": "e0ac80fc-db5b-4026-9e4b-afb7cf73aadd", "src_ip": "172.22.0.1", "src_port": 47300, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.736463Z", "protocol": "pjl", "payload_sha256": "a2e659dacb4691e887ac0139f8893d04764ee197d70fb73d3190d56113d18e3e", "payload_preview": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "action": "append", "event": "append_raw_print_job", "size": 4096} {"timestamp": "2026-06-16T15:28:47.737545Z", "info": "Appending raw print job", "session_id": "e0ac80fc-db5b-4026-9e4b-afb7cf73aadd", "src_ip": "172.22.0.1", "src_port": 47300, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.736463Z", "protocol": "pjl", "payload_sha256": "a2e659dacb4691e887ac0139f8893d04764ee197d70fb73d3190d56113d18e3e", "payload_preview": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "action": "append", "event": "append_raw_print_job", "size": 4096} {"timestamp": "2026-06-16T15:28:47.737611Z", "info": "Appending raw print job", "session_id": "e0ac80fc-db5b-4026-9e4b-afb7cf73aadd", "src_ip": "172.22.0.1", "src_port": 47300, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.736463Z", "protocol": "pjl", "payload_sha256": "a2e659dacb4691e887ac0139f8893d04764ee197d70fb73d3190d56113d18e3e", "payload_preview": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "action": "append", "event": "append_raw_print_job", "size": 4096} {"timestamp": "2026-06-16T15:28:47.737674Z", "info": "Appending raw print job", "session_id": "e0ac80fc-db5b-4026-9e4b-afb7cf73aadd", "src_ip": "172.22.0.1", "src_port": 47300, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.736463Z", "protocol": "pjl", "payload_sha256": "a2e659dacb4691e887ac0139f8893d04764ee197d70fb73d3190d56113d18e3e", "payload_preview": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "action": "append", "event": "append_raw_print_job", "size": 4096} {"timestamp": "2026-06-16T15:28:47.737738Z", "info": "Appending raw print job", "session_id": "e0ac80fc-db5b-4026-9e4b-afb7cf73aadd", "src_ip": "172.22.0.1", "src_port": 47300, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.736463Z", "protocol": "pjl", "payload_sha256": "a2e659dacb4691e887ac0139f8893d04764ee197d70fb73d3190d56113d18e3e", "payload_preview": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "action": "append", "event": "append_raw_print_job", "size": 4096} {"timestamp": "2026-06-16T15:28:47.737810Z", "info": "Appending raw print job", "session_id": "e0ac80fc-db5b-4026-9e4b-afb7cf73aadd", "src_ip": "172.22.0.1", "src_port": 47300, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.736463Z", "protocol": "pjl", "payload_sha256": "a2e659dacb4691e887ac0139f8893d04764ee197d70fb73d3190d56113d18e3e", "payload_preview": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "action": "append", "event": "append_raw_print_job", "size": 4096} {"timestamp": "2026-06-16T15:28:47.737907Z", "info": "Appending raw print job", "session_id": "e0ac80fc-db5b-4026-9e4b-afb7cf73aadd", "src_ip": "172.22.0.1", "src_port": 47300, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.736463Z", "protocol": "pjl", "payload_sha256": "a2e659dacb4691e887ac0139f8893d04764ee197d70fb73d3190d56113d18e3e", "payload_preview": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "action": "append", "event": "append_raw_print_job", "size": 4096} {"timestamp": "2026-06-16T15:28:47.737959Z", "info": "Appending raw print job", "session_id": "e0ac80fc-db5b-4026-9e4b-afb7cf73aadd", "src_ip": "172.22.0.1", "src_port": 47300, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.736463Z", "protocol": "pjl", "payload_sha256": "a2e659dacb4691e887ac0139f8893d04764ee197d70fb73d3190d56113d18e3e", "payload_preview": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "action": "append", "event": "append_raw_print_job", "size": 4096} {"timestamp": "2026-06-16T15:28:47.738042Z", "info": "Appending raw print job", "session_id": "e0ac80fc-db5b-4026-9e4b-afb7cf73aadd", "src_ip": "172.22.0.1", "src_port": 47300, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.736463Z", "protocol": "pjl", "payload_sha256": "a2e659dacb4691e887ac0139f8893d04764ee197d70fb73d3190d56113d18e3e", "payload_preview": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "action": "append", "event": "append_raw_print_job", "size": 4096} {"timestamp": "2026-06-16T15:28:47.738092Z", "info": "Appending raw print job", "session_id": "e0ac80fc-db5b-4026-9e4b-afb7cf73aadd", "src_ip": "172.22.0.1", "src_port": 47300, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.736463Z", "protocol": "pjl", "payload_sha256": "a2e659dacb4691e887ac0139f8893d04764ee197d70fb73d3190d56113d18e3e", "payload_preview": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "action": "append", "event": "append_raw_print_job", "size": 4096} {"timestamp": "2026-06-16T15:28:47.738152Z", "info": "Appending raw print job", "session_id": "e0ac80fc-db5b-4026-9e4b-afb7cf73aadd", "src_ip": "172.22.0.1", "src_port": 47300, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.736463Z", "protocol": "pjl", "payload_sha256": "a2e659dacb4691e887ac0139f8893d04764ee197d70fb73d3190d56113d18e3e", "payload_preview": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "action": "append", "event": "append_raw_print_job", "size": 4096} {"timestamp": "2026-06-16T15:28:47.738203Z", "info": "Appending raw print job", "session_id": "e0ac80fc-db5b-4026-9e4b-afb7cf73aadd", "src_ip": "172.22.0.1", "src_port": 47300, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.736463Z", "protocol": "pjl", "payload_sha256": "a2e659dacb4691e887ac0139f8893d04764ee197d70fb73d3190d56113d18e3e", "payload_preview": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "action": "append", "event": "append_raw_print_job", "size": 4096} {"timestamp": "2026-06-16T15:28:47.738250Z", "info": "Appending raw print job", "session_id": "e0ac80fc-db5b-4026-9e4b-afb7cf73aadd", "src_ip": "172.22.0.1", "src_port": 47300, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.736463Z", "protocol": "pjl", "payload_sha256": "a2e659dacb4691e887ac0139f8893d04764ee197d70fb73d3190d56113d18e3e", "payload_preview": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "action": "append", "event": "append_raw_print_job", "size": 4096} {"timestamp": "2026-06-16T15:28:47.738301Z", "info": "Appending raw print job", "session_id": "e0ac80fc-db5b-4026-9e4b-afb7cf73aadd", "src_ip": "172.22.0.1", "src_port": 47300, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.736463Z", "protocol": "pjl", "payload_sha256": "a2e659dacb4691e887ac0139f8893d04764ee197d70fb73d3190d56113d18e3e", "payload_preview": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "action": "append", "event": "append_raw_print_job", "size": 4096} {"timestamp": "2026-06-16T15:28:47.738349Z", "info": "Request exceeded configured limit", "session_id": "e0ac80fc-db5b-4026-9e4b-afb7cf73aadd", "src_ip": "172.22.0.1", "src_port": 47300, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.736463Z", "protocol": "pjl", "action": "limit", "event": "request_too_large", "size": 69632, "limit": 65536, "payload_sha256": "a2e659dacb4691e887ac0139f8893d04764ee197d70fb73d3190d56113d18e3e", "payload_preview": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"} {"timestamp": "2026-06-16T15:28:47.738606Z", "info": "Saved print artifact", "session_id": "e0ac80fc-db5b-4026-9e4b-afb7cf73aadd", "src_ip": "172.22.0.1", "src_port": 47300, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.736463Z", "protocol": "pjl", "action": "saving", "event": "save_raw_print_job", "file_name": "2026-06-16_15-28-47-738451_1f8745f0d2d1387e.txt", "payload_sha256": "1f8745f0d2d1387ec1af2211a3cf417b2e9e885e853472649c1d979d0e9370e3", "size": 65536} {"timestamp": "2026-06-16T15:28:47.738668Z", "info": "Connection closed", "session_id": "e0ac80fc-db5b-4026-9e4b-afb7cf73aadd", "src_ip": "172.22.0.1", "src_port": 47300, "dest_ip": "172.22.0.2", "dest_port": 9100, "session_start": "2026-06-16T15:28:47.736463Z", "protocol": "pjl", "action": "close_conn", "event": "connection_closed", "session_end": "2026-06-16T15:28:47.738659Z", "session_duration": 0.002196}