forked from xmendez/wfuzz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwfuzz.py
executable file
·82 lines (65 loc) · 2.42 KB
/
wfuzz.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
#!/usr/bin/env python
#Covered by GPL V2.0
import sys
# Check for pycurl dependency
try:
import pycurl
if "openssl".lower() not in pycurl.version.lower():
print "\nWarning: Pycurl is not compiled against Openssl. Wfuzz might not work correctly when fuzzing SSL sites. Check Wfuzz's wiki for more information at https://github.com/xmendez/wfuzz/wiki/PyCurlSSLBug\n"
except ImportError, e:
print "\nFatal exception: Wfuzz needs pycurl to run. Pycurl could be installed using the following command:\n\npip install pycurl"
sys.exit(1)
import logging
import os
from framework.fuzzer.Fuzzer import Fuzzer
from framework.core.facade import Facade
from framework.core.options import FuzzSession
from framework.core.myexception import FuzzException
from framework.ui.console.keystroke import KeyPress
from framework.ui.console.controller import Controller
from framework.ui.console.controller import View
from framework.ui.console.clparser import CLParser
kb = None
fz = None
printer = None
session_options = None
# define a logging Handler
console = logging.StreamHandler()
console.setLevel(logging.WARNING)
formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
console.setFormatter(formatter)
logging.getLogger('').addHandler(console)
# set current folder in order to load plugins
abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath)
os.chdir(dname)
try:
# parse command line
session_options = FuzzSession.from_options(CLParser(sys.argv).parse_cl())
# Create fuzzer's engine
fz = Fuzzer(session_options)
if session_options.get("interactive"):
# initialise controller
try:
kb = KeyPress()
except ImportError, e:
raise FuzzException(FuzzException.FATAL, "Error importing necessary modules for interactive mode: %s" % str(e))
else:
mc = Controller(fz, kb)
kb.start()
printer = View(session_options.get("colour"), session_options.get("verbose"))
printer.header(fz.genReq.stats)
for res in fz:
printer.result(res)
printer.footer(fz.genReq.stats)
except FuzzException, e:
print "\nFatal exception: %s" % e.msg
if fz: fz.cancel_job()
except KeyboardInterrupt:
print "\nFinishing pending requests..."
if fz: fz.cancel_job()
except NotImplementedError, e:
print "\nFatal exception: Error importing wfuzz extensions"
finally:
if kb: kb.cancel_job()
Facade().sett.save()