Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import os
- def flip_bytes(binary_f):
- i = random.randint(0, len(binary_f))
- c = chr(random.randint(0, 0xFF))
- return binary_f[:i] + c + binary_f[i+1:]
- def copy_binary():
- with open("license", "rb") as orig_f, open("license_fuzz", "wb") as fuzz_f:
- fuzz_f.write(flip_bytes(orig_f.read()))
- def compare(fn1, fn2):
- with open(fn1) as f1, open(fn2) as f2:
- return f1.read == f2.read
- def check_output():
- os.system("(./license_fuzz ; ./license_fuzz unmfvsYy) > fuzz_output")
- return compare("orig_ouput", "fuzz_output")
- def check_rgb():
- os.system("(echo disassemble main | gdb license_fuzz) > gdb_fuzz_output")
- return compare("orig_gdb", "fuzz_gdb")
- def check_r2():
- os.system("(echo -e aaa\ns sym.main\npdf | r2 license_fuzz > fuzz_output")
- return compare("orig_r2", "fuzz_r2")
- while True:
- copy_binary()
- if check_output() and not check_gdb() and not check_r2:
- print("POSSIBLE FAIL:\n\n")
- os.system("tail fuzz_gdb fuzz_r2 fuzz ouput")
- input("Enter to continute, ctrl+c to exit...")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement