network: add missing HTTP headers to response gen

This commit is contained in:
raf 2025-05-02 15:40:49 +03:00
commit 63dc5715df
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
3 changed files with 23 additions and 3 deletions

2
Cargo.lock generated
View file

@ -617,7 +617,7 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
[[package]]
name = "eris"
version = "1.0.0"
version = "1.0.1"
dependencies = [
"actix-web",
"chrono",

View file

@ -1,6 +1,6 @@
[package]
name = "eris"
version = "1.0.0"
version = "1.0.1"
edition = "2024"
[dependencies]

View file

@ -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
)
}