From e41aab3a80b8dbe1cda8e9b88f27c6ddfe4d87b5 Mon Sep 17 00:00:00 2001 From: g0tmi1k Date: Mon, 14 May 2018 15:12:20 +0100 Subject: [PATCH] Re-worked off-line update only as a fall back (when possible) --- wpscan.rb | 45 +++++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/wpscan.rb b/wpscan.rb index bf8d2b66..6ef9aadd 100755 --- a/wpscan.rb +++ b/wpscan.rb @@ -87,52 +87,41 @@ def main # Check if database needs upgrade (if its older than 5 days) and we are not running in --batch mode # Also no need to check if the user supplied the --update switch - if update_required? and not wpscan_options.batch and not wpscan_options.update + if update_required? and not wpscan_options.batch and not wpscan_options.update # Banner puts puts notice('It seems like you have not updated the database for some time') puts notice("Last database update: #{date.strftime('%Y-%m-%d')}") unless date.nil? # User prompt - print '[?] Do you want to update now? [Y]es [N]o [A]bort, default: [N] > ' + print '[?] Do you want to update now? [Y]es [N]o [A]bort update, default: [N] > ' if (input = Readline.readline) =~ /^a/i - puts 'Scan aborted' - exit(1) + puts 'Update aborted' elsif input =~ /^y/i wpscan_options.update = true end # Is there a database to go on with? if missing_db_files? and not wpscan_options.update - puts critical('You can not run a scan without any databases') - exit(1) + # Check for data.zip + if has_db_zip? + puts notice('Extracting the Database ...') + # Extract data.zip + extract_db_zip + puts notice('Extraction completed') + # Missing, so can't go on! + else + puts critical('You can not run a scan without any databases') + exit(1) + end end end # Should we update? if wpscan_options.update - online_update = true - - # Check for data.zip - if has_db_zip? - # User prompt - print '[?] Use the latest on-line database? Or use the off-line copy? [O]n-line O[f]f-line [A]bort update, default: [O] > ' - if (input = Readline.readline) =~ /^a/i - puts 'Update aborted' - elsif input =~ /^f/i - online_update = false - end - end - - if online_update - puts notice('Updating the Database ...') - DbUpdater.new(DATA_DIR).update(wpscan_options.verbose) - puts notice('Update completed') - else - puts notice('Extracting the Database ...') - extract_db_zip - puts notice('Extraction completed') - end + puts notice('Updating the Database ...') + DbUpdater.new(DATA_DIR).update(wpscan_options.verbose) + puts notice('Update completed') # Exit program if only option --update is used exit(0) unless wpscan_options.url