From 63dc5715df2a105ec80af8e6c709c6c7829aed7c Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 2 May 2025 15:40:49 +0300 Subject: [PATCH] network: add missing HTTP headers to response gen --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/network.rs | 22 +++++++++++++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2eaaf07..fef1219 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -617,7 +617,7 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "eris" -version = "1.0.0" +version = "1.0.1" dependencies = [ "actix-web", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 42cc24b..1c53cdc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "eris" -version = "1.0.0" +version = "1.0.1" edition = "2024" [dependencies] diff --git a/src/network.rs b/src/network.rs index 56d6c65..e9049ad 100644 --- a/src/network.rs +++ b/src/network.rs @@ -433,11 +433,31 @@ pub async fn generate_deceptive_response( let markov_text = markov.generate(response_type, 30); // Use Lua scripts to enhance with honeytokens and other deceptive content - script_manager.generate_response( + let body = script_manager.generate_response( path, user_agent, &peer_addr.to_string(), headers, &markov_text, + ); + + // Determine content type based on response type + let content_type = if response_type == "api" { + "application/json" + } else { + "text/html; charset=utf-8" + }; + + // Add proper HTTP response headers + format!( + "HTTP/1.1 200 OK\r\n\ + Content-Type: {}\r\n\ + Content-Length: {}\r\n\ + Connection: close\r\n\ + \r\n\ + {}", + content_type, + body.len(), + body ) }