Skip to main content

in_pattern_scanning/
in_pattern_scanning.rs

1/*
2This is an example to demonstrate how to use powerful pattern scan feature in toy-arms.
3Make sure you inject this image to csgo.exe.
4The model pattern is for dwForceAttack.
5*/
6
7use toy_arms::{
8    detect_keypress,
9    internal::{
10        Module
11    },
12    VirtualKeyCode
13};
14toy_arms::create_entrypoint!(hack_main_thread);
15
16const DW_FORCE_ATTACK_PATTERN: &str = "89 0D ? ? ? ? 8B 0D ? ? ? ? 8B F2 8B C1 83 CE 04";
17
18fn hack_main_thread() {
19    let mut once = false;
20
21    let client = Module::from_module_name("client.dll").unwrap();
22
23    match client.find_pattern(DW_FORCE_ATTACK_PATTERN) {
24        Some(i) => println!("address: 0x{:x}", i),
25        None => println!("Pattern not found"),
26    }
27
28    match client.pattern_scan(
29        DW_FORCE_ATTACK_PATTERN,
30        2,
31        0,
32    ) {
33        Some(i) => println!("address: 0x{:x}", i),
34        None => println!("Offset not found"),
35    }
36
37    loop {
38        if !once {
39            println!("Press INSERT to exit...");
40            once = !once;
41        }
42        // To exit this hack loop when you input INSEERT KEY
43        if detect_keypress(VirtualKeyCode::VK_INSERT) {
44            break;
45        }
46    }
47}