Disable logging by default. Implement log option. #703 #336

This commit is contained in:
ethicalhack3r
2014-12-15 15:39:14 +01:00
parent d988b6ccbf
commit 3a3376ec41
6 changed files with 18 additions and 8 deletions

2
README
View File

@@ -222,6 +222,8 @@ You should have received a copy of the GNU General Public License along with thi
--no-color Do not use colors in the output. --no-color Do not use colors in the output.
--log Save STDOUT to log.txt
==WPSCAN EXAMPLES== ==WPSCAN EXAMPLES==
Do 'non-intrusive' checks... Do 'non-intrusive' checks...

View File

@@ -223,6 +223,8 @@ Apple Xcode, Command Line Tools and the libffi are needed (to be able to install
--no-color Do not use colors in the output. --no-color Do not use colors in the output.
--log Save STDOUT to log.txt
#### WPSCAN EXAMPLES #### WPSCAN EXAMPLES
Do 'non-intrusive' checks... Do 'non-intrusive' checks...

View File

@@ -30,7 +30,7 @@ class Browser
# #
# @return [ Browser ] # @return [ Browser ]
def initialize(options = {}) def initialize(options = {})
@cache_dir = options[:cache_dir] || CACHE_DIR + '/browser' @cache_dir = options[:cache_dir] || CACHE_DIR + '/browser'
# sets browser defaults # sets browser defaults
browser_defaults browser_defaults

View File

@@ -49,11 +49,13 @@ end
# Override for puts to enable logging # Override for puts to enable logging
def puts(o = '') def puts(o = '')
# remove color for logging if @log
if o.respond_to?(:gsub) if o.respond_to?(:gsub)
temp = o.gsub(/\e\[\d+m/, '') temp = o.gsub(/\e\[\d+m/, '') # remove color for logging
File.open(LOG_FILE, 'a+') { |f| f.puts(temp) } File.open(LOG_FILE, 'a+') { |f| f.puts(temp) }
end
end end
super(o) super(o)
end end

View File

@@ -14,6 +14,7 @@ class WpscanOptions
:enumerate_usernames, :enumerate_usernames,
:enumerate_usernames_range, :enumerate_usernames_range,
:no_color, :no_color,
:log,
:proxy, :proxy,
:proxy_auth, :proxy_auth,
:threads, :threads,
@@ -269,7 +270,8 @@ class WpscanOptions
['--max-threads', GetoptLong::REQUIRED_ARGUMENT], ['--max-threads', GetoptLong::REQUIRED_ARGUMENT],
['--batch', GetoptLong::NO_ARGUMENT], ['--batch', GetoptLong::NO_ARGUMENT],
['--no-color', GetoptLong::NO_ARGUMENT], ['--no-color', GetoptLong::NO_ARGUMENT],
['--cookie', GetoptLong::REQUIRED_ARGUMENT] ['--cookie', GetoptLong::REQUIRED_ARGUMENT],
['--log', GetoptLong::NO_ARGUMENT]
) )
end end

View File

@@ -8,11 +8,13 @@ def main
# delete old logfile, check if it is a symlink first. # delete old logfile, check if it is a symlink first.
File.delete(LOG_FILE) if File.exist?(LOG_FILE) and !File.symlink?(LOG_FILE) File.delete(LOG_FILE) if File.exist?(LOG_FILE) and !File.symlink?(LOG_FILE)
banner()
begin begin
wpscan_options = WpscanOptions.load_from_arguments wpscan_options = WpscanOptions.load_from_arguments
@log = wpscan_options.log
banner() # called after @log instance variable set
unless wpscan_options.has_options? unless wpscan_options.has_options?
# first parameter only url? # first parameter only url?
if ARGV.length == 1 if ARGV.length == 1