From 03f8b02ac18b69bd5fd9368416d82c0a9f0f7fe7 Mon Sep 17 00:00:00 2001 From: Christian Mehlmauer Date: Sun, 18 Aug 2013 15:40:55 +0200 Subject: [PATCH] add --version switch --- lib/common/common_helper.rb | 11 +++++++++-- lib/wpscan/wpscan_options.rb | 6 ++++-- wpscan.rb | 5 +++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/common/common_helper.rb b/lib/common/common_helper.rb index 00d781c4..ff718ffa 100644 --- a/lib/common/common_helper.rb +++ b/lib/common/common_helper.rb @@ -78,6 +78,13 @@ else REVISION = nil end +def version + if REVISION + return "v#{WPSCAN_VERSION}r#{REVISION}" + end + return "v#{WPSCAN_VERSION}" +end + # our 1337 banner def banner puts '_______________________________________________________________' @@ -90,9 +97,9 @@ def banner puts puts ' WordPress Security Scanner by the WPScan Team ' if REVISION - puts " Version v#{WPSCAN_VERSION}r#{REVISION}" + puts " Version #{version}" else - puts " Version v#{WPSCAN_VERSION}" + puts " Version #{version}" end puts ' Sponsored by the RandomStorm Open Source Initiative' puts ' @_WPScan_, @ethicalhack3r, @erwan_lr, @gbrindisi, @_FireFart_' diff --git a/lib/wpscan/wpscan_options.rb b/lib/wpscan/wpscan_options.rb index 67e17243..16046e48 100644 --- a/lib/wpscan/wpscan_options.rb +++ b/lib/wpscan/wpscan_options.rb @@ -29,7 +29,8 @@ class WpscanOptions :config_file, :exclude_content_based, :basic_auth, - :debug_output + :debug_output, + :version ] attr_accessor *ACCESSOR_OPTIONS @@ -237,7 +238,8 @@ class WpscanOptions ['--config-file', '-c', GetoptLong::REQUIRED_ARGUMENT], ['--exclude-content-based', GetoptLong::REQUIRED_ARGUMENT], ['--basic-auth', GetoptLong::REQUIRED_ARGUMENT], - ['--debug-output', GetoptLong::NO_ARGUMENT] + ['--debug-output', GetoptLong::NO_ARGUMENT], + ['--version', GetoptLong::NO_ARGUMENT] ) end diff --git a/wpscan.rb b/wpscan.rb index 3943eef2..a1f18ead 100755 --- a/wpscan.rb +++ b/wpscan.rb @@ -24,6 +24,11 @@ def main exit(0) end + if wpscan_options.version + puts "Current version is #{version}" + exit(0) + end + # Check for updates if wpscan_options.update if !@updater.nil?