From 0aa9684c704c3f4f4ce6e7678af9f18bc2a1c6b6 Mon Sep 17 00:00:00 2001 From: fouzhe <862006904@qq.com> Date: Tue, 8 Jan 2019 13:14:35 +0000 Subject: [PATCH] add check in create_dict --- tfuzz/utils.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tfuzz/utils.py b/tfuzz/utils.py index 761a2dc..4dbd3d9 100644 --- a/tfuzz/utils.py +++ b/tfuzz/utils.py @@ -1,6 +1,7 @@ import os import sys import subprocess +import re from fuzzer import Fuzzer as __angr_Fuzzer @@ -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)