This repository has been archived by the owner on Jan 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
adbfuzzconfig.py
74 lines (65 loc) · 2.83 KB
/
adbfuzzconfig.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
66
67
68
69
70
71
72
73
74
#!/usr/bin/env python
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 2.0
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# The Original Code is ADBFuzz.
#
# The Initial Developer of the Original Code is Christian Holler (decoder).
#
# Contributors:
# Christian Holler <[email protected]> (Original Developer)
#
# ***** END LICENSE BLOCK *****
from ConfigParser import SafeConfigParser
class ADBFuzzConfig:
def __init__(self, cfgFile):
cfgDefaults = {}
cfgDefaults['id'] = None
cfgDefaults['remoteHost'] = None
cfgDefaults['localPort'] = '8088'
cfgDefaults['useWebSockets'] = False
cfgDefaults['localWebSocketPort'] = '8089'
cfgDefaults['localListenPort'] = '8090'
cfgDefaults['localPortOffset'] = '0'
cfgDefaults['libDir'] = None
cfgDefaults['knownPath'] = None
cfgDefaults['debug'] = str(False)
cfgDefaults['useMail'] = str(False)
cfgDefaults['runTimeout'] = str(5)
cfgDefaults['maxLogSize'] = str(1024*1024) # Default to 1 MB maximum log
cfgDefaults['addon'] = None
self.cfg = SafeConfigParser(cfgDefaults)
if (len(self.cfg.read(cfgFile)) == 0):
raise Exception("Unable to read configuration file: " + cfgFile)
self.id = self.cfg.get('main', 'id')
self.fuzzerFile = self.cfg.get('main', 'fuzzer')
self.runTimeout = self.cfg.getint('main', 'runTimeout')
self.maxLogSize = self.cfg.getint('main', 'maxLogSize')
self.remoteAddr = self.cfg.get('main', 'remoteHost')
self.localAddr = self.cfg.get('main', 'localHost')
self.localPort = self.cfg.get('main', 'localPort')
self.debug = self.cfg.getboolean('main', 'debug')
self.knownPath = self.cfg.get('main', 'knownPath')
self.addon = self.cfg.get('main', 'addon')
self.useWebSockets = self.cfg.getboolean('main', 'useWebSockets')
self.localWebSocketPort = self.cfg.get('main', 'localWebSocketPort')
self.localListenPort = self.cfg.get('main', 'localListenPort')
self.localPortOffset = self.cfg.get('main', 'localPortOffset')
self.libDir = self.cfg.get('main', 'libDir')
# Mail configuration
self.useMail = self.cfg.getboolean('main', 'useMail')
if self.useMail:
self.mailFrom = self.cfg.get('main', 'mailFrom')
self.mailTo = self.cfg.get('main', 'mailTo')
self.SMTPHost = self.cfg.get('main', 'SMTPHost')
# Add our port offset to all local ports
portOffset = int(self.localPortOffset)
self.localPort = str(int(self.localPort) + portOffset)
self.localWebSocketPort = str(int(self.localWebSocketPort) + portOffset)
self.localListenPort = str(int(self.localListenPort) + portOffset)
if __name__ == "__main__":
raise Exception("This module cannot run standalone, but is used by ADBFuzz")