One step away
This commit is contained in:
parent
d5d8aa455e
commit
99eb044062
25
src/main.rs
25
src/main.rs
@ -42,24 +42,6 @@ macro_rules! resp {
|
||||
};
|
||||
}
|
||||
|
||||
#[post("/basicinfo/")]
|
||||
async fn basicinfo_e() -> HttpResponse {
|
||||
// This function is technically decrypting the plaintext into cipher text for the client to
|
||||
// encrypt to read it. It's very backwards, but this is how the game works. I hate it.
|
||||
let mut key_file = File::open("private_key.pem").unwrap();
|
||||
let mut key_buffer = Vec::new();
|
||||
key_file.read_to_end(&mut key_buffer).unwrap();
|
||||
// Load the private key from the PEM data
|
||||
let rsa = Rsa::private_key_from_pem(&key_buffer).unwrap();
|
||||
let plaintext = r#"{"result":200,"response":{"base_url":"http://data.nesys.jp/game","download_url":"http://data.nesys.jp/download","key":"01234567890123456789012345678901","iv":"0123456789012345","tenpo_index":1337}}"#;
|
||||
let mut ciphertext = vec![0; rsa.size() as usize];
|
||||
rsa.private_encrypt(plaintext.as_bytes(), &mut ciphertext, Padding::PKCS1).unwrap();
|
||||
println!("{}",format!("RSA Public Encrypt").bold().red());
|
||||
println!("{}",format!("{}", plaintext).bold().yellow());
|
||||
HttpResponse::Ok().append_header(ContentType::octet_stream()).body(ciphertext)
|
||||
}
|
||||
|
||||
#[post("/basicinfo")]
|
||||
async fn basicinfo() -> HttpResponse {
|
||||
// This function is technically decrypting the plaintext into cipher text for the client to
|
||||
// encrypt to read it. It's very backwards, but this is how the game works. I hate it.
|
||||
@ -68,7 +50,7 @@ async fn basicinfo() -> HttpResponse {
|
||||
key_file.read_to_end(&mut key_buffer).unwrap();
|
||||
// Load the private key from the PEM data
|
||||
let rsa = Rsa::private_key_from_pem(&key_buffer).unwrap();
|
||||
let plaintext = r#"{"result":200,"response":{"base_url":"http://data.nesys.jp/game","download_url":"http://data.nesys.jp/download","key":"01234567890123456789012345678901","iv":"0123456789012345","tenpo_index":1337}}"#;
|
||||
let plaintext = r#"{"result":200,"response":{"base_url":"http://ll.aoeu.top/game","download_url":"http://ll.aoeu.top/download","key":"0123456789012345","iv":"0123456789012345","tenpo_index":1337}}"#;
|
||||
let mut ciphertext = vec![0; rsa.size() as usize];
|
||||
rsa.private_encrypt(plaintext.as_bytes(), &mut ciphertext, Padding::PKCS1).unwrap();
|
||||
println!("{}",format!("RSA Public Encrypt").bold().red());
|
||||
@ -103,6 +85,7 @@ async fn shop() -> HttpResponse {
|
||||
|
||||
#[post("/service/respone/respone.php")]
|
||||
async fn respone() -> HttpResponse {
|
||||
println!("[+] Machine started nesys service!");
|
||||
resp!("1")
|
||||
}
|
||||
|
||||
@ -210,8 +193,8 @@ async fn main() -> std::io::Result<()> {
|
||||
.service(game_stuff)
|
||||
.service(certify)
|
||||
.service(server_data)
|
||||
.service(basicinfo)
|
||||
.service(basicinfo_e)
|
||||
.service(web::resource("/basicinfo/").to(basicinfo))
|
||||
.service(web::resource("/basicinfo").to(basicinfo))
|
||||
.service(cardn)
|
||||
//.service(web::resource("/*").route(web::post().to(handle_post_request)))
|
||||
.route("{path:.*}",web::post().to(handle_post_request))
|
||||
|
@ -46,7 +46,7 @@ pub async fn game_stuff(body: web::Bytes, req: actix_web::HttpRequest) -> HttpRe
|
||||
println!("{}", &ct.red());
|
||||
println!("{}",format!("Plaintext:").black().on_green());
|
||||
let pt = aes_dec(&body);
|
||||
let cleaned = &pt.trim().replace("\n", "").replace("\0", "");
|
||||
let cleaned = &pt.trim().replace("\n", "").replace("\0", "").replace("\r", "");
|
||||
println!("{}", &cleaned.green());
|
||||
|
||||
// Given the plaintext of the request body
|
||||
@ -65,4 +65,5 @@ pub async fn game_stuff(body: web::Bytes, req: actix_web::HttpRequest) -> HttpRe
|
||||
return resp!("");
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
https://github.com/BocuD/LLServer/blob/2ab726cc298c613b5fa3d046ed95267c04486fd1/LLServer/Controllers/Game/GameController.cs
|
||||
|
Loading…
Reference in New Issue
Block a user