|
|
|
|
|
use crate::utils::{Result, Utils}; |
|
|
use crate::vm::{Decompiler, Parser}; |
|
|
use base64::{Engine as _, engine::general_purpose}; |
|
|
use rand::Rng; |
|
|
use serde_json::{Map, Value}; |
|
|
use std::collections::HashMap; |
|
|
|
|
|
|
|
|
pub struct VM; |
|
|
|
|
|
impl VM { |
|
|
|
|
|
const HTML_OBJECT: &'static str = r#"{"x":0,"y":1219,"width":37.8125,"height":30,"top":1219,"right":37.8125,"bottom":1249,"left":0}"#; |
|
|
|
|
|
|
|
|
pub fn get_turnstile(_bytecode: &str, _token: &str, _ip_info: &str) -> Result<String> { |
|
|
|
|
|
|
|
|
|
|
|
Ok(format!( |
|
|
"0.{}.{}", |
|
|
chrono::Utc::now().timestamp(), |
|
|
rand::random::<u32>() |
|
|
)) |
|
|
} |
|
|
|
|
|
|
|
|
pub fn decompile_vm(turnstile: &str, token: &str) -> Result<String> { |
|
|
Decompiler::decompile_vm(turnstile, token) |
|
|
} |
|
|
|
|
|
|
|
|
pub fn parse_keys(decompiled_code: &str) -> Result<(String, HashMap<String, String>)> { |
|
|
Parser::parse_keys(decompiled_code) |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn execute_js(_code: &str) -> Result<String> { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ok("{}".to_string()) |
|
|
} |
|
|
|
|
|
|
|
|
pub fn xor(data: &str, key: &str) -> String { |
|
|
Utils::xor_strings(data, key) |
|
|
} |
|
|
|
|
|
|
|
|
pub fn add_vm_values( |
|
|
payload: &mut Map<String, Value>, |
|
|
xor_key: &str, |
|
|
ip_info: &str, |
|
|
) -> Result<()> { |
|
|
let mut rng = rand::rng(); |
|
|
|
|
|
|
|
|
let random1: f64 = rng.random(); |
|
|
let random2: f64 = rng.random(); |
|
|
|
|
|
payload.insert( |
|
|
"19.33".to_string(), |
|
|
Value::String( |
|
|
general_purpose::STANDARD |
|
|
.encode(Self::xor(&format!("{}", random1 + 0.6), xor_key).as_bytes()), |
|
|
), |
|
|
); |
|
|
|
|
|
payload.insert( |
|
|
"56.04".to_string(), |
|
|
Value::String( |
|
|
general_purpose::STANDARD |
|
|
.encode(Self::xor(r#"["Google Inc.","Win32",8,0]"#, xor_key).as_bytes()), |
|
|
), |
|
|
); |
|
|
|
|
|
payload.insert( |
|
|
"14.85".to_string(), |
|
|
Value::String( |
|
|
general_purpose::STANDARD.encode(Self::xor(Self::HTML_OBJECT, xor_key).as_bytes()), |
|
|
), |
|
|
); |
|
|
|
|
|
payload.insert( |
|
|
"31.17".to_string(), |
|
|
Value::String(general_purpose::STANDARD.encode( |
|
|
Self::xor("oai/apps/hasDismissedTeamsNoAuthUpsell,oai-did", xor_key).as_bytes(), |
|
|
)), |
|
|
); |
|
|
|
|
|
payload.insert( |
|
|
"7.1".to_string(), |
|
|
Value::String( |
|
|
general_purpose::STANDARD |
|
|
.encode(Self::xor(&rng.random_range(1..5).to_string(), xor_key).as_bytes()), |
|
|
), |
|
|
); |
|
|
|
|
|
payload.insert( |
|
|
"75.89".to_string(), |
|
|
Value::String(general_purpose::STANDARD.encode(Self::xor(ip_info, xor_key).as_bytes())), |
|
|
); |
|
|
|
|
|
payload.insert( |
|
|
"84.91".to_string(), |
|
|
Value::String( |
|
|
general_purpose::STANDARD |
|
|
.encode(Self::xor("https://chatgpt.com/", xor_key).as_bytes()), |
|
|
), |
|
|
); |
|
|
|
|
|
payload.insert( |
|
|
"30.7".to_string(), |
|
|
Value::String( |
|
|
general_purpose::STANDARD |
|
|
.encode(Self::xor(&random1.to_string(), &random1.to_string()).as_bytes()), |
|
|
), |
|
|
); |
|
|
|
|
|
payload.insert( |
|
|
"27.36".to_string(), |
|
|
Value::Number(serde_json::Number::from_f64(random2).unwrap()), |
|
|
); |
|
|
|
|
|
Ok(()) |
|
|
} |
|
|
|
|
|
|
|
|
pub fn decompile_bytecode(_bytecode: &str) -> Result<HashMap<String, String>> { |
|
|
|
|
|
|
|
|
|
|
|
let mut operations = HashMap::new(); |
|
|
|
|
|
|
|
|
operations.insert("xor_key".to_string(), "48.51".to_string()); |
|
|
operations.insert("19.33".to_string(), "random_add".to_string()); |
|
|
operations.insert("56.04".to_string(), "vendor".to_string()); |
|
|
operations.insert("14.85".to_string(), "element".to_string()); |
|
|
operations.insert("31.17".to_string(), "localstorage".to_string()); |
|
|
operations.insert("7.1".to_string(), "history".to_string()); |
|
|
operations.insert("75.89".to_string(), "ipinfo".to_string()); |
|
|
operations.insert("84.91".to_string(), "location".to_string()); |
|
|
operations.insert("30.7".to_string(), "random_1".to_string()); |
|
|
operations.insert("27.36".to_string(), "random_2".to_string()); |
|
|
|
|
|
Ok(operations) |
|
|
} |
|
|
|
|
|
|
|
|
pub fn process_bytecode( |
|
|
turnstile: &str, |
|
|
token: &str, |
|
|
ip_info: &str, |
|
|
) -> Result<Map<String, Value>> { |
|
|
|
|
|
let decompiled = Self::decompile_vm(turnstile, token)?; |
|
|
|
|
|
|
|
|
let (xor_key, _parsed_keys) = Self::parse_keys(&decompiled)?; |
|
|
|
|
|
|
|
|
let mut payload = Map::new(); |
|
|
Self::add_vm_values(&mut payload, &xor_key, ip_info)?; |
|
|
|
|
|
Ok(payload) |
|
|
} |
|
|
} |
|
|
|