Re-worked off-line update only as a fall back (when possible)
This commit is contained in:
33
wpscan.rb
33
wpscan.rb
@@ -94,45 +94,34 @@ def main
|
||||
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
|
||||
# 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
|
||||
|
||||
# Exit program if only option --update is used
|
||||
exit(0) unless wpscan_options.url
|
||||
|
||||
Reference in New Issue
Block a user