Created
February 21, 2024 22:00
-
-
Save SoftPoison/fe10ea3cf9e231fdc79ed8d0d5ed2ed4 to your computer and use it in GitHub Desktop.
Decode the device name for a crackproof driver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
// get this from within the driver (sometimes at 0x15000) | |
let mut data: [u16; 11] = [ | |
0x0087, 0x0068, 0x00bc, 0x005b, 0x008c, 0x0073, 0x0094, 0x00f7, 0x00d7, 0x00c1, 0x0000, | |
]; | |
let mut key: u16 = 0x5555; | |
for i in 0..data.len() { | |
let mut name_char = data[i]; | |
key = (key << 2) + i as u16; | |
let something = name_char >> 6; | |
if something.wrapping_sub(1) > 2 { | |
break; | |
} | |
name_char ^= key; | |
name_char = name_char.wrapping_sub(i as u16); | |
name_char = name_char.wrapping_sub(something); | |
name_char &= 0x3f; | |
let mut out: u16 = 0; | |
if name_char < 0xa { | |
out = name_char + 0x30; | |
} | |
if (0xa..0x24).contains(&name_char) { | |
out = name_char + 0x37; | |
} | |
if (0x24..0x3e).contains(&name_char) { | |
out = name_char + 0x3d; | |
} | |
if name_char == 0x3e { | |
out = 0x2e; | |
} | |
if out == 0 { | |
break; | |
} | |
data[i] = out; | |
} | |
let output = String::from_utf16_lossy(&data); | |
println!("{output}"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment