From 7880a5b651c750c563fd3b87519808a79230d697 Mon Sep 17 00:00:00 2001 From: amelia <44528100+pozm@users.noreply.github.com> Date: Fri, 10 May 2024 10:36:27 +0100 Subject: [PATCH] chore: bump poggers version --- Cargo.lock | 186 ++++++++++++++++++++++++++++++++++----------- Cargo.toml | 2 +- gdkeinj/Cargo.toml | 2 +- gdkeinj/src/lib.rs | 14 +++- src/lib.rs | 1 + 5 files changed, 156 insertions(+), 49 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 910e80a..26a1ba3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -51,9 +51,9 @@ dependencies = [ [[package]] name = "bitfield-struct" -version = "0.5.6" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26b8cea8bb6a81b75a84603b9e096f05fa86db057904ef29be1deee900532bd" +checksum = "1657dce144574f921af10a92876a96f0ca05dd830900598d21d91c8e4cf78f74" dependencies = [ "proc-macro2", "quote", @@ -265,7 +265,7 @@ version = "0.2.0" dependencies = [ "anyhow", "dll-syringe", - "poggers", + "poggers 1.2.1 (git+https://github.com/pozm/poggers.git)", "rust-embed", "thiserror", "windows", @@ -275,7 +275,7 @@ dependencies = [ name = "gdkeinj" version = "0.1.0" dependencies = [ - "poggers", + "poggers 1.2.1", "poggers-derive", "retour", ] @@ -467,7 +467,14 @@ dependencies = [ [[package]] name = "macos-libproc" 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 = [ "bindgen", ] @@ -569,6 +576,12 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + [[package]] name = "plain" version = "0.2.3" @@ -577,16 +590,31 @@ checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" [[package]] name = "poggers" -version = "1.1.6" -source = "git+https://github.com/pozm/poggers.git#cc24264792ba93b8c25456cacb34c188e49e0998" +version = "1.2.1" dependencies = [ "bitfield-struct", "ctor", "libc", "mach", - "macos-libproc", - "poggers-derive", + "macos-libproc 0.1.0", "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", "windows", ] @@ -898,18 +926,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" dependencies = [ "proc-macro2", "quote", @@ -933,6 +961,37 @@ dependencies = [ "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]] name = "typenum" version = "1.17.0" @@ -1033,21 +1092,55 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.52.0" +version = "0.56.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +checksum = "1de69df01bdf1ead2f4ac895dc77c9351aefff65b2f3db429a343f9cbf05e132" dependencies = [ "windows-core", - "windows-targets 0.52.0", + "windows-targets 0.52.5", ] [[package]] name = "windows-core" -version = "0.52.0" +version = "0.56.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +checksum = "4698e52ed2d08f8658ab0c39512a7c00ee5fe2688c65f8c0a4f06750d729f2a6" 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]] @@ -1065,7 +1158,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.5", ] [[package]] @@ -1085,17 +1178,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", ] [[package]] @@ -1106,9 +1200,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" @@ -1118,9 +1212,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" @@ -1130,9 +1224,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.5" 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]] name = "windows_i686_msvc" @@ -1142,9 +1242,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" @@ -1154,9 +1254,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" @@ -1166,9 +1266,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" @@ -1178,9 +1278,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winnow" diff --git a/Cargo.toml b/Cargo.toml index ac226f9..9f1d181 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,6 +39,6 @@ windows = { features = [ "Win32_System_Kernel", "Win32_System_ProcessStatus", "Win32_Security", -], version = "0.52" } +], version = "0.56" } dll-syringe = "*" poggers = { version = "*", git = "https://github.com/pozm/poggers.git" } diff --git a/gdkeinj/Cargo.toml b/gdkeinj/Cargo.toml index aa8b229..8dfc8be 100644 --- a/gdkeinj/Cargo.toml +++ b/gdkeinj/Cargo.toml @@ -8,6 +8,6 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -poggers = { git = "https://github.com/pozm/poggers.git" } +poggers = { path = "../../poggers/poggers" } poggers-derive = { git = "https://github.com/pozm/poggers.git" } retour = { version = "0.3.1", features = ["static-detour"] } diff --git a/gdkeinj/src/lib.rs b/gdkeinj/src/lib.rs index 72b4042..7f99107 100644 --- a/gdkeinj/src/lib.rs +++ b/gdkeinj/src/lib.rs @@ -14,12 +14,13 @@ static_detour! { 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 "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 ? ? ? ? 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)] #[derive(Debug)] @@ -35,13 +36,15 @@ fn find_sig_addr(sig_type: usize) -> Result<*const c_void, SigErrors> { .scan(sig) .map_err(|_| SigErrors::NotFound)? .ok_or(SigErrors::NotFound)? as isize; - println!("sig found: {:x} ", addr); - let ptr_to_fn = (addr as usize + size_of::()) as *const u8; + let ptr_to_fn = (addr as usize + 1) as *const u8; let mut addr_offset = [0; 4]; unsafe { std::ptr::copy(ptr_to_fn, addr_offset.as_mut_ptr(), 4) }; let by = i32::from_ne_bytes(addr_offset); 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) } @@ -57,6 +60,7 @@ pub fn main() { let mut sig_type = [0; 4]; sock.recv(&mut sig_type).unwrap(); + println!("received sig type: {:?}", sig_type); let int_sig = u32::from_ne_bytes(sig_type); let fn_ptr = find_sig_addr(int_sig as usize); let fn_ptr = match fn_ptr { @@ -70,11 +74,13 @@ pub fn main() { } }; + println!("sending fnptr"); let sock2 = sock.try_clone().unwrap(); unsafe { let open_and_parse = std::mem::transmute::(fn_ptr as isize); let opp = OpenAndParse .initialize(open_and_parse, move |_, _, key, _| { + println!("hook has been called"); let mut read_key = [0u8; 32]; let ptr_to_key = (key as usize + 8) as *const *const u8; std::ptr::copy(*ptr_to_key, read_key.as_mut_ptr(), 32); diff --git a/src/lib.rs b/src/lib.rs index 8ad90ec..78d316d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -147,6 +147,7 @@ pub unsafe fn spawn_and_inject(proc: &str) -> anyhow::Result<[u8; 32]> { // .next() // .ok_or(anyhow::anyhow!("unable to check gd version"))? { + ['4','.','3',..] => 4u32, ['4',..] => 0u32, ['3','.','6',..] => 2u32, ['3',..] => 1u32,