add --version switch

This commit is contained in:
Christian Mehlmauer
2013-08-18 15:40:55 +02:00
parent 81f9612de2
commit 03f8b02ac1
3 changed files with 18 additions and 4 deletions

View File

@@ -78,6 +78,13 @@ else
REVISION = nil REVISION = nil
end end
def version
if REVISION
return "v#{WPSCAN_VERSION}r#{REVISION}"
end
return "v#{WPSCAN_VERSION}"
end
# our 1337 banner # our 1337 banner
def banner def banner
puts '_______________________________________________________________' puts '_______________________________________________________________'
@@ -90,9 +97,9 @@ def banner
puts puts
puts ' WordPress Security Scanner by the WPScan Team ' puts ' WordPress Security Scanner by the WPScan Team '
if REVISION if REVISION
puts " Version v#{WPSCAN_VERSION}r#{REVISION}" puts " Version #{version}"
else else
puts " Version v#{WPSCAN_VERSION}" puts " Version #{version}"
end end
puts ' Sponsored by the RandomStorm Open Source Initiative' puts ' Sponsored by the RandomStorm Open Source Initiative'
puts ' @_WPScan_, @ethicalhack3r, @erwan_lr, @gbrindisi, @_FireFart_' puts ' @_WPScan_, @ethicalhack3r, @erwan_lr, @gbrindisi, @_FireFart_'

View File

@@ -29,7 +29,8 @@ class WpscanOptions
:config_file, :config_file,
:exclude_content_based, :exclude_content_based,
:basic_auth, :basic_auth,
:debug_output :debug_output,
:version
] ]
attr_accessor *ACCESSOR_OPTIONS attr_accessor *ACCESSOR_OPTIONS
@@ -237,7 +238,8 @@ class WpscanOptions
['--config-file', '-c', GetoptLong::REQUIRED_ARGUMENT], ['--config-file', '-c', GetoptLong::REQUIRED_ARGUMENT],
['--exclude-content-based', GetoptLong::REQUIRED_ARGUMENT], ['--exclude-content-based', GetoptLong::REQUIRED_ARGUMENT],
['--basic-auth', GetoptLong::REQUIRED_ARGUMENT], ['--basic-auth', GetoptLong::REQUIRED_ARGUMENT],
['--debug-output', GetoptLong::NO_ARGUMENT] ['--debug-output', GetoptLong::NO_ARGUMENT],
['--version', GetoptLong::NO_ARGUMENT]
) )
end end

View File

@@ -24,6 +24,11 @@ def main
exit(0) exit(0)
end end
if wpscan_options.version
puts "Current version is #{version}"
exit(0)
end
# Check for updates # Check for updates
if wpscan_options.update if wpscan_options.update
if !@updater.nil? if !@updater.nil?