Permalink
Browse files

Change w3af_console / w3af_gui shebang to 2.7 #13012

  • Loading branch information...
1 parent f28d5d2 commit 39a51314104d3e2fa18810dfc281e15fa7c40a62 @andresriancho committed Dec 3, 2015
@@ -23,6 +23,9 @@
import warnings
import logging
+from .utils import verify_python_version
+verify_python_version()
+
try:
# Is pip even there?
import pip
@@ -40,7 +43,6 @@
print(' sudo pip install --upgrade pip')
sys.exit(1)
-from .utils import verify_python_version
from .helper_script import (generate_helper_script,
generate_pip_install_non_git,
generate_pip_install_git)
@@ -56,8 +58,6 @@ def dependency_check(dependency_set=CORE, exit_on_failure=True):
:return: True if the process should exit
"""
- verify_python_version()
-
disable_warnings()
platform = get_current_platform()
@@ -26,14 +26,21 @@ def verify_python_version():
"""
Check python version eq 2.6 or 2.7
"""
- major, minor, micro, releaselevel, serial = sys.version_info
+ major, minor, micro, release_level, serial = sys.version_info
if major == 2:
if minor != 7:
msg = 'Error: Python 2.%s found but Python 2.7 required.'
print(msg % minor)
elif major > 2:
- msg = 'It seems that you are running Python 3k, please let us know if' \
- ' w3af works as expected at w3af-develop@lists.sourceforge.net !'
+ msg = ('It seems that you are running w3af using Python3, which is not'
+ ' officially supported by the w3af team.\nTo force w3af to be'
+ ' run using python2.7 run it as follows (depending on your OS):'
+ '\n\n'
+ ' * python2.7 w3af_console\n'
+ ' * python2 w3af_console\n'
+ '\n'
+ 'To make this change permanent modify the shebang line in the'
+ ' w3af_console, w3af_gui and w3af_api scripts.')
print(msg)
sys.exit(1)
@@ -24,17 +24,13 @@
from w3af.core.ui.api import app
from w3af.core.ui.api.utils.cli import process_cmd_args_config
-from w3af.core.controllers.dependency_check.dependency_check import dependency_check
def main():
"""
Entry point for the REST API
:return: Zero if everything went well
"""
- # Check if I have all needed dependencies
- dependency_check()
-
try:
args = process_cmd_args_config(app)
except argparse.ArgumentTypeError, ate:
View
@@ -2,8 +2,12 @@
import sys
-from w3af.core.ui.api.main import main
+# Check if I have all needed dependencies, do this as soon as possible so we
+# fail fast
+from w3af.core.controllers.dependency_check.dependency_check import dependency_check
+dependency_check()
+from w3af.core.ui.api.main import main
if __name__ == '__main__':
sys.exit(main())
View
@@ -62,7 +62,7 @@ def _configure_output_manager():
"""
try:
om.manager.set_output_plugins(['console'])
- except Exception, e:
+ except Exception as e:
print('Something went wrong, w3af failed to start the output manager.')
print('Exception: "%s"' % e)
sys.exit(-9)
View
@@ -49,7 +49,7 @@ def _configure_output_manager():
"""
try:
om.manager.set_output_plugins(['console'])
- except Exception, e:
+ except Exception as e:
print('Something went wrong, w3af failed to start the output manager.')
print('Exception: "%s"' % e)
sys.exit(-9)

0 comments on commit 39a5131

Please sign in to comment.