feat: scaffold openwa-validator WormKit DLL crate
Browse filesCo-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Cargo.lock +217 -0
- crates/openwa-validator/Cargo.toml +12 -0
- crates/openwa-validator/src/lib.rs +37 -0
Cargo.lock
CHANGED
|
@@ -2,6 +2,223 @@
|
|
| 2 |
# It is not intended for manual editing.
|
| 3 |
version = 4
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
[[package]]
|
| 6 |
name = "openwa-types"
|
| 7 |
version = "0.1.0"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
# It is not intended for manual editing.
|
| 3 |
version = 4
|
| 4 |
|
| 5 |
+
[[package]]
|
| 6 |
+
name = "bitflags"
|
| 7 |
+
version = "1.3.2"
|
| 8 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 9 |
+
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
| 10 |
+
|
| 11 |
+
[[package]]
|
| 12 |
+
name = "cfg-if"
|
| 13 |
+
version = "1.0.4"
|
| 14 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 15 |
+
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
| 16 |
+
|
| 17 |
+
[[package]]
|
| 18 |
+
name = "generic-array"
|
| 19 |
+
version = "0.14.9"
|
| 20 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 21 |
+
checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2"
|
| 22 |
+
dependencies = [
|
| 23 |
+
"typenum",
|
| 24 |
+
"version_check",
|
| 25 |
+
]
|
| 26 |
+
|
| 27 |
+
[[package]]
|
| 28 |
+
name = "iced-x86"
|
| 29 |
+
version = "1.21.0"
|
| 30 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 31 |
+
checksum = "7c447cff8c7f384a7d4f741cfcff32f75f3ad02b406432e8d6c878d56b1edf6b"
|
| 32 |
+
dependencies = [
|
| 33 |
+
"lazy_static",
|
| 34 |
+
]
|
| 35 |
+
|
| 36 |
+
[[package]]
|
| 37 |
+
name = "lazy_static"
|
| 38 |
+
version = "1.5.0"
|
| 39 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 40 |
+
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
| 41 |
+
|
| 42 |
+
[[package]]
|
| 43 |
+
name = "libc"
|
| 44 |
+
version = "0.2.182"
|
| 45 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 46 |
+
checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112"
|
| 47 |
+
|
| 48 |
+
[[package]]
|
| 49 |
+
name = "mach2"
|
| 50 |
+
version = "0.4.3"
|
| 51 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 52 |
+
checksum = "d640282b302c0bb0a2a8e0233ead9035e3bed871f0b7e81fe4a1ec829765db44"
|
| 53 |
+
dependencies = [
|
| 54 |
+
"libc",
|
| 55 |
+
]
|
| 56 |
+
|
| 57 |
+
[[package]]
|
| 58 |
+
name = "mmap-fixed-fixed"
|
| 59 |
+
version = "0.1.3"
|
| 60 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 61 |
+
checksum = "0681853891801e4763dc252e843672faf32bcfee27a0aa3b19733902af450acc"
|
| 62 |
+
dependencies = [
|
| 63 |
+
"libc",
|
| 64 |
+
"winapi",
|
| 65 |
+
]
|
| 66 |
+
|
| 67 |
+
[[package]]
|
| 68 |
+
name = "once_cell"
|
| 69 |
+
version = "1.21.3"
|
| 70 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 71 |
+
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
| 72 |
+
|
| 73 |
[[package]]
|
| 74 |
name = "openwa-types"
|
| 75 |
version = "0.1.0"
|
| 76 |
+
|
| 77 |
+
[[package]]
|
| 78 |
+
name = "openwa-validator"
|
| 79 |
+
version = "0.1.0"
|
| 80 |
+
dependencies = [
|
| 81 |
+
"openwa-types",
|
| 82 |
+
"retour",
|
| 83 |
+
]
|
| 84 |
+
|
| 85 |
+
[[package]]
|
| 86 |
+
name = "region"
|
| 87 |
+
version = "3.0.2"
|
| 88 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 89 |
+
checksum = "e6b6ebd13bc009aef9cd476c1310d49ac354d36e240cf1bd753290f3dc7199a7"
|
| 90 |
+
dependencies = [
|
| 91 |
+
"bitflags",
|
| 92 |
+
"libc",
|
| 93 |
+
"mach2",
|
| 94 |
+
"windows-sys",
|
| 95 |
+
]
|
| 96 |
+
|
| 97 |
+
[[package]]
|
| 98 |
+
name = "retour"
|
| 99 |
+
version = "0.4.0-alpha.4"
|
| 100 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 101 |
+
checksum = "ead4bc8e12d553ff70769c5f5c21f5f4f0e73c0018068a6bb5a3d7d3b9e57ec7"
|
| 102 |
+
dependencies = [
|
| 103 |
+
"cfg-if",
|
| 104 |
+
"generic-array",
|
| 105 |
+
"iced-x86",
|
| 106 |
+
"libc",
|
| 107 |
+
"mmap-fixed-fixed",
|
| 108 |
+
"once_cell",
|
| 109 |
+
"region",
|
| 110 |
+
"slice-pool2",
|
| 111 |
+
]
|
| 112 |
+
|
| 113 |
+
[[package]]
|
| 114 |
+
name = "slice-pool2"
|
| 115 |
+
version = "0.4.3"
|
| 116 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 117 |
+
checksum = "7a3d689654af89bdfeba29a914ab6ac0236d382eb3b764f7454dde052f2821f8"
|
| 118 |
+
|
| 119 |
+
[[package]]
|
| 120 |
+
name = "typenum"
|
| 121 |
+
version = "1.19.0"
|
| 122 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 123 |
+
checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"
|
| 124 |
+
|
| 125 |
+
[[package]]
|
| 126 |
+
name = "version_check"
|
| 127 |
+
version = "0.9.5"
|
| 128 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 129 |
+
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
| 130 |
+
|
| 131 |
+
[[package]]
|
| 132 |
+
name = "winapi"
|
| 133 |
+
version = "0.3.9"
|
| 134 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 135 |
+
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
| 136 |
+
dependencies = [
|
| 137 |
+
"winapi-i686-pc-windows-gnu",
|
| 138 |
+
"winapi-x86_64-pc-windows-gnu",
|
| 139 |
+
]
|
| 140 |
+
|
| 141 |
+
[[package]]
|
| 142 |
+
name = "winapi-i686-pc-windows-gnu"
|
| 143 |
+
version = "0.4.0"
|
| 144 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 145 |
+
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
| 146 |
+
|
| 147 |
+
[[package]]
|
| 148 |
+
name = "winapi-x86_64-pc-windows-gnu"
|
| 149 |
+
version = "0.4.0"
|
| 150 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 151 |
+
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
| 152 |
+
|
| 153 |
+
[[package]]
|
| 154 |
+
name = "windows-sys"
|
| 155 |
+
version = "0.52.0"
|
| 156 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 157 |
+
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
| 158 |
+
dependencies = [
|
| 159 |
+
"windows-targets",
|
| 160 |
+
]
|
| 161 |
+
|
| 162 |
+
[[package]]
|
| 163 |
+
name = "windows-targets"
|
| 164 |
+
version = "0.52.6"
|
| 165 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 166 |
+
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
| 167 |
+
dependencies = [
|
| 168 |
+
"windows_aarch64_gnullvm",
|
| 169 |
+
"windows_aarch64_msvc",
|
| 170 |
+
"windows_i686_gnu",
|
| 171 |
+
"windows_i686_gnullvm",
|
| 172 |
+
"windows_i686_msvc",
|
| 173 |
+
"windows_x86_64_gnu",
|
| 174 |
+
"windows_x86_64_gnullvm",
|
| 175 |
+
"windows_x86_64_msvc",
|
| 176 |
+
]
|
| 177 |
+
|
| 178 |
+
[[package]]
|
| 179 |
+
name = "windows_aarch64_gnullvm"
|
| 180 |
+
version = "0.52.6"
|
| 181 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 182 |
+
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
| 183 |
+
|
| 184 |
+
[[package]]
|
| 185 |
+
name = "windows_aarch64_msvc"
|
| 186 |
+
version = "0.52.6"
|
| 187 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 188 |
+
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
| 189 |
+
|
| 190 |
+
[[package]]
|
| 191 |
+
name = "windows_i686_gnu"
|
| 192 |
+
version = "0.52.6"
|
| 193 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 194 |
+
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
| 195 |
+
|
| 196 |
+
[[package]]
|
| 197 |
+
name = "windows_i686_gnullvm"
|
| 198 |
+
version = "0.52.6"
|
| 199 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 200 |
+
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
| 201 |
+
|
| 202 |
+
[[package]]
|
| 203 |
+
name = "windows_i686_msvc"
|
| 204 |
+
version = "0.52.6"
|
| 205 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 206 |
+
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
| 207 |
+
|
| 208 |
+
[[package]]
|
| 209 |
+
name = "windows_x86_64_gnu"
|
| 210 |
+
version = "0.52.6"
|
| 211 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 212 |
+
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
| 213 |
+
|
| 214 |
+
[[package]]
|
| 215 |
+
name = "windows_x86_64_gnullvm"
|
| 216 |
+
version = "0.52.6"
|
| 217 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 218 |
+
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
| 219 |
+
|
| 220 |
+
[[package]]
|
| 221 |
+
name = "windows_x86_64_msvc"
|
| 222 |
+
version = "0.52.6"
|
| 223 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
| 224 |
+
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
crates/openwa-validator/Cargo.toml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[package]
|
| 2 |
+
name = "openwa-validator"
|
| 3 |
+
version = "0.1.0"
|
| 4 |
+
edition = "2021"
|
| 5 |
+
description = "WormKit DLL that validates openwa-types against live WA.exe memory"
|
| 6 |
+
|
| 7 |
+
[lib]
|
| 8 |
+
crate-type = ["cdylib"]
|
| 9 |
+
|
| 10 |
+
[dependencies]
|
| 11 |
+
openwa-types = { path = "../openwa-types" }
|
| 12 |
+
retour = { version = "0.4.0-alpha.4", features = ["static-detour", "thiscall-abi"] }
|
crates/openwa-validator/src/lib.rs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#![allow(non_snake_case)]
|
| 2 |
+
|
| 3 |
+
use std::ffi::c_void;
|
| 4 |
+
|
| 5 |
+
const DLL_PROCESS_ATTACH: u32 = 1;
|
| 6 |
+
|
| 7 |
+
#[no_mangle]
|
| 8 |
+
unsafe extern "system" fn DllMain(
|
| 9 |
+
_module: *mut c_void,
|
| 10 |
+
reason: u32,
|
| 11 |
+
_reserved: *mut c_void,
|
| 12 |
+
) -> i32 {
|
| 13 |
+
if reason == DLL_PROCESS_ATTACH {
|
| 14 |
+
std::thread::spawn(|| {
|
| 15 |
+
if let Err(e) = run_validation() {
|
| 16 |
+
let _ = log_line(&format!("[FATAL] Validation failed to run: {}", e));
|
| 17 |
+
}
|
| 18 |
+
});
|
| 19 |
+
}
|
| 20 |
+
1 // TRUE
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
fn run_validation() -> Result<(), Box<dyn std::error::Error>> {
|
| 24 |
+
let _ = log_line("=== OpenWA Validator ===");
|
| 25 |
+
let _ = log_line("DLL loaded successfully. Validation will follow.");
|
| 26 |
+
Ok(())
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
fn log_line(msg: &str) -> std::io::Result<()> {
|
| 30 |
+
use std::io::Write;
|
| 31 |
+
let mut f = std::fs::OpenOptions::new()
|
| 32 |
+
.create(true)
|
| 33 |
+
.append(true)
|
| 34 |
+
.open("OpenWA_validation.log")?;
|
| 35 |
+
writeln!(f, "{}", msg)?;
|
| 36 |
+
Ok(())
|
| 37 |
+
}
|