Exit codes

This commit is contained in:
erwanlr
2013-04-14 12:59:52 +02:00
parent 6cd349cb24
commit 927c37e6db
2 changed files with 8 additions and 5 deletions

View File

@@ -21,7 +21,7 @@ def main
if wpscan_options.help if wpscan_options.help
help() help()
usage() usage()
exit(1) exit(0)
end end
# Check for updates # Check for updates
@@ -36,7 +36,7 @@ def main
puts 'Svn / Git not installed, or wpscan has not been installed with one of them.' puts 'Svn / Git not installed, or wpscan has not been installed with one of them.'
puts 'Update aborted' puts 'Update aborted'
end end
exit(1) exit(0)
end end
wp_target = WpTarget.new(wpscan_options.url, wpscan_options.to_h) wp_target = WpTarget.new(wpscan_options.url, wpscan_options.to_h)
@@ -69,7 +69,7 @@ def main
wp_target = WpTarget.new(redirection, wpscan_options.to_h) wp_target = WpTarget.new(redirection, wpscan_options.to_h)
else else
puts 'Scan aborted' puts 'Scan aborted'
exit exit(0)
end end
end end
@@ -93,7 +93,7 @@ def main
puts 'You can specify one per command line option (don\'t forget to include the wp-content directory if needed)' puts 'You can specify one per command line option (don\'t forget to include the wp-content directory if needed)'
puts 'Continue? [y/n]' puts 'Continue? [y/n]'
unless Readline.readline =~ /^y/i unless Readline.readline =~ /^y/i
exit exit(0)
end end
end end
@@ -320,7 +320,7 @@ def main
puts green("[+] Finished at #{stop_time.asctime}") puts green("[+] Finished at #{stop_time.asctime}")
elapsed = stop_time - start_time elapsed = stop_time - start_time
puts green("[+] Elapsed time: #{Time.at(elapsed).utc.strftime('%H:%M:%S')}") puts green("[+] Elapsed time: #{Time.at(elapsed).utc.strftime('%H:%M:%S')}")
exit() # must exit! exit(0) # must exit!
rescue => e rescue => e
if e.backtrace[0] =~ /main/ if e.backtrace[0] =~ /main/
puts red(e.message) puts red(e.message)
@@ -329,6 +329,7 @@ def main
puts red('Trace :') puts red('Trace :')
puts red(e.backtrace.join("\n")) puts red(e.backtrace.join("\n"))
end end
exit(1)
end end
end end

View File

@@ -29,8 +29,10 @@ begin
plugin.run(options) plugin.run(options)
end end
exit(0)
rescue => e rescue => e
puts "[ERROR] #{e.message}" puts "[ERROR] #{e.message}"
puts 'Trace :' puts 'Trace :'
puts e.backtrace.join("\n") puts e.backtrace.join("\n")
exit(1)
end end