This commit is contained in:
TinyCaviar 2023-08-07 20:48:53 +08:00
parent 636ec90a1c
commit 2ec7e5e212

View File

@ -15,8 +15,8 @@ def call_preprocess(cmd_line):
subprocess.call(cmd_line, shell=True) subprocess.call(cmd_line, shell=True)
def batch_mode(): def batch_mode(start, end):
for workflow in range(1, 20): for workflow in range(start, end):
# workflow = 0 # workflow = 0
pe_dir = 'D:\\hkn\\infected\\datasets\\virusshare_infected{}'.format(workflow) pe_dir = 'D:\\hkn\\infected\\datasets\\virusshare_infected{}'.format(workflow)
# for test # for test
@ -38,8 +38,7 @@ def batch_mode():
# for test # for test
# cmd_line = r'idaq64 -c -A -S"D:\hkn\project_folder\Gencoding3\Genius3\raw-feature-extractor\preprocessing_ida.py {}" -oF:\iout {}'.format( # cmd_line = r'idaq64 -c -A -S"D:\hkn\project_folder\Gencoding3\Genius3\raw-feature-extractor\preprocessing_ida.py {}" -oF:\iout {}'.format(
# workflow, os.path.join(pe_dir, pe)) # workflow, os.path.join(pe_dir, pe))
cmd_line = r'idaq64 -c -A -S"D:\hkn\project_folder\Gencoding3\Genius3\raw-feature-extractor\preprocessing_ida.py {}" -oF:\iout {}'.format( cmd_line = r'idaq64 -c -A -S"D:\hkn\project_folder\Gencoding3\Genius3\raw-feature-extractor\preprocessing_ida.py {}" -oF:\iout {}'.format(workflow, os.path.join(pe_dir, pe))
workflow, os.path.join(pe_dir, pe))
p = multiprocessing.Process(target=call_preprocess, args=[cmd_line]) p = multiprocessing.Process(target=call_preprocess, args=[cmd_line])
p.start() p.start()
@ -54,8 +53,7 @@ def batch_mode():
if flag_kill: if flag_kill:
subprocess.call('taskkill /im idaq64.exe /f') subprocess.call('taskkill /im idaq64.exe /f')
process_log.write( process_log.write("index {}, {} in workflow {} stuck, process terminated.\n".format(index, pe, workflow))
"index {}, {} in workflow {} stuck, process terminated.\n".format(index, pe, workflow))
else: else:
# 正常运行结束 # 正常运行结束
log.truncate(0) log.truncate(0)
@ -69,10 +67,11 @@ def batch_mode():
def delete_output(): def delete_output():
out_dir = 'F:\\iout' out_dir = 'F:\\iout'
os.rmdir(out_dir) for f in os.listdir(out_dir):
os.mkdir(out_dir) os.remove(f)
# 注意该py文件必须放在IDA的根目录下且必须使用cmd命令执行否则无法链接到python库 # 注意该py文件必须放在IDA的根目录下且必须使用cmd命令执行否则无法链接到python库
# F:\\kkk\\IDA_6.6
if __name__ == '__main__': if __name__ == '__main__':
batch_mode() batch_mode(20, 35)