diff --git a/lib/common/common_helper.rb b/lib/common/common_helper.rb
index cdcc6dbe..1240db68 100644
--- a/lib/common/common_helper.rb
+++ b/lib/common/common_helper.rb
@@ -243,3 +243,11 @@ end
def directory_listing_enabled?(url)
Browser.get(url.to_s).body[%r{
Index of}] ? true : false
end
+
+def log
+ @log
+end
+
+def log=(log)
+ @log = log
+end
diff --git a/lib/common/hacks.rb b/lib/common/hacks.rb
index 66febe01..4d310f1a 100644
--- a/lib/common/hacks.rb
+++ b/lib/common/hacks.rb
@@ -49,11 +49,9 @@ end
# Override for puts to enable logging
def puts(o = '')
- 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
+ if $log && o.respond_to?(:gsub)
+ temp = o.gsub(/\e\[\d+m/, '') # remove color for logging
+ File.open(LOG_FILE, 'a+') { |f| f.puts(temp) }
end
super(o)
diff --git a/wpscan.rb b/wpscan.rb
index 38ab6550..f1a94bca 100755
--- a/wpscan.rb
+++ b/wpscan.rb
@@ -11,9 +11,9 @@ def main
begin
wpscan_options = WpscanOptions.load_from_arguments
- @log = wpscan_options.log
+ $log = wpscan_options.log
- banner() # called after @log instance variable set
+ banner() # called after $log set
unless wpscan_options.has_options?
# first parameter only url?