Ref #53 Typhoeus > 0.4.2 support
This commit is contained in:
@@ -30,7 +30,7 @@ class Browser
|
||||
:proxy,
|
||||
:proxy_auth,
|
||||
:max_threads,
|
||||
:cache_timeout,
|
||||
:cache_ttl,
|
||||
:request_timeout,
|
||||
:basic_auth
|
||||
]
|
||||
@@ -113,13 +113,10 @@ class Browser
|
||||
if !auth.include?(:proxy_username) or !auth.include?(:proxy_password)
|
||||
raise_invalid_proxy_format()
|
||||
end
|
||||
@proxy_auth = auth
|
||||
@proxy_auth = auth[:proxy_username] + ':' + auth[:proxy_password]
|
||||
elsif auth.is_a?(String)
|
||||
if matches = %r{([^:]+):(.*)}.match(auth)
|
||||
@proxy_auth = {
|
||||
proxy_username: matches[1],
|
||||
proxy_password: matches[2]
|
||||
}
|
||||
if auth.index(':') != nil
|
||||
@proxy_auth = auth
|
||||
else
|
||||
raise_invalid_proxy_auth_format()
|
||||
end
|
||||
@@ -176,10 +173,10 @@ class Browser
|
||||
|
||||
def merge_request_params(params = {})
|
||||
if @proxy
|
||||
params = params.merge(:proxy => @proxy)
|
||||
params = params.merge(proxy: @proxy)
|
||||
|
||||
if @proxy_auth
|
||||
params = params.merge(@proxy_auth)
|
||||
params = params.merge(proxyauth: @proxy_auth)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -191,24 +188,23 @@ class Browser
|
||||
end
|
||||
end
|
||||
|
||||
# TODO : check if it's the default value into ethon. If so, removed the lines from here
|
||||
unless params.has_key?(:ssl_verifyhost)
|
||||
params = params.merge(ssl_verifyhost: 0)
|
||||
end
|
||||
#unless params.has_key?(:ssl_verifyhost)
|
||||
# params = params.merge(ssl_verifyhost: 0)
|
||||
#end
|
||||
|
||||
unless params.has_key?(:ssl_verifypeer)
|
||||
params = params.merge(ssl_verifypeer: false)
|
||||
end
|
||||
#unless params.has_key?(:ssl_verifypeer)
|
||||
# params = params.merge(ssl_verifypeer: 0)
|
||||
#end
|
||||
|
||||
if !params.has_key?(:headers)
|
||||
params = params.merge(:headers => {'ser-agent' => self.user_agent})
|
||||
elsif !params[:headers].has_key?('user-agent')
|
||||
params[:headers]['user-agent'] = self.user_agent
|
||||
params = params.merge(:headers => {'User-Agent' => self.user_agent})
|
||||
elsif !params[:headers].has_key?('User-Agent')
|
||||
params[:headers]['User-Agent'] = self.user_agent
|
||||
end
|
||||
|
||||
# Used to enable the cache system if :cache_timeout > 0
|
||||
# Used to enable the cache system if :cache_ttl > 0
|
||||
unless params.has_key?(:cache_ttl)
|
||||
params = params.merge(cache_ttl: @cache_timeout)
|
||||
params = params.merge(cache_ttl: @cache_ttl)
|
||||
end
|
||||
|
||||
params
|
||||
|
||||
@@ -59,8 +59,8 @@ class CacheFileStore
|
||||
end
|
||||
end
|
||||
|
||||
def write_entry(key, data_to_store, cache_timeout)
|
||||
if cache_timeout > 0
|
||||
def write_entry(key, data_to_store, cache_ttl)
|
||||
if cache_ttl > 0
|
||||
File.open(get_entry_file_path(key), 'w') do |f|
|
||||
f.write(@serializer.dump(data_to_store))
|
||||
end
|
||||
|
||||
@@ -36,10 +36,11 @@ module BruteForce
|
||||
password_found = false
|
||||
|
||||
File.open(wordlist_path, 'r').each do |password|
|
||||
|
||||
# ignore file comments, but will miss passwords if they start with a hash...
|
||||
next if password[0, 1] == '#'
|
||||
|
||||
password.strip!
|
||||
|
||||
# keep a count of the amount of requests to be sent
|
||||
request_count += 1
|
||||
queue_count += 1
|
||||
@@ -52,8 +53,8 @@ module BruteForce
|
||||
request = Browser.instance.forge_request(login_url,
|
||||
{
|
||||
method: :post,
|
||||
params: { log: URI::encode(username), pwd: URI::encode(password) },
|
||||
cache_timeout: 0
|
||||
body: { log: URI::encode(username), pwd: URI::encode(password) },
|
||||
cache_ttl: 0
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -23,10 +23,11 @@ module WpConfigBackup
|
||||
# See http://www.feross.org/cmsploit/
|
||||
# return an array of backup config files url
|
||||
def config_backup
|
||||
found = []
|
||||
backups = WpConfigBackup.config_backup_files
|
||||
browser = Browser.instance
|
||||
hydra = browser.hydra
|
||||
found = []
|
||||
backups = WpConfigBackup.config_backup_files
|
||||
browser = Browser.instance
|
||||
hydra = browser.hydra
|
||||
queue_count = 0
|
||||
|
||||
backups.each do |file|
|
||||
file_url = @uri.merge(URI.escape(file)).to_s
|
||||
@@ -39,6 +40,12 @@ module WpConfigBackup
|
||||
end
|
||||
|
||||
hydra.queue(request)
|
||||
queue_count += 1
|
||||
|
||||
if queue_count == browser.max_threads
|
||||
hydra.run
|
||||
queue_count = 0
|
||||
end
|
||||
end
|
||||
|
||||
hydra.run
|
||||
|
||||
@@ -48,12 +48,14 @@ class WebSite
|
||||
|
||||
def xml_rpc_url
|
||||
unless @xmlrpc_url
|
||||
headers = Browser.instance.get(@uri.to_s).headers_hash
|
||||
value = headers['x-pingback']
|
||||
if value.nil? or value.empty?
|
||||
@xmlrpc_url = nil
|
||||
else
|
||||
@xmlrpc_url = value
|
||||
headers = Browser.instance.get(@uri.to_s).headers_hash
|
||||
@xmlrpc_url = nil
|
||||
|
||||
unless headers.nil?
|
||||
value = headers['X-Pingback']
|
||||
unless value.nil? && value.empty?
|
||||
@xmlrpc_url = value
|
||||
end
|
||||
end
|
||||
end
|
||||
@xmlrpc_url
|
||||
|
||||
Reference in New Issue
Block a user