#winapi - Making a DLL Injector that connects to a TcpStream

3 messages · Page 1 of 1 (latest)

high hollow
#

It then runs the following in the main function


println!("[*] Starting server..");
let listener = TcpListener::bind(("127.0.0.1", PORT)).await?;
let req = listener.accept();

let (mut conn, addr) = time::timeout(Duration::from_secs(5), req)
    .await
    .map_err(|_| anyhow!("Payload took too long to respond!"))??;
#

here is the code in the dll

#
fn attach() -> String {
    panic::set_hook(Box::new(|info| {
        let _ = fs::write(generate_rand_fn(), info.to_string());
    }));
    
    let loop_thread = thread::spawn(|| {
        let mut stream = TcpStream::connect_timeout(
            &SocketAddr::new([127, 0, 0, 1].into(), PORT),
            Duration::from_secs(10),
        )
        .unwrap();

        loop {
            let command = stream.reads::<Instruction>().unwrap();