forked from andresriancho/w3af
-
Notifications
You must be signed in to change notification settings - Fork 0
/
w3af_gui
executable file
·106 lines (86 loc) · 3.01 KB
/
w3af_gui
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/usr/bin/env python
import getopt
import sys
import os
import gettext
import base64
# First of all, we need to change the working directory to the
# directory of w3af
current_dir = os.getcwd()
script_dir = os.path.dirname(os.path.realpath(__file__)) or '.'
os.chdir( script_dir )
def back_to_current_dir():
os.chdir( current_dir )
# Translation stuff
gettext.install('w3af', 'locales/')
# Perform the GTK UI dependency check, this will verify that the current system
# has all the modules required to run w3af (including the core dependencies)
from core.ui.gui.dependency_check.dependency_check import dependency_check
dependency_check()
# Make sure that the output manager is started before doing anything else, since
# it is used by most w3af modules
import core.controllers.output_manager as om
try:
om.out.set_output_plugins( ['console'] )
except Exception, e:
print 'Something went wrong, w3af failed to start the output manager.'
print 'Exception: "%s"' % e
sys.exit(-9)
usage_doc = '''
w3af - Web Application Attack and Audit Framework
Usage:
./w3af_gui [OPTIONS]
Options:
-h or --help
Display this help message.
-n or --no-update
No update check will be made when starting. This option takes
precedence over the 'auto-update' setting in 'startup.conf' file.
-f or --force-update
An update check will be made when starting. This option takes
precedence over the 'auto-update' setting in 'startup.conf' file.
-p <profile> or --profile=<profile>
Run with the selected <profile>
For more info visit http://w3af.org/
'''
def usage():
om.out.information(usage_doc)
def main():
try:
long_options = ['help', 'no-update', 'force-update', 'profile=']
opts, _ = getopt.getopt(sys.argv[1:], "ehnfp:", long_options)
except getopt.GetoptError:
# print help information and exit:
usage()
return -3
profile = None
doupdate = None
for o, a in opts:
if o in ( "-e" ):
# easter egg
msg = 'R3JhY2lhcyBFdWdlIHBvciBiYW5jYXJtZSB0YW50YXMgaG9yYXMgZGUgZGV'\
'zYXJyb2xsbywgdGUgYW1vIGdvcmRhIQ=='
om.out.information( base64.b64decode( msg ) )
if o in ('-p', '--profile'):
# selected profile
profile = a
if o == "-h":
usage()
return 0
if o in ('-f', '--force-update'):
doupdate = True
elif o in ('-n', '--no-update'):
doupdate = False
# go with GTK, but first check about DISPLAY environment variable
if sys.platform != "win32":
display = os.getenv("DISPLAY")
if not display:
om.out.error("The DISPLAY environment variable is not set! You can"
" not use any graphical program without it...")
return -1
import core.ui.gui.main
core.ui.gui.main.main(profile, doupdate)
if __name__ == "__main__":
err_code = main()
back_to_current_dir()
sys.exit(err_code)