This file is indexed.

/usr/share/w3af/w3af_console is in w3af-console 1.1svn5547-1.1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#! /usr/bin/python

import getopt, sys, os
import gettext
 
# First of all, we need to change the working directory to the directory of w3af.
currentDir = os.getcwd()
scriptDir = os.path.dirname(sys.argv[0]) or '.'
os.chdir( scriptDir )

def backToCurrentDir():
    os.chdir( currentDir )

# Translation stuff
gettext.install('w3af', 'locales/')

# Now we can load all modules and stuff...
import core.controllers.outputManager as om
from core.controllers.profiling.cpu_usage import dump_cpu_usage
from core.controllers.misc.get_w3af_version import get_w3af_version
from core.controllers.w3afException import w3afException

try:
    om.out.setOutputPlugins( ['console'] )
except w3afException, w3:
    print 'Something went wrong, w3af failed to init the output manager. Exception: ', str(w3)
    sys.exit(-9)


usage_doc = '''
w3af - Web Application Attack and Audit Framework

Usage:

    ./w3af_console -h
    ./w3af_console -t
    ./w3af_console [-s <script_file>]

Options:

    -h or --help
        Display this help message.

    -t or --test-all
        Runs all test scripts containing an 'assert' sentence.
    
    -s <script_file> or --script=<script_file>
        Run <script_file> script.

    -p <profile> or --profile=<profile>
        Run with the selected <profile>
    
    -P <profile> or --profile-run=<profile>
        Run with the selected <profile> in batch mode

For more info visit http://w3af.sourceforge.net/
'''

def usage():
    om.out.information(usage_doc)

def main():
    try:
        long_options = ['script=', 'help', 'version', 'test-all',
                        'profile=', 'profile-run']
        opts, args = getopt.getopt(sys.argv[1:], "ehvts:nfpP:r:", long_options)
    except getopt.GetoptError, e:
        # print help information and exit:
        usage()
        return -3
    scriptFile = None
    forceProfile = None
    profile = None
    doupdate = False
    rev = 0 # HEAD revision
    
    for o, a in opts:
        if o == "-e":
            # easter egg
            import base64
            om.out.information( base64.b64decode('R3JhY2lhcyBFdWdlIHBvciBiYW5jYXJtZSB0YW50YXMgaG9yYXMgZGUgZGVzYXJyb2xsbywgdGUgYW1vIGdvcmRhIQ=='))
        if o in ('-t', '--test-all'):
            # Test all scripts that have an assert call
            from core.controllers.misc.w3afTest import w3afTest
            w3afTest()
            return 0
        if o in ('-s', '--script'):
            scriptFile = a
        if o in ('-P', '--profile-run'):
            # selected profile
            forceProfile = True
            profile = a
        if o in ('-p', '--profile'):
            # selected profile
            profile = a
        if o in ('-h', '--help'):
            usage()
            return 0
        if o in ('-v', '--version'):
            print get_w3af_version()
            return 0
    
    # console
    from core.ui.consoleUi.consoleUi import consoleUi
    
    commandsToRun = []
    if scriptFile is not None:
        try:
            fd = open( os.path.join(currentDir, scriptFile)  )
        except:
            om.out.error('Failed to open file : ' + scriptFile )
            sys.exit(2)
        else:
            commandsToRun = []
            for line in fd:   
                line = line.strip()
                if line != '' and line[0] != '#': # if not a comment..
                    commandsToRun.append( line )
            fd.close() 
    elif profile is not None:
        commandsToRun = ["profiles use %s %s" % (profile, currentDir)]
        if forceProfile is not None:
            commandsToRun.append("start")
            commandsToRun.append("exit")

    console = consoleUi(commands=commandsToRun, do_upd=doupdate, rev=rev)
    console.sh()


if __name__ == "__main__":
    errCode = main()
    backToCurrentDir()
    dump_cpu_usage()
    sys.exit(errCode)