Skip to content

Commit

Permalink
add check in create_dict
Browse files Browse the repository at this point in the history
  • Loading branch information
fouzhe committed Jan 8, 2019
1 parent 7d150e4 commit 0aa9684
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tfuzz/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import sys
import subprocess
import re

from fuzzer import Fuzzer as __angr_Fuzzer

Expand All @@ -9,9 +10,16 @@ def create_dict(binary, dict_filename):
"bin", "create_dict.py")
args = [sys.executable, create_dict_script, binary]

with open(dict_filename, 'wb') as df:
with open(dict_filename+'.org', 'wb') as df:
p = subprocess.Popen(args, stdout=df)
retcode = p.wait()

out=open(dict_filename+'.org')
file=open(dict_filename,'w')
for line in out:
match=re.match(r"string_[\d]+=.+[\n]{0,1}",line)
if match:
file.writelines(line)

return retcode == 0 and os.path.getsize(dict_filename)

Expand Down

0 comments on commit 0aa9684

Please sign in to comment.