-
Notifications
You must be signed in to change notification settings - Fork 31
/
fb.py
87 lines (75 loc) · 2.6 KB
/
fb.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
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/python2.6
import code
import os
import sys
from fuzzbunch import env
"""
Set up core paths
"""
(FB_FILE, FB_DIR, EDFLIB_DIR) = env.setup_core_paths( os.path.realpath(__file__))
"""
Make sure our libraries are setup properly
"""
#env.setup_lib_paths(os.path.abspath(__file__), EDFLIB_DIR)
"""
Plugin directories
"""
PAYLOAD_DIR = os.path.join(FB_DIR, "payloads")
EXPLOIT_DIR = os.path.join(FB_DIR, "exploits")
TOUCH_DIR = os.path.join(FB_DIR, "touches")
IMPLANT_DIR = os.path.join(FB_DIR, "implants")
#LP_DIR = os.path.join(FB_DIR, "listeningposts")
#EDE_DIR = os.path.join(FB_DIR, "ede-exploits")
#TRIGGER_DIR = os.path.join(FB_DIR, "triggers")
SPECIAL_DIR = os.path.join(FB_DIR, "specials")
"""
Fuzzbunch directories
"""
LOG_DIR = os.path.join(FB_DIR, "logs")
FB_CONFIG = os.path.join(FB_DIR, "Fuzzbunch.xml")
from fuzzbunch.edfplugin import EDFPlugin
#from fuzzbunch.edeplugin import EDEPlugin
from fuzzbunch.fuzzbunch import Fuzzbunch
from fuzzbunch.pluginfinder import addplugins, PluginfinderError
from fuzzbunch import exception
from fuzzbunch.daveplugin import DAVEPlugin
from fuzzbunch.deployablemanager import DeployableManager
def do_interactive(fb):
gvars = globals()
gvars['quit'] = (lambda *x: fb.io.print_error("Press Ctrl-D to quit"))
gvars['exit'] = gvars['quit']
fb.io.print_warning("Dropping to Interactive Python Interpreter")
fb.io.print_warning("Press Ctrl-D to exit")
code.interact(local=gvars, banner="")
def main(fb):
#fb.printbanner()
fb.cmdqueue.append("retarget")
while 1:
try:
fb.cmdloop()
except exception.Interpreter:
do_interactive(fb)
else:
break
def load_plugins(fb):
fb.io.pre_input(None)
fb.io.print_msg("Loading Plugins")
fb.io.post_input()
addplugins(fb, "Exploit", EXPLOIT_DIR, EDFPlugin)
addplugins(fb, "Payload", PAYLOAD_DIR, EDFPlugin)
addplugins(fb, "Touch", TOUCH_DIR, EDFPlugin)
addplugins(fb, "ImplantConfig", IMPLANT_DIR, EDFPlugin)
#addplugins(fb, "ListeningPost", LP_DIR, EDFPlugin)
addplugins(fb, "Special", SPECIAL_DIR, DAVEPlugin, DeployableManager)
# addplugins(fb, "EDE-Exploit", EDE_DIR, EDEPlugin)
# addplugins(fb, "Trigger", TRIGGER_DIR, EDFPlugin)
@exception.exceptionwrapped
def setup_and_run(config, fbdir, logdir):
# Setup fb globally so that we can debug interactively if we want
global fb
fb = Fuzzbunch(config, fbdir, logdir)
fb.printbanner()
load_plugins(fb)
main(fb)
if __name__ == "__main__":
setup_and_run(FB_CONFIG, FB_DIR, LOG_DIR)