chore: bump poggers version

This commit is contained in:
amelia 2024-05-10 10:36:27 +01:00
parent cf2a8f23c4
commit 7880a5b651
No known key found for this signature in database
GPG Key ID: 97E44FA91E492F2D
5 changed files with 156 additions and 49 deletions

186
Cargo.lock generated
View File

@ -51,9 +51,9 @@ dependencies = [
[[package]] [[package]]
name = "bitfield-struct" name = "bitfield-struct"
version = "0.5.6" version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a26b8cea8bb6a81b75a84603b9e096f05fa86db057904ef29be1deee900532bd" checksum = "1657dce144574f921af10a92876a96f0ca05dd830900598d21d91c8e4cf78f74"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -265,7 +265,7 @@ version = "0.2.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"dll-syringe", "dll-syringe",
"poggers", "poggers 1.2.1 (git+https://github.com/pozm/poggers.git)",
"rust-embed", "rust-embed",
"thiserror", "thiserror",
"windows", "windows",
@ -275,7 +275,7 @@ dependencies = [
name = "gdkeinj" name = "gdkeinj"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"poggers", "poggers 1.2.1",
"poggers-derive", "poggers-derive",
"retour", "retour",
] ]
@ -467,7 +467,14 @@ dependencies = [
[[package]] [[package]]
name = "macos-libproc" name = "macos-libproc"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/pozm/poggers.git#cc24264792ba93b8c25456cacb34c188e49e0998" dependencies = [
"bindgen",
]
[[package]]
name = "macos-libproc"
version = "0.1.0"
source = "git+https://github.com/pozm/poggers.git#8b9e2e4a929c57fa68c6414abcd3275325e09173"
dependencies = [ dependencies = [
"bindgen", "bindgen",
] ]
@ -569,6 +576,12 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
[[package]]
name = "pin-project-lite"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
[[package]] [[package]]
name = "plain" name = "plain"
version = "0.2.3" version = "0.2.3"
@ -577,16 +590,31 @@ checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
[[package]] [[package]]
name = "poggers" name = "poggers"
version = "1.1.6" version = "1.2.1"
source = "git+https://github.com/pozm/poggers.git#cc24264792ba93b8c25456cacb34c188e49e0998"
dependencies = [ dependencies = [
"bitfield-struct", "bitfield-struct",
"ctor", "ctor",
"libc", "libc",
"mach", "mach",
"macos-libproc", "macos-libproc 0.1.0",
"poggers-derive",
"thiserror", "thiserror",
"tracing",
"widestring",
"windows",
]
[[package]]
name = "poggers"
version = "1.2.1"
source = "git+https://github.com/pozm/poggers.git#8b9e2e4a929c57fa68c6414abcd3275325e09173"
dependencies = [
"bitfield-struct",
"ctor",
"libc",
"mach",
"macos-libproc 0.1.0 (git+https://github.com/pozm/poggers.git)",
"thiserror",
"tracing",
"widestring", "widestring",
"windows", "windows",
] ]
@ -898,18 +926,18 @@ dependencies = [
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.56" version = "1.0.59"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.56" version = "1.0.59"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -933,6 +961,37 @@ dependencies = [
"winnow", "winnow",
] ]
[[package]]
name = "tracing"
version = "0.1.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
dependencies = [
"pin-project-lite",
"tracing-attributes",
"tracing-core",
]
[[package]]
name = "tracing-attributes"
version = "0.1.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.48",
]
[[package]]
name = "tracing-core"
version = "0.1.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
dependencies = [
"once_cell",
]
[[package]] [[package]]
name = "typenum" name = "typenum"
version = "1.17.0" version = "1.17.0"
@ -1033,21 +1092,55 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]] [[package]]
name = "windows" name = "windows"
version = "0.52.0" version = "0.56.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" checksum = "1de69df01bdf1ead2f4ac895dc77c9351aefff65b2f3db429a343f9cbf05e132"
dependencies = [ dependencies = [
"windows-core", "windows-core",
"windows-targets 0.52.0", "windows-targets 0.52.5",
] ]
[[package]] [[package]]
name = "windows-core" name = "windows-core"
version = "0.52.0" version = "0.56.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" checksum = "4698e52ed2d08f8658ab0c39512a7c00ee5fe2688c65f8c0a4f06750d729f2a6"
dependencies = [ dependencies = [
"windows-targets 0.52.0", "windows-implement",
"windows-interface",
"windows-result",
"windows-targets 0.52.5",
]
[[package]]
name = "windows-implement"
version = "0.56.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6fc35f58ecd95a9b71c4f2329b911016e6bec66b3f2e6a4aad86bd2e99e2f9b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.48",
]
[[package]]
name = "windows-interface"
version = "0.56.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08990546bf4edef8f431fa6326e032865f27138718c587dc21bc0265bbcb57cc"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.48",
]
[[package]]
name = "windows-result"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "749f0da9cc72d82e600d8d2e44cadd0b9eedb9038f71a1c58556ac1c5791813b"
dependencies = [
"windows-targets 0.52.5",
] ]
[[package]] [[package]]
@ -1065,7 +1158,7 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [ dependencies = [
"windows-targets 0.52.0", "windows-targets 0.52.5",
] ]
[[package]] [[package]]
@ -1085,17 +1178,18 @@ dependencies = [
[[package]] [[package]]
name = "windows-targets" name = "windows-targets"
version = "0.52.0" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
dependencies = [ dependencies = [
"windows_aarch64_gnullvm 0.52.0", "windows_aarch64_gnullvm 0.52.5",
"windows_aarch64_msvc 0.52.0", "windows_aarch64_msvc 0.52.5",
"windows_i686_gnu 0.52.0", "windows_i686_gnu 0.52.5",
"windows_i686_msvc 0.52.0", "windows_i686_gnullvm",
"windows_x86_64_gnu 0.52.0", "windows_i686_msvc 0.52.5",
"windows_x86_64_gnullvm 0.52.0", "windows_x86_64_gnu 0.52.5",
"windows_x86_64_msvc 0.52.0", "windows_x86_64_gnullvm 0.52.5",
"windows_x86_64_msvc 0.52.5",
] ]
[[package]] [[package]]
@ -1106,9 +1200,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]] [[package]]
name = "windows_aarch64_gnullvm" name = "windows_aarch64_gnullvm"
version = "0.52.0" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
[[package]] [[package]]
name = "windows_aarch64_msvc" name = "windows_aarch64_msvc"
@ -1118,9 +1212,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]] [[package]]
name = "windows_aarch64_msvc" name = "windows_aarch64_msvc"
version = "0.52.0" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
[[package]] [[package]]
name = "windows_i686_gnu" name = "windows_i686_gnu"
@ -1130,9 +1224,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]] [[package]]
name = "windows_i686_gnu" name = "windows_i686_gnu"
version = "0.52.0" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
[[package]] [[package]]
name = "windows_i686_msvc" name = "windows_i686_msvc"
@ -1142,9 +1242,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]] [[package]]
name = "windows_i686_msvc" name = "windows_i686_msvc"
version = "0.52.0" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
[[package]] [[package]]
name = "windows_x86_64_gnu" name = "windows_x86_64_gnu"
@ -1154,9 +1254,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]] [[package]]
name = "windows_x86_64_gnu" name = "windows_x86_64_gnu"
version = "0.52.0" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
[[package]] [[package]]
name = "windows_x86_64_gnullvm" name = "windows_x86_64_gnullvm"
@ -1166,9 +1266,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]] [[package]]
name = "windows_x86_64_gnullvm" name = "windows_x86_64_gnullvm"
version = "0.52.0" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
[[package]] [[package]]
name = "windows_x86_64_msvc" name = "windows_x86_64_msvc"
@ -1178,9 +1278,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]] [[package]]
name = "windows_x86_64_msvc" name = "windows_x86_64_msvc"
version = "0.52.0" version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
[[package]] [[package]]
name = "winnow" name = "winnow"

