forked from HexHive/T-Fuzz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TFuzz
executable file
·64 lines (48 loc) · 1.9 KB
/
TFuzz
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python
import os
import sys
import signal
import argparse
import logging
from fuzzer import Fuzzer as __angr_Fuzzer
from tfuzz.tfuzz_sys import TFuzzSys
def main():
__angr_Fuzzer._perform_env_checks()
parser = argparse.ArgumentParser(description='tfuzz user interface')
parser.add_argument('--program', required=True, help='path to the program to fuzz')
parser.add_argument('--work_dir', required=True, help='the work directory for tfuzz')
parser.add_argument('--seed_dir', help='the work directory of initial seeds')
parser.add_argument('--target_opts', help='The options to pass to the argument')
parser.add_argument('-v', "--verbose", help='Increase the logging verbosity',
action='store_true')
parser.add_argument('--ph', default='@@', help='The place holder for input file to fuzz')
args = parser.parse_args()
if args.verbose:
logging.getLogger('tfuzz').setLevel(logging.DEBUG)
program = os.path.abspath(args.program)
print(program)
if not os.path.exists(program):
print("%s does not exist" % (args.program))
sys.exit(-1)
work_dir = os.path.abspath(args.work_dir)
seeds = []
if args.seed_dir != None:
seed_dir = os.path.abspath(args.seed_dir)
if not os.path.exists(seed_dir):
print("%s does not exist" % (args.seed_dir))
sys.exit(-1)
for sf in os.listdir(seed_dir):
seeds.append(os.path.join(seed_dir, sf))
if args.target_opts != None:
argv = args.target_opts.split(' ')
else:
argv = None
tfuzzsys = TFuzzSys(program, work_dir, target_opts=argv,
input_placeholder=args.ph, seed_files=seeds)
tfuzzsys.run()
def ctrlc_handler(signal, frame):
tfuzzsys.stop()
sys.exit(0)
signal.signal(signal.SIGINT, ctrlc_handler)
if __name__ == '__main__':
main()