network: add missing HTTP headers to response gen
This commit is contained in:
parent
99cc25aba3
commit
63dc5715df
3 changed files with 23 additions and 3 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -617,7 +617,7 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "eris"
|
name = "eris"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "eris"
|
name = "eris"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
|
@ -433,11 +433,31 @@ pub async fn generate_deceptive_response(
|
||||||
let markov_text = markov.generate(response_type, 30);
|
let markov_text = markov.generate(response_type, 30);
|
||||||
|
|
||||||
// Use Lua scripts to enhance with honeytokens and other deceptive content
|
// Use Lua scripts to enhance with honeytokens and other deceptive content
|
||||||
script_manager.generate_response(
|
let body = script_manager.generate_response(
|
||||||
path,
|
path,
|
||||||
user_agent,
|
user_agent,
|
||||||
&peer_addr.to_string(),
|
&peer_addr.to_string(),
|
||||||
headers,
|
headers,
|
||||||
&markov_text,
|
&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
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue