-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
obfuscate_pseudoc: A simple tool to somewhat obfuscate PseudoC.
Purpose: convert real-world subjects into abstract testcases.
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env python3 | ||
import sys | ||
import re | ||
|
||
|
||
start_addr = None | ||
out_f = None | ||
|
||
|
||
with open(sys.argv[1]) as f: | ||
for l in f: | ||
addr = int(l[:8], 16) | ||
l = l[8:] | ||
|
||
if start_addr is None: | ||
start_addr = addr | ||
out_f = open("fun_%08x.lst" % (~start_addr & 0xffffffff), "w") | ||
|
||
def repl(m): | ||
return m.group(1) + "%08x" % (int(m.group(2), 16) - start_addr) | ||
|
||
l = re.sub(r"(loc_)([0-9A-Fa-f]{8})", repl, l) | ||
|
||
addr -= start_addr | ||
out_f.write("%08x%s" % (addr, l)) |