Skip to content

Commit

Permalink
Merge pull request #16520 from chadduffin/master
Browse files Browse the repository at this point in the history
Added '-y' and '--yes' flags to allow the user to skip the disclaimer.
  • Loading branch information
andresriancho committed Jan 31, 2018
2 parents 4f5b951 + df4af67 commit 22340ba
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions w3af_console
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ Options:
-v or --version
Show w3af's version
-y or --yes
Automatically agree to disclaimer prompt
For more info visit http://w3af.org/
"""

Expand Down Expand Up @@ -111,8 +114,9 @@ def _generate_run_commands(script_file, profile, force_profile):
def main():
try:
long_options = ['script=', 'help', 'version', 'no-update',
'force-update', 'profile=', 'commit=', 'profile-run']
opts, _ = getopt.getopt(sys.argv[1:], "ehvs:nfp:P:", long_options)
'force-update', 'profile=', 'commit=',
'profile-run', 'yes']
opts, _ = getopt.getopt(sys.argv[1:], "ehvs:nfp:P:y", long_options)
except getopt.GetoptError:
# Print help information and exit
_usage()
Expand All @@ -122,6 +126,7 @@ def main():
force_profile = None
profile = None
do_update = None
skip_disclaimer = False

for o, a in opts:
if o == "-e":
Expand All @@ -148,11 +153,13 @@ def main():
do_update = True
elif o in ('-n', '--no-update'):
do_update = False
if o in ('-y', '--yes'):
skip_disclaimer = True

commands_to_run = _generate_run_commands(script_file, profile, force_profile)
console = ConsoleUI(commands=commands_to_run, do_upd=do_update)

if not console.accept_disclaimer():
if not skip_disclaimer and not console.accept_disclaimer():
return -4

return console.sh()
Expand Down

0 comments on commit 22340ba

Please sign in to comment.