mirror of https://github.com/pozm/gdke.git
use new poggers and more modular
This commit is contained in:
parent
79814d17e1
commit
220547f87e
|
@ -909,6 +909,7 @@ version = "0.1.2"
|
|||
dependencies = [
|
||||
"eframe",
|
||||
"egui",
|
||||
"gdke",
|
||||
"poggers",
|
||||
]
|
||||
|
||||
|
@ -1469,7 +1470,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "poggers"
|
||||
version = "0.2.3"
|
||||
version = "0.4.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"ctor",
|
||||
|
@ -1477,7 +1478,8 @@ dependencies = [
|
|||
"log",
|
||||
"mach",
|
||||
"thiserror",
|
||||
"windows 0.44.0",
|
||||
"widestring",
|
||||
"windows 0.46.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2194,6 +2196,12 @@ dependencies = [
|
|||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "widestring"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
|
@ -2242,19 +2250,19 @@ checksum = "0286ba339aa753e70765d521bb0242cc48e1194562bfa2a2ad7ac8a6de28f5d5"
|
|||
dependencies = [
|
||||
"windows-implement",
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc 0.42.1",
|
||||
"windows_i686_gnu 0.42.1",
|
||||
"windows_i686_msvc 0.42.1",
|
||||
"windows_x86_64_gnu 0.42.1",
|
||||
"windows_aarch64_msvc 0.42.2",
|
||||
"windows_i686_gnu 0.42.2",
|
||||
"windows_i686_msvc 0.42.2",
|
||||
"windows_x86_64_gnu 0.42.2",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc 0.42.1",
|
||||
"windows_x86_64_msvc 0.42.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.44.0"
|
||||
version = "0.46.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b"
|
||||
checksum = "cdacb41e6a96a052c6cb63a144f24900236121c6f63f4f8219fef5977ecb0c25"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
@ -2290,12 +2298,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc 0.42.1",
|
||||
"windows_i686_gnu 0.42.1",
|
||||
"windows_i686_msvc 0.42.1",
|
||||
"windows_x86_64_gnu 0.42.1",
|
||||
"windows_aarch64_msvc 0.42.2",
|
||||
"windows_i686_gnu 0.42.2",
|
||||
"windows_i686_msvc 0.42.2",
|
||||
"windows_x86_64_gnu 0.42.2",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc 0.42.1",
|
||||
"windows_x86_64_msvc 0.42.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2309,24 +2317,24 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
|
||||
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc 0.42.1",
|
||||
"windows_i686_gnu 0.42.1",
|
||||
"windows_i686_msvc 0.42.1",
|
||||
"windows_x86_64_gnu 0.42.1",
|
||||
"windows_aarch64_msvc 0.42.2",
|
||||
"windows_i686_gnu 0.42.2",
|
||||
"windows_i686_msvc 0.42.2",
|
||||
"windows_x86_64_gnu 0.42.2",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc 0.42.1",
|
||||
"windows_x86_64_msvc 0.42.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
|
||||
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
|
@ -2336,9 +2344,9 @@ checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
|
|||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
|
||||
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
|
@ -2348,9 +2356,9 @@ checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
|
|||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
|
||||
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
|
@ -2360,9 +2368,9 @@ checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
|
|||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
|
||||
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
|
@ -2372,15 +2380,15 @@ checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
|
|||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
|
||||
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
|
||||
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
|
@ -2390,9 +2398,9 @@ checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
|
|||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
|
||||
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
|
||||
|
||||
[[package]]
|
||||
name = "winit"
|
||||
|
|
|
@ -8,12 +8,18 @@ lto = true
|
|||
strip = true
|
||||
opt-level = "z"
|
||||
codegen-units = 1
|
||||
|
||||
[profile.debuga]
|
||||
inherits = "release"
|
||||
debug = true
|
||||
strip = false
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
poggers = {version = "0.2.*", path = "../poggers"}
|
||||
poggers = {version = "*", path = "../poggers"}
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
"gdke-gui",
|
||||
]
|
||||
|
||||
|
|
|
@ -13,4 +13,5 @@ codegen-units = 1
|
|||
[dependencies]
|
||||
egui = "0.21.0"
|
||||
eframe = { version = "0.21.3" }
|
||||
poggers = {version = "0.2.*", path = "../../poggers"}
|
||||
poggers = {version = "*", path = "../../poggers"}
|
||||
gdke = {path= ".."}
|
|
@ -2,14 +2,14 @@ use std::{borrow::BorrowMut, ops::Deref, sync::mpsc::{Receiver, Sender}, rc::Rc,
|
|||
|
||||
use eframe::CreationContext;
|
||||
use egui::{TextStyle, TextEdit};
|
||||
use poggers::external::process::{ExPartialProcess, ExProcess};
|
||||
use poggers::external::{process::{ExProcess}, create_snapshot::{STProcess, ToolSnapshot}};
|
||||
|
||||
use crate::Data;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct gdkeApp {
|
||||
procs : Rc<RefCell<Vec<ExPartialProcess>>>,
|
||||
selected: Option<ExPartialProcess>,
|
||||
procs : Rc<RefCell<Vec<STProcess>>>,
|
||||
selected: Option<STProcess>,
|
||||
awaiting: bool,
|
||||
last_key: String,
|
||||
process: Option<ExProcess>,
|
||||
|
@ -19,7 +19,7 @@ pub struct gdkeApp {
|
|||
}
|
||||
impl Default for gdkeApp {
|
||||
fn default() -> Self {
|
||||
let procs = if let Ok(procs) = ExProcess::get_processes() {
|
||||
let procs = if let Ok(procs) = ToolSnapshot::new_process().map(|x| x.collect()) {
|
||||
procs
|
||||
} else {
|
||||
Vec::new()
|
||||
|
@ -85,7 +85,7 @@ impl eframe::App for gdkeApp {
|
|||
let text_style = TextStyle::Body;
|
||||
let row_height = ui.text_style_height(&text_style);
|
||||
if ui.button("refresh processes").clicked() {
|
||||
procs.clone().borrow_mut().replace(if let Ok(procs) = ExProcess::get_processes() {
|
||||
procs.clone().borrow_mut().replace(if let Ok(procs) = ToolSnapshot::new_process().map(|x| x.collect()) {
|
||||
procs
|
||||
} else {
|
||||
Vec::new()
|
||||
|
@ -93,8 +93,8 @@ impl eframe::App for gdkeApp {
|
|||
}
|
||||
let mut procsrn = procs.clone();
|
||||
let proca = procsrn.borrow();
|
||||
let filtered_procs = if self.search_query.is_empty() {proca.iter().collect::<Vec::<&ExPartialProcess>>()} else {proca.iter()
|
||||
.filter(|p| p.name.contains(&self.search_query) || p.pid.to_string().contains(&self.search_query)).collect()
|
||||
let filtered_procs = if self.search_query.is_empty() {proca.iter().collect::<Vec::<&STProcess>>()} else {proca.iter()
|
||||
.filter(|p| p.exe_path.contains(&self.search_query) || p.id.to_string().contains(&self.search_query)).collect()
|
||||
};
|
||||
let selval = selected.clone();
|
||||
ui.separator();
|
||||
|
@ -103,14 +103,14 @@ impl eframe::App for gdkeApp {
|
|||
for row in row_range {
|
||||
if let Some(proc) = (&filtered_procs).get(row) {
|
||||
let owner_proc = proc.deref();
|
||||
ui.selectable_value(selected, Some(owner_proc.clone()) , proc.name.clone());
|
||||
ui.selectable_value(selected, Some(owner_proc.clone()) , &proc.exe_path);
|
||||
}
|
||||
}
|
||||
});
|
||||
if let Some(selected) = selval {
|
||||
ui.separator();
|
||||
if ui.button(format!("get key for {}",selected.name)).clicked() {
|
||||
tx.as_ref().unwrap().send(Data::Pid(selected.pid)).unwrap();
|
||||
if ui.button(format!("get key for {}",selected.exe_path)).clicked() {
|
||||
tx.as_ref().unwrap().send(Data::Pid(selected.id)).unwrap();
|
||||
*awaiting = true;
|
||||
last_key.clear();
|
||||
}
|
||||
|
|
|
@ -7,13 +7,6 @@ use std::error::Error;
|
|||
use gdke_gui::{app::gdkeApp, Data};
|
||||
use poggers::{external::process::ExProcess, traits::Mem};
|
||||
|
||||
const SIGS: [&str; 4] = [
|
||||
"48 8D 3D ? ? ? ? 48 85 C0 74 3B",
|
||||
"48 8D 05 ? ? ? ? 41 8A 04 04",
|
||||
"48 8D 05 ? ? ? ? 0F B6 ? 03",
|
||||
"4C 8D 05 ? ? ? ? 0F 1F 40 00",
|
||||
];
|
||||
|
||||
fn main() {
|
||||
let (stx, srx) = std::sync::mpsc::channel::<Data>();
|
||||
let (ctx, crx) = std::sync::mpsc::channel::<Data>();
|
||||
|
@ -25,36 +18,10 @@ fn main() {
|
|||
Data::Pid(pid) => {
|
||||
println!("Got pid: {}", pid);
|
||||
match (|| -> Result<(), Box<dyn Error>> {
|
||||
let proc = ExProcess::new_from_pid(pid)?;
|
||||
let bm = proc.get_base_module()?;
|
||||
for sig in SIGS.iter() {
|
||||
let res = unsafe { bm.scan_virtual(sig) };
|
||||
if let Some(x) = res {
|
||||
let data = unsafe { bm.resolve_relative_ptr(x + 3, 4) };
|
||||
if let Ok(x) = data {
|
||||
println!("found key @ {:X}", x);
|
||||
let key_data = unsafe { bm.read_sized(x, 32) };
|
||||
if let Ok(x) = key_data {
|
||||
// print!("Key: ");
|
||||
let mut data_string = String::new();
|
||||
for i in x {
|
||||
data_string.push_str(&format!("{:02X}", i));
|
||||
}
|
||||
println!("sending data {}", data_string);
|
||||
stx.send(Data::Key(data_string)).unwrap();
|
||||
return Ok(());
|
||||
}
|
||||
} else {
|
||||
return Err("Unable to resolve lea relative ptr".into());
|
||||
}
|
||||
// println!("Found sig: {:X}", x);
|
||||
} else {
|
||||
println!("Failed to find with sig: {}", sig);
|
||||
// return Err("Failed to find with sig".into());
|
||||
}
|
||||
}
|
||||
// Ok(())
|
||||
Err("Failed to find key".into())
|
||||
let key = gdke::get_from_pid(pid)?;
|
||||
stx.send(Data::Key(key)).unwrap();
|
||||
Ok(())
|
||||
// Err("Failed to find key".into())
|
||||
})() {
|
||||
Ok(_) => {}
|
||||
Err(er) => {
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
use std::error::Error;
|
||||
|
||||
use poggers::{external::process::ExProcess, traits::Mem};
|
||||
|
||||
pub const SIGS: [&str; 5] = [
|
||||
"48 8D 1D ? ? ? ? 4C 8D 2D ? ? ? ? 48 8D 35", // godot 4.0.0
|
||||
"48 8D 3D ? ? ? ? 48 85 C0 74 3B",
|
||||
"48 8D 05 ? ? ? ? 41 8A 04 04",
|
||||
"48 8D 05 ? ? ? ? 0F B6 ? 03",
|
||||
"4C 8D 05 ? ? ? ? 0F 1F 40 00",
|
||||
];
|
||||
|
||||
|
||||
pub fn get_from_pid(pid:u32) -> Result<String,Box<dyn Error>> {
|
||||
let proc = ExProcess::new_from_pid(pid)?;
|
||||
let bm = proc.get_base_module()?;
|
||||
for sig in &SIGS {
|
||||
let res = unsafe { bm.scan_virtual(sig) };
|
||||
if let Some(x) = res {
|
||||
let data = unsafe { bm.resolve_relative_ptr(x + 3, 4) };
|
||||
if let Ok(x) = data {
|
||||
println!("found key @ {:X}", x);
|
||||
let mut key_data = [0u8;32];
|
||||
if unsafe { bm.raw_read(x, &mut key_data as *mut u8,32) }.is_ok() && !key_data.is_empty() {
|
||||
let mut data_string = String::new();
|
||||
for i in &key_data[..] {
|
||||
data_string.push_str(&format!("{:02X}", i));
|
||||
}
|
||||
return Ok(data_string);
|
||||
}
|
||||
} else {
|
||||
return Err("Unable to resolve lea relative ptr".into());
|
||||
}
|
||||
// println!("Found sig: {:X}", x);
|
||||
} else {
|
||||
println!("Failed to find with sig: {}", sig);
|
||||
// return Err("Failed to find with sig".into());
|
||||
}
|
||||
}
|
||||
// Ok(())
|
||||
Err("Failed to find key".into())
|
||||
|
||||
}
|
34
src/main.rs
34
src/main.rs
|
@ -1,29 +1,13 @@
|
|||
use poggers::mem::{external::process::ExProcess, traits::Mem};
|
||||
|
||||
const SIGS: [&str; 3] = ["48 8D 05 ? ? ? ? 41 8A 04 04","48 8D 05 ? ? ? ? 0F B6 ? 03","4C 8D 05 ? ? ? ? 0F 1F 40 00"];
|
||||
use poggers::{external::process::ExProcess, traits::Mem};
|
||||
|
||||
fn main() {
|
||||
let proc = ExProcess::new_from_name("SoundSpacePlus.exe".to_string()).unwrap();
|
||||
let bm = proc.get_base_module().unwrap();
|
||||
for sig in SIGS.iter() {
|
||||
let res = unsafe {bm.scan_virtual(sig)};
|
||||
if let Some(x) = res {
|
||||
let data = unsafe {bm.resolve_relative_ptr(x+3, 4)};
|
||||
if let Ok(x) = data {
|
||||
println!("found key @ {:X}", x);
|
||||
let key_data = unsafe {bm.read_sized(x, 32)};
|
||||
if let Ok(x) = key_data {
|
||||
print!("Key: ");
|
||||
for i in x {
|
||||
print!("{:02X}", i);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
println!("Unable to resolve lea relative ptr");
|
||||
}
|
||||
// println!("Found sig: {:X}", x);
|
||||
} else {
|
||||
println!("Failed to find with sig: {}", sig);
|
||||
}
|
||||
let mut pid = 0;
|
||||
{
|
||||
let proc = ExProcess::new_from_name("4 Test.exe".to_string()).unwrap();
|
||||
pid = proc.get_pid();
|
||||
}
|
||||
|
||||
let key = gdke::get_from_pid(pid).expect("unable to find key");
|
||||
|
||||
println!("Key: {}", key);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue