-
Notifications
You must be signed in to change notification settings - Fork 2
/
run-slice.py
33 lines (26 loc) · 1.07 KB
/
run-slice.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import os
import magic
from concurrent.futures import ProcessPoolExecutor
import subprocess
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-i','--bin', type=str, help='binary')
parser.add_argument('-o','--output_dir', type=str, nargs='?',
help='Output dir', default='./output-slice')
parser.add_argument('-n','--workers', type=int, nargs='?',
help='Max Workers', default=1)
parser.add_argument('--ida_path', type=str, nargs='?',
help='idapro dir', default='/workspace/idapro-7.6/idat64')
args = parser.parse_args()
def run(bin_path, output_dir):
filename = bin_path.split(os.path.sep)[-1]
script_cmd = './util_slice.py {}'.format(output_dir)
ida_cmd = 'env TERM=xterm {} -L"log/{}.log" -A -S"{}" {}'.format(args.ida_path, filename, script_cmd, bin_path)
print(ida_cmd)
subprocess.run(ida_cmd, shell=True)
def main():
output_dir = os.path.join(args.output_dir,'aict')
os.makedirs(output_dir, exist_ok=True)
run(args.bin, output_dir)
if __name__ == '__main__':
main()