forked from JaanusKaapPublic/Vanapagan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuzzConf.py
61 lines (48 loc) · 1.47 KB
/
fuzzConf.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
import json
class fuzzConf:
name = "default"
input = ".\\input"
retry = 1
binaries = []
executable = None
regsToDelete = []
filesToDelete = []
windowToInteract = None
windowToInteractKey = None
logNullCrashes = False
restartWhenException = False
restartWhenLoop = False
maxWait = 90
logging = [
{
"type": "filesystem",
"dir": ".\\Crashes"
}
]
mutators = [
{
"type": "bitflip",
"rate": 40000
},
{
"type": "special",
"rate": 60000
}
]
def __init__(self, confFile):
data = json.load(open(confFile, "rb"))
self.initializeValues(data)
def checkConfFields(self, data):
if "executable" not in data:
raise Exception("No 'executable' field")
def initializeValues(self, data):
self.checkConfFields(data)
for field in ["name", "input", "retry", "executable", "binaries", "logNullCrashes", "regsToDelete", "filesToDelete", "logging", "mutators", "restartWhenException", "restartWhenLoop", "windowToInteract", "windowToInteractKey", "maxWait"]:
if field in data:
setattr(self, field, data[field])
self.fixConfFields()
def fixConfFields(self):
if len(self.logging) == 0:
raise Exception("No logging configured")
while self.input[-1] in ["\\", "/"]:
self.input = self.input[0:-1]