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.
--log Save STDOUT to log.txt
==WPSCAN EXAMPLES==
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.
--log Save STDOUT to log.txt
#### WPSCAN EXAMPLES
Do 'non-intrusive' checks...

View File

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

View File

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

View File

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

View File

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