Re-worked off-line update only as a fall back (when possible)

This commit is contained in:
g0tmi1k
2018-05-14 15:12:20 +01:00
parent 9450ba6cc5
commit e41aab3a80

View File

@@ -94,45 +94,34 @@ def main
puts notice("Last database update: #{date.strftime('%Y-%m-%d')}") unless date.nil? puts notice("Last database update: #{date.strftime('%Y-%m-%d')}") unless date.nil?
# User prompt # 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 if (input = Readline.readline) =~ /^a/i
puts 'Scan aborted' puts 'Update aborted'
exit(1)
elsif input =~ /^y/i elsif input =~ /^y/i
wpscan_options.update = true wpscan_options.update = true
end end
# Is there a database to go on with? # Is there a database to go on with?
if missing_db_files? and not wpscan_options.update if missing_db_files? and not wpscan_options.update
# 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') puts critical('You can not run a scan without any databases')
exit(1) exit(1)
end end
end end
end
# Should we update? # Should we update?
if wpscan_options.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 ...') puts notice('Updating the Database ...')
DbUpdater.new(DATA_DIR).update(wpscan_options.verbose) DbUpdater.new(DATA_DIR).update(wpscan_options.verbose)
puts notice('Update completed') puts notice('Update completed')
else
puts notice('Extracting the Database ...')
extract_db_zip
puts notice('Extraction completed')
end
# Exit program if only option --update is used # Exit program if only option --update is used
exit(0) unless wpscan_options.url exit(0) unless wpscan_options.url