-
Notifications
You must be signed in to change notification settings - Fork 0
/
isf.py
86 lines (71 loc) · 2.18 KB
/
isf.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
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import code
import os,sys
import lib
from core import env
from core import util
from core.edfplugin import EDFPlugin
from core.fuzzbunch import Fuzzbunch
from core.pluginfinder import addplugins
from core import exception
from core.daveplugin import DAVEPlugin
from core.deployablemanager import DeployableManager
"""
Set up core paths
"""
(ISF_FILE, ISF_DIR, EDFLIB_DIR) = env.setup_core_paths( os.path.realpath(__file__))
"""
Plugin directories
"""
PAYLOAD_DIR = os.path.join(ISF_DIR, "module/payloads")
EXPLOIT_DIR = os.path.join(ISF_DIR, "module/exploits")
TOUCH_DIR = os.path.join(ISF_DIR, "module/touches")
SPECIAL_DIR = os.path.join(ISF_DIR, "module/specials")
"""
ISF directories
"""
LOG_DIR = os.path.join(ISF_DIR, "logs")
ISF_CONFIG = os.path.join(ISF_DIR, "isf.xml")
def make_env_path():
p = util.get_sitepackages_path()
f = open(os.path.join(p, "isf.pth"), "wb+")
info = ISF_DIR + "\n"
info += ISF_DIR + "/lib/protocols" + "\n"
info += ISF_DIR + "/lib/thirdparty" + "\n"
f.write(info)
f.close()
def do_interactive(isf):
gvars = globals()
gvars['quit'] = (lambda *x: isf.io.print_error("Press Ctrl-D to quit"))
gvars['exit'] = gvars['quit']
isf.io.print_warning("Dropping to Interactive Python Interpreter")
isf.io.print_warning("Press Ctrl-D to exit")
code.interact(local=gvars, banner="")
def main(isf):
isf.printbanner()
while 1:
try:
isf.cmdloop()
except exception.Interpreter:
do_interactive(isf)
else:
break
def load_plugins(isf):
isf.io.pre_input(None)
isf.io.print_msg("Loading Plugins")
isf.io.post_input()
addplugins(isf, "Exploit", EXPLOIT_DIR, EDFPlugin)
addplugins(isf, "Payload", PAYLOAD_DIR, EDFPlugin)
addplugins(isf, "Touch", TOUCH_DIR, EDFPlugin)
addplugins(isf, "Special", SPECIAL_DIR, DAVEPlugin, DeployableManager)
return
@exception.exceptionwrapped
def setup_and_run(config, fbdir, logdir):
make_env_path()
global isf
isf = Fuzzbunch(config, fbdir, logdir)
load_plugins(isf)
main(isf)
if __name__ == "__main__":
setup_and_run(ISF_CONFIG, ISF_DIR, LOG_DIR)