Skip to content

Commit

Permalink
obfuscate_pseudoc: A simple tool to somewhat obfuscate PseudoC.
Browse files Browse the repository at this point in the history
Purpose: convert real-world subjects into abstract testcases.
  • Loading branch information
pfalcon committed Jan 5, 2018
1 parent 943dd11 commit f15358b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions obfuscate_pseudoc.py
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))

0 comments on commit f15358b

Please sign in to comment.