diff --git a/lib/common/common_helper.rb b/lib/common/common_helper.rb index 184b247b..2ee6a254 100644 --- a/lib/common/common_helper.rb +++ b/lib/common/common_helper.rb @@ -79,11 +79,18 @@ def missing_db_file? false end +def last_update + date = nil + if File.exists?(LAST_UPDATE_FILE) + content = File.read(LAST_UPDATE_FILE) + date = Time.parse(content) rescue nil + end + date +end + def update_required? - return true unless File.exist?(LAST_UPDATE_FILE) - content = File.read(LAST_UPDATE_FILE) - date = Time.parse(content) rescue Time.parse("2000-01-01") - return date < 5.days.ago + date = last_update + (true if date.nil?) or (date < 5.days.ago) end # Define colors diff --git a/wpscan.rb b/wpscan.rb index a382cf94..4e6535ec 100755 --- a/wpscan.rb +++ b/wpscan.rb @@ -39,6 +39,8 @@ def main if wpscan_options.version puts "Current version: #{WPSCAN_VERSION}" + date = last_update + puts "Last DB update: #{date.strftime('%Y-%m-%d')}" unless date.nil? exit(0) end