-
Notifications
You must be signed in to change notification settings - Fork 9
/
benchmarks_running.py
71 lines (58 loc) · 2.48 KB
/
benchmarks_running.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
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
65
#!/usr/bin/env python3
import argparse
import claripy,angr,monkeyhex
from analysis.CFGPartAnalysis import CFGPartAnalysis
from analysis.simprocedure.vul_strcat import _strcat_vul
from analysis.InitRun import InitRun
from analysis.VTree import _VTree
from analysis.VulAnalyzer import VulAnalyzer
import sys, os
sys.setrecursionlimit(2000)
for i in range(1, 226):
print('===================')
print("| Program No.: " + str(i))
print('===================')
proj=angr.Project('./tests/' + str(i),load_options={'auto_load_libs':False})
angr.AnalysesHub.register_default('CFGPartAnalysis',CFGPartAnalysis)
angr.AnalysesHub.register_default('VTree',_VTree)
angr.AnalysesHub.register_default('VulAnalyzer',VulAnalyzer)
cfg_an=proj.analyses.CFGPartAnalysis()
if (i >= 1 and i <= 90 ):
checkType = 0
elif (i >= 119 and i <= 206):
checkType = 1
elif (i >= 91 and i <= 118):
checkType = 2
elif (i >= 207 and i <= 225):
checkType = 3
an=proj.analyses.VulAnalyzer(cfg_an, checkType, False)
if (i >= 1 and i <= 90 ):
u = an.propOverflowUnits("HOF")
elif (i >= 119 and i <= 206):
u = an.propOverflowUnits("SOF")
else:
u = an.propWUnits()
for unit in u:
print("Test Unit : <{}>".format(unit))
proj=angr.Project('./tests/' + str(i),load_options={'auto_load_libs':False})
angr.AnalysesHub.register_default('CFGPartAnalysis',CFGPartAnalysis)
angr.AnalysesHub.register_default('VTree',_VTree)
angr.AnalysesHub.register_default('VulAnalyzer',VulAnalyzer)
cfg_an=proj.analyses.CFGPartAnalysis()
if (i >= 150 and i <= 152):
an=proj.analyses.VulAnalyzer(cfg_an, checkType, False, 100, 180)
elif (i >= 153 and i <= 172):
an=proj.analyses.VulAnalyzer(cfg_an, checkType, False, 180, 180)
else:
an=proj.analyses.VulAnalyzer(cfg_an, checkType, False, 120, 130)
if i in [12, 14, 15, 31, 33, 35, 51, 53, 55, 87, 89, 90, 133, 134, 135, 150, 151, 152, 162, 172, 187, 188, 189, 204, 205, 206]:
prototype = 'void ' + unit + '(char*, char*)'
size = [0,180]
else:
prototype = 'void ' + unit + '(char*)'
size = [180]
if checkType < 2 :
an.overflowAnalyze(prototype,args_index=[1],arg_sizes=size,buff_type=checkType)
else :
an.analyze(prototype,args_index=[1],arg_sizes=size,VulnType=checkType)
print('\n\n')