View File

@ -39,6 +39,6 @@ windows = { features = [
"Win32_System_Kernel", "Win32_System_Kernel",
"Win32_System_ProcessStatus", "Win32_System_ProcessStatus",
"Win32_Security", "Win32_Security",
], version = "0.52" } ], version = "0.56" }
dll-syringe = "*" dll-syringe = "*"
poggers = { version = "*", git = "https://github.com/pozm/poggers.git" } poggers = { version = "*", git = "https://github.com/pozm/poggers.git" }

View File

@ -8,6 +8,6 @@ edition = "2021"
crate-type = ["cdylib"] crate-type = ["cdylib"]
[dependencies] [dependencies]
poggers = { git = "https://github.com/pozm/poggers.git" } poggers = { path = "../../poggers/poggers" }
poggers-derive = { git = "https://github.com/pozm/poggers.git" } poggers-derive = { git = "https://github.com/pozm/poggers.git" }
retour = { version = "0.3.1", features = ["static-detour"] } retour = { version = "0.3.1", features = ["static-detour"] }

View File

@ -14,12 +14,13 @@ static_detour! {
pub static OpenAndParse: unsafe extern "fastcall" fn(*const i32, *const i32, *const u8, bool) -> (); pub static OpenAndParse: unsafe extern "fastcall" fn(*const i32, *const i32, *const u8, bool) -> ();
} }
const SIGS: [&str; 4] = [ const SIGS: [&str; 5] = [
// call into open_and_parse // call into open_and_parse
"E8 ? ? ? ? 85 C0 0F 84 ? ? ? ? 49 8B 8C 24 ? ? ? ?", // 4.x (4.2.1) "E8 ? ? ? ? 85 C0 0F 84 ? ? ? ? 49 8B 8C 24 ? ? ? ?", // 4.x (4.2.1)
"E8 ? ? ? ? 89 44 24 50 83 7C 24 ? ? 0F 84 ? ? ? ? 48 8B 44 24 ?", // 3.5.1 "E8 ? ? ? ? 89 44 24 50 83 7C 24 ? ? 0F 84 ? ? ? ? 48 8B 44 24 ?", // 3.5.1
"E8 ? ? ? ? 89 44 24 50 83 7C 24 ? ? 0F 84 ? ? ? ? 48 8B 44 24 ?", // 3.5.1 "E8 ? ? ? ? 89 44 24 50 83 7C 24 ? ? 0F 84 ? ? ? ? 48 8B 44 24 ?", // 3.5.1
"E8 ? ? ? ? 8B D8 85 C0 0F 84 ? ? ? ? 49 8B 04 24", // 3.x "E8 ? ? ? ? 8B D8 85 C0 0F 84 ? ? ? ? 49 8B 04 24", // 3.x
"E8 ? ? ? ? 48 8B 4C 24 ? 89 C5 48 85 C9", // 4.3
]; ];
#[repr(u8)] #[repr(u8)]
#[derive(Debug)] #[derive(Debug)]
@ -35,13 +36,15 @@ 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;
println!("sig found: {:x} ", addr); 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);
let fn_ptr = (addr + by as isize + 5) as *const c_void; let fn_ptr = (addr + by as isize + 5) as *const c_void;
println!("fnptr = {:x?} B = ${addr_offset:?}, ${by:?}", fn_ptr); println!(
"fnptr = {:x?} & {} B = ${addr_offset:?}, ${by:?} dede {addr:x?}",
fn_ptr, fn_ptr as isize
);
Ok(fn_ptr) Ok(fn_ptr)
} }
@ -57,6 +60,7 @@ pub fn main() {
let mut sig_type = [0; 4]; let mut sig_type = [0; 4];
sock.recv(&mut sig_type).unwrap(); sock.recv(&mut sig_type).unwrap();
println!("received sig type: {:?}", sig_type);
let int_sig = u32::from_ne_bytes(sig_type); let int_sig = u32::from_ne_bytes(sig_type);
let fn_ptr = find_sig_addr(int_sig as usize); let fn_ptr = find_sig_addr(int_sig as usize);
let fn_ptr = match fn_ptr { let fn_ptr = match fn_ptr {
@ -70,11 +74,13 @@ pub fn main() {
} }
}; };
println!("sending 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");
let mut read_key = [0u8; 32]; 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); std::ptr::copy(*ptr_to_key, read_key.as_mut_ptr(), 32);

View File

@ -147,6 +147,7 @@ pub unsafe fn spawn_and_inject(proc: &str) -> anyhow::Result<[u8; 32]> {
// .next() // .next()
// .ok_or(anyhow::anyhow!("unable to check gd version"))? // .ok_or(anyhow::anyhow!("unable to check gd version"))?
{ {
['4','.','3',..] => 4u32,
['4',..] => 0u32, ['4',..] => 0u32,
['3','.','6',..] => 2u32, ['3','.','6',..] => 2u32,
['3',..] => 1u32, ['3',..] => 1u32,