@@instance =
@@ -252,7 +254,7 @@
Attributes included from Options
- #available_user_agents, #basic_auth, #cache_ttl, #proxy, #proxy_auth, #user_agent, #user_agent_mode
+ #available_user_agents, #basic_auth, #cache_ttl, #connect_timeout, #proxy, #proxy_auth, #request_timeout, #user_agent, #user_agent_mode
@@ -499,8 +501,6 @@
-29
-30
31
32
33
@@ -514,16 +514,18 @@
41
42
43
-44
+44
+45
+46
- # File 'lib/common/browser.rb', line 29
+ # File 'lib/common/browser.rb', line 31
def initialize(options = {})
@config_file = options[:config_file] || CONF_DIR + '/browser.conf.json'
@cache_dir = options[:cache_dir] || CACHE_DIR + '/browser'
- load_config()
+ load_config
override_config(options)
unless @hydra
@@ -573,12 +575,12 @@
-24
-25
-26
+26
+27
+28
|
- # File 'lib/common/browser.rb', line 24
+ # File 'lib/common/browser.rb', line 26
def cache_dir
@cache_dir
@@ -616,12 +618,12 @@
-24
-25
-26
+26
+27
+28
|
- # File 'lib/common/browser.rb', line 24
+ # File 'lib/common/browser.rb', line 26
def config_file
@config_file
@@ -659,12 +661,12 @@
-24
-25
-26
+26
+27
+28
|
- # File 'lib/common/browser.rb', line 24
+ # File 'lib/common/browser.rb', line 26
def hydra
@hydra
@@ -757,17 +759,17 @@
-143
-144
-145
-146
-147
-148
-149
-150
+153
+154
+155
+156
+157
+158
+159
+160
|
- # File 'lib/common/browser.rb', line 143
+ # File 'lib/common/browser.rb', line 153
def self.(params = {}, field, field_value)
if !params.has_key?(:headers)
@@ -836,15 +838,15 @@
-51
-52
53
54
55
-56
+56
+57
+58
|
- # File 'lib/common/browser.rb', line 51
+ # File 'lib/common/browser.rb', line 53
def self.instance(options = {})
unless @@instance
@@ -872,12 +874,12 @@
-58
-59
-60
+60
+61
+62
|
- # File 'lib/common/browser.rb', line 58
+ # File 'lib/common/browser.rb', line 60
def self.reset
@@instance = nil
@@ -958,12 +960,12 @@
-91
-92
-93
+93
+94
+95
|
- # File 'lib/common/browser.rb', line 91
+ # File 'lib/common/browser.rb', line 93
def forge_request(url, params = {})
Typhoeus::Request.new(url, merge_request_params(params))
@@ -1016,8 +1018,6 @@
-69
-70
71
72
73
@@ -1032,16 +1032,18 @@
82
83
84
-85
+85
+86
+87
|
- # File 'lib/common/browser.rb', line 69
+ # File 'lib/common/browser.rb', line 71
def load_config(config_file = nil)
@config_file = config_file || @config_file
if File.symlink?(@config_file)
- raise "[ERROR] Config file is a symlink."
+ raise '[ERROR] Config file is a symlink.'
else
data = JSON.parse(File.read(@config_file))
end
@@ -1113,8 +1115,6 @@
-98
-99
100
101
102
@@ -1149,10 +1149,20 @@
131
132
133
-134
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
|
- # File 'lib/common/browser.rb', line 98
+ # File 'lib/common/browser.rb', line 100
def merge_request_params(params = {})
params = Browser.(
@@ -1177,6 +1187,14 @@
)
end
+ if @request_timeout
+ params = params.merge(timeout: @request_timeout)
+ end
+
+ if @connect_timeout
+ params = params.merge(connecttimeout: @connect_timeout)
+ end
+
unless params.has_key?(:cache_ttl)
params = params.merge(cache_ttl: @cache_ttl)
@@ -1201,7 +1219,7 @@
diff --git a/doc_yard/Browser/Actions.html b/doc_yard/Browser/Actions.html
index f2241383..040f3f6f 100644
--- a/doc_yard/Browser/Actions.html
+++ b/doc_yard/Browser/Actions.html
@@ -629,7 +629,7 @@
diff --git a/doc_yard/Browser/Options.html b/doc_yard/Browser/Options.html
index e6761808..16e2d1e9 100644
--- a/doc_yard/Browser/Options.html
+++ b/doc_yard/Browser/Options.html
@@ -185,6 +185,33 @@
Returns the value of attribute cache_ttl.
+
+
+
+
+
+
+ - (Object) connect_timeout
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns the value of attribute connect_timeout.
+
+
@@ -239,6 +266,33 @@
Returns the value of attribute proxy_auth.
+
+
+
+
+
+
+ - (Object) request_timeout
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Returns the value of attribute request_timeout.
+
+
@@ -536,6 +590,49 @@
+
+
+
+
+ - (Object) connect_timeout
+
+
+
+
+
+
+
+
+ Returns the value of attribute connect_timeout
+
+
+
+
+
+
+
+
+
+
+
+
+
+8
+9
+10
+ |
+
+ # File 'lib/common/browser/options.rb', line 8
+
+def connect_timeout
+ @connect_timeout
+end
+ |
+
+
+
+
+
@@ -622,6 +719,49 @@
+
+
+
+
+ - (Object) request_timeout
+
+
+
+
+
+
+
+
+ Returns the value of attribute request_timeout
+
+
+
+
+
+
+
+
+
+
+
+
+
+8
+9
+10
+ |
+
+ # File 'lib/common/browser/options.rb', line 8
+
+def request_timeout
+ @request_timeout
+end
+ |
+
+
+
+
+
@@ -763,12 +903,12 @@
-120
-121
-122
+136
+137
+138
|
- # File 'lib/common/browser/options.rb', line 120
+ # File 'lib/common/browser/options.rb', line 136
def invalid_proxy_auth_format
'Invalid proxy auth format, expected username:password or {proxy_username: username, proxy_password: password}'
@@ -913,16 +1053,16 @@
-128
-129
-130
-131
-132
-133
-134
+144
+145
+146
+147
+148
+149
+150
|
- # File 'lib/common/browser/options.rb', line 128
+ # File 'lib/common/browser/options.rb', line 144
def override_config(options = {})
options.each do |option, value|
@@ -941,7 +1081,7 @@
diff --git a/doc_yard/CacheFileStore.html b/doc_yard/CacheFileStore.html
index 9682568c..23606d5d 100644
--- a/doc_yard/CacheFileStore.html
+++ b/doc_yard/CacheFileStore.html
@@ -612,7 +612,7 @@ Marshal does not need any "require"
diff --git a/doc_yard/CheckerPlugin.html b/doc_yard/CheckerPlugin.html
index ed1f5967..63c5c7ab 100644
--- a/doc_yard/CheckerPlugin.html
+++ b/doc_yard/CheckerPlugin.html
@@ -585,7 +585,7 @@
diff --git a/doc_yard/CustomOptionParser.html b/doc_yard/CustomOptionParser.html
index 580b3133..31013d79 100644
--- a/doc_yard/CustomOptionParser.html
+++ b/doc_yard/CustomOptionParser.html
@@ -643,7 +643,7 @@
diff --git a/doc_yard/File.html b/doc_yard/File.html
index d67aba0c..dc9caf89 100644
--- a/doc_yard/File.html
+++ b/doc_yard/File.html
@@ -226,7 +226,7 @@
diff --git a/doc_yard/GenerateList.html b/doc_yard/GenerateList.html
index 26c1feb7..2f166df2 100644
--- a/doc_yard/GenerateList.html
+++ b/doc_yard/GenerateList.html
@@ -357,17 +357,17 @@ parse the response for the names.
@type = 'plugin'
@svn_url = 'http://plugins.svn.wordpress.org/'
@popular_url = 'http://wordpress.org/plugins/browse/popular/'
- @popular_regex = %r{<h3><a href="http://wordpress.org/plugins/(.+)/">.+</a></h3>}i
+ @popular_regex = %r{<h3><a href="http://wordpress.org/plugins/([^/]+)/">.+</a></h3>}i
elsif type =~ /themes/i
@type = 'theme'
@svn_url = 'http://themes.svn.wordpress.org/'
@popular_url = 'http://wordpress.org/themes/browse/popular/'
- @popular_regex = %r{<h3><a href="http://wordpress.org/themes/(.+)">.+</a></h3>}i
+ @popular_regex = %r{<h3><a href="http://wordpress.org/themes/([^/]+)">.+</a></h3>}i
else
raise "Type #{type} not defined"
end
@verbose = verbose
- @browser = Browser.instance
+ @browser = Browser.instance(request_timeout: 20000, connect_timeout: 20000, max_threads: 1)
@hydra = @browser.hydra
end
|
@@ -559,7 +559,15 @@ parse the response for the names.
98
99
100
-101
+101
+102
+103
+104
+105
+106
+107
+108
+109
# File 'lib/wpstools/plugins/list_generator/generate_list.rb', line 67
@@ -577,12 +585,20 @@ parse the response for the names.
queue_count += 1
request.on_complete do |response|
+ if response.code != 200
+ puts red("Got HTTP Status #{response.code} for page #{page}. Retrying request...")
+ @hydra.queue(request)
+ next
+ end
puts "[+] Parsing page #{page_count}" if @verbose
page_count += 1
+ found = 0
response.body.scan(@popular_regex).each do |item|
- puts "[+] Found popular #@type: #{item}" if @verbose
found_items << item[0]
+ found = found + 1
end
+ puts "[+] Found #{found} items on page #{page}" if @verbose
end
@hydra.queue(request)
@@ -630,21 +646,21 @@ parse the response for the names.
-104
-105
-106
-107
-108
-109
-110
+112
+113
+114
+115
+116
+117
+118
|
- # File 'lib/wpstools/plugins/list_generator/generate_list.rb', line 104
+ # File 'lib/wpstools/plugins/list_generator/generate_list.rb', line 112
def save(items)
items.sort!
items.uniq!
- puts "[*] We have parsed #{items.length} #@types"
+ puts "[*] We have parsed #{items.length} #{@type}s"
File.open(@file_name, 'w') { |f| f.puts(items) }
puts "New #@file_name file created"
end
@@ -730,7 +746,7 @@ parse the response for the names.
diff --git a/doc_yard/GitUpdater.html b/doc_yard/GitUpdater.html
index c26339d8..8e0a4af9 100644
--- a/doc_yard/GitUpdater.html
+++ b/doc_yard/GitUpdater.html
@@ -529,7 +529,7 @@ the last commit hash
diff --git a/doc_yard/ListGeneratorPlugin.html b/doc_yard/ListGeneratorPlugin.html
index 6506234a..5a340883 100644
--- a/doc_yard/ListGeneratorPlugin.html
+++ b/doc_yard/ListGeneratorPlugin.html
@@ -435,7 +435,7 @@
diff --git a/doc_yard/Plugin.html b/doc_yard/Plugin.html
index 7d39f089..f0288e7b 100644
--- a/doc_yard/Plugin.html
+++ b/doc_yard/Plugin.html
@@ -506,7 +506,7 @@
diff --git a/doc_yard/Plugins.html b/doc_yard/Plugins.html
index 6db1895e..55523a5a 100644
--- a/doc_yard/Plugins.html
+++ b/doc_yard/Plugins.html
@@ -462,7 +462,7 @@
diff --git a/doc_yard/StatsPlugin.html b/doc_yard/StatsPlugin.html
index 8a5ccfe5..d57c7513 100644
--- a/doc_yard/StatsPlugin.html
+++ b/doc_yard/StatsPlugin.html
@@ -449,7 +449,7 @@
# File 'lib/wpstools/plugins/stats/stats_plugin.rb', line 35
def plugin_vulns_count(file=PLUGINS_VULNS_FILE)
- xml(file).xpath("count(//vulnerability)").to_i
+ xml(file).xpath('count(//vulnerability)').to_i
end
|
@@ -490,8 +490,8 @@
def run(options = {})
if options[:stats]
- puts "Wpscan Databse Statistics:"
- puts "--------------------------"
+ puts 'Wpscan Databse Statistics:'
+ puts '--------------------------'
puts "[#] Total vulnerable plugins: #{vuln_plugin_count}"
puts "[#] Total vulnerable themes: #{vuln_theme_count}"
puts "[#] Total plugin vulnerabilities: #{plugin_vulns_count}"
@@ -529,7 +529,7 @@
# File 'lib/wpstools/plugins/stats/stats_plugin.rb', line 39
def theme_vulns_count(file=THEMES_VULNS_FILE)
- xml(file).xpath("count(//vulnerability)").to_i
+ xml(file).xpath('count(//vulnerability)').to_i
end
@@ -619,7 +619,7 @@
# File 'lib/wpstools/plugins/stats/stats_plugin.rb', line 27
def vuln_plugin_count(file=PLUGINS_VULNS_FILE)
- xml(file).xpath("count(//plugin)").to_i
+ xml(file).xpath('count(//plugin)').to_i
end
@@ -649,7 +649,7 @@
# File 'lib/wpstools/plugins/stats/stats_plugin.rb', line 31
def vuln_theme_count(file=THEMES_VULNS_FILE)
- xml(file).xpath("count(//theme)").to_i
+ xml(file).xpath('count(//theme)').to_i
end
@@ -661,7 +661,7 @@