mirror of https://github.com/pozm/gdke.git
fix filling bug
This commit is contained in:
parent
7880a5b651
commit
f33c8dbf43
|
@ -261,7 +261,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gdke"
|
name = "gdke"
|
||||||
version = "0.2.0"
|
version = "0.2.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"dll-syringe",
|
"dll-syringe",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
workspace = { members = ["gdkeinj"] }
|
workspace = { members = ["gdkeinj"] }
|
||||||
[package]
|
[package]
|
||||||
name = "gdke"
|
name = "gdke"
|
||||||
version = "0.2.0"
|
version = "0.2.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap, ffi::c_void, mem::size_of, net::UdpSocket, ptr::null, time::Duration,
|
collections::HashMap,
|
||||||
|
ffi::c_void,
|
||||||
|
mem::size_of,
|
||||||
|
net::UdpSocket,
|
||||||
|
ptr::{null, slice_from_raw_parts},
|
||||||
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
use poggers::{
|
use poggers::{
|
||||||
|
@ -36,7 +41,7 @@ fn find_sig_addr(sig_type: usize) -> Result<*const c_void, SigErrors> {
|
||||||
.scan(sig)
|
.scan(sig)
|
||||||
.map_err(|_| SigErrors::NotFound)?
|
.map_err(|_| SigErrors::NotFound)?
|
||||||
.ok_or(SigErrors::NotFound)? as isize;
|
.ok_or(SigErrors::NotFound)? as isize;
|
||||||
let ptr_to_fn = (addr as usize + 1) as *const u8;
|
let ptr_to_fn = (addr as usize + size_of::<u8>()) as *const u8;
|
||||||
let mut addr_offset = [0; 4];
|
let mut addr_offset = [0; 4];
|
||||||
unsafe { std::ptr::copy(ptr_to_fn, addr_offset.as_mut_ptr(), 4) };
|
unsafe { std::ptr::copy(ptr_to_fn, addr_offset.as_mut_ptr(), 4) };
|
||||||
let by = i32::from_ne_bytes(addr_offset);
|
let by = i32::from_ne_bytes(addr_offset);
|
||||||
|
@ -69,22 +74,26 @@ pub fn main() {
|
||||||
println!("err {err:?}");
|
println!("err {err:?}");
|
||||||
|
|
||||||
std::thread::sleep(Duration::from_secs(100));
|
std::thread::sleep(Duration::from_secs(100));
|
||||||
sock.send(&[err as u8]).ok();
|
// sock.send(&[err as u8]).ok();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
println!("sending fnptr");
|
println!("hooking fnptr");
|
||||||
let sock2 = sock.try_clone().unwrap();
|
let sock2 = sock.try_clone().unwrap();
|
||||||
unsafe {
|
unsafe {
|
||||||
let open_and_parse = std::mem::transmute::<isize, open_and_parse_t>(fn_ptr as isize);
|
let open_and_parse = std::mem::transmute::<isize, open_and_parse_t>(fn_ptr as isize);
|
||||||
let opp = OpenAndParse
|
let opp = OpenAndParse
|
||||||
.initialize(open_and_parse, move |_, _, key, _| {
|
.initialize(open_and_parse, move |_, _, key, _| {
|
||||||
println!("hook has been called");
|
println!("hook has been called");
|
||||||
let mut read_key = [0u8; 32];
|
|
||||||
let ptr_to_key = (key as usize + 8) as *const *const u8;
|
let ptr_to_key = (key as usize + 8) as *const *const u8;
|
||||||
std::ptr::copy(*ptr_to_key, read_key.as_mut_ptr(), 32);
|
println!("key ptr = {:p}", ptr_to_key);
|
||||||
sock2.send(read_key.as_slice()).unwrap();
|
#[cfg(debug_assertions)]
|
||||||
|
{
|
||||||
|
println!("[debug] waiting for input");
|
||||||
|
std::io::stdin().read_line(&mut String::new());
|
||||||
|
}
|
||||||
|
sock2.send(&*slice_from_raw_parts(*ptr_to_key, 32)).unwrap();
|
||||||
std::thread::sleep(Duration::from_secs(1000))
|
std::thread::sleep(Duration::from_secs(1000))
|
||||||
// panic!("good ridance.")
|
// panic!("good ridance.")
|
||||||
})
|
})
|
||||||
|
@ -92,5 +101,5 @@ pub fn main() {
|
||||||
opp.enable().expect("failed to enable detour");
|
opp.enable().expect("failed to enable detour");
|
||||||
println!("detour enabled {}", opp.is_enabled());
|
println!("detour enabled {}", opp.is_enabled());
|
||||||
}
|
}
|
||||||
sock.send(&(400195u32.to_ne_bytes())).ok();
|
sock.send(&[0, 0, 0, 0]).ok();
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,7 +165,12 @@ pub unsafe fn spawn_and_inject(proc: &str) -> anyhow::Result<[u8; 32]> {
|
||||||
let mut error = [0u8; 4];
|
let mut error = [0u8; 4];
|
||||||
sock.recv(&mut error)?;
|
sock.recv(&mut error)?;
|
||||||
println!("errors -> {error:?}");
|
println!("errors -> {error:?}");
|
||||||
if error.is_empty() {
|
if error.iter().all(|x| *x != 0) {
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
{
|
||||||
|
println!("[debug] waiting for input");
|
||||||
|
std::io::stdin().read_line(&mut String::new());
|
||||||
|
}
|
||||||
return Err(SigErrors::from(error[0]).into());
|
return Err(SigErrors::from(error[0]).into());
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -6,7 +6,7 @@ fn main() {
|
||||||
spawn_and_inject(&std::env::args().nth(1).unwrap()).expect("failed to resolve key");
|
spawn_and_inject(&std::env::args().nth(1).unwrap()).expect("failed to resolve key");
|
||||||
print!("key: ");
|
print!("key: ");
|
||||||
for val in key {
|
for val in key {
|
||||||
print!("{:x}", val);
|
print!("{:0>2x}", val);
|
||||||
}
|
}
|
||||||
println!("\npress enter to close");
|
println!("\npress enter to close");
|
||||||
let _ = std::io::stdin().read_line(&mut String::new());
|
let _ = std::io::stdin().read_line(&mut String::new());
|
||||||
|
|
Loading…
Reference in New Issue