1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*!
Inspect the generated assembly to verify obfuscation works at the binary level.
# Step 1 — Run (sanity check)
cargo run --example inspect_asm
Expected output:
obfstmt: 69016
obfstr: Hello world!
obfstr: AB
obfstr: This literal is very very very long to see if it correctly handles long strings
xref: 3141592
# Step 2 — Compile + dump assembly
cargo rustc --release --example inspect_asm -- --emit asm -C "llvm-args=-x86-asm-syntax=intel"
→ Assembly written to target/release/examples/inspect_asm.s
# Step 3 — Verify the assembly
## 3a. obfstr — plaintext must NOT appear in .rodata
In the assembly file, search for each obfuscated string:
- "Hello world!" → should NOT be found
- "AB" → should NOT be found
- "This literal…" → should NOT be found
If any plaintext appears as a static string constant, the obfuscation failed.
## 3b. obfstmt — control flow must be randomised
Find the `obfstmt` function in the assembly.
You should see a `match`-like dispatch (cmp/jump table) where each branch
corresponds to one statement — but the order is not the source order.
The original sequence `i = 5; i *= 24; …` should not be visible as a
straight-line block.
## 3c. xref — no direct symbol reference
Find the `xref` function. It should NOT contain a direct `lea` instruction
pointing to the static `FOO`. Instead you should see opaque pointer arithmetic
(add/sub/xor/rotate) that reconstructs the address at runtime.
# How #[inline(never)] helps
Each function is marked #[inline(never)] so it appears as a standalone
symbol in the assembly. In a real binary these functions would be inlined
and mixed with surrounding code — the obfuscation still works, but it is
harder to isolate for inspection.
*/