new options
This commit is contained in:
@@ -18,7 +18,9 @@ class Browser
|
|||||||
:request_timeout,
|
:request_timeout,
|
||||||
:connect_timeout,
|
:connect_timeout,
|
||||||
:cookie,
|
:cookie,
|
||||||
:throttle
|
:throttle,
|
||||||
|
:disable_accept_header,
|
||||||
|
:disable_referer
|
||||||
]
|
]
|
||||||
|
|
||||||
@@instance = nil
|
@@instance = nil
|
||||||
@@ -68,6 +70,7 @@ class Browser
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Override for setting the User-Agent
|
# Override for setting the User-Agent
|
||||||
|
# @param [ String ] user_agent
|
||||||
def user_agent=(user_agent)
|
def user_agent=(user_agent)
|
||||||
Typhoeus::Config.user_agent = user_agent
|
Typhoeus::Config.user_agent = user_agent
|
||||||
end
|
end
|
||||||
@@ -158,6 +161,8 @@ class Browser
|
|||||||
params.merge!(cookiejar: @cache_dir + '/cookie-jar')
|
params.merge!(cookiejar: @cache_dir + '/cookie-jar')
|
||||||
params.merge!(cookiefile: @cache_dir + '/cookie-jar')
|
params.merge!(cookiefile: @cache_dir + '/cookie-jar')
|
||||||
params.merge!(cookie: @cookie) if @cookie
|
params.merge!(cookie: @cookie) if @cookie
|
||||||
|
params = Browser.remove_params_header_field(params, 'Accept') if @disable_accept_header
|
||||||
|
params = Browser.remove_params_header_field(params, 'Referer') if @disable_referer
|
||||||
|
|
||||||
params
|
params
|
||||||
end
|
end
|
||||||
@@ -177,4 +182,18 @@ class Browser
|
|||||||
end
|
end
|
||||||
params
|
params
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @param [ Hash ] params
|
||||||
|
# @param [ String ] field
|
||||||
|
# @param [ Mixed ] field_value
|
||||||
|
#
|
||||||
|
# @return [ Array ]
|
||||||
|
def self.remove_params_header_field(params = {}, field)
|
||||||
|
if !params.has_key?(:headers)
|
||||||
|
params = params.merge(:headers => { field => nil })
|
||||||
|
elsif !params[:headers].has_key?(field)
|
||||||
|
params[:headers][field] = nil
|
||||||
|
end
|
||||||
|
params
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,9 +3,8 @@
|
|||||||
class Browser
|
class Browser
|
||||||
module Options
|
module Options
|
||||||
|
|
||||||
attr_accessor :request_timeout, :connect_timeout
|
attr_accessor :request_timeout, :connect_timeout, :user_agent, :disable_accept_header, :disable_referer
|
||||||
attr_reader :basic_auth, :cache_ttl, :proxy, :proxy_auth, :throttle
|
attr_reader :basic_auth, :cache_ttl, :proxy, :proxy_auth, :throttle
|
||||||
attr_writer :user_agent
|
|
||||||
|
|
||||||
# Sets the Basic Authentification credentials
|
# Sets the Basic Authentification credentials
|
||||||
# Accepted format:
|
# Accepted format:
|
||||||
|
|||||||
@@ -43,7 +43,9 @@ class WpscanOptions
|
|||||||
:connect_timeout,
|
:connect_timeout,
|
||||||
:max_threads,
|
:max_threads,
|
||||||
:no_banner,
|
:no_banner,
|
||||||
:throttle
|
:throttle,
|
||||||
|
:disable_accept_header,
|
||||||
|
:disable_referer
|
||||||
]
|
]
|
||||||
|
|
||||||
attr_accessor *ACCESSOR_OPTIONS
|
attr_accessor *ACCESSOR_OPTIONS
|
||||||
@@ -208,7 +210,9 @@ class WpscanOptions
|
|||||||
|
|
||||||
enumerate_options_from_string(cli_value)
|
enumerate_options_from_string(cli_value)
|
||||||
else
|
else
|
||||||
raise "Unknow option : #{cli_option} with value #{cli_value}"
|
text = "Unknown option : #{cli_option}"
|
||||||
|
text << " with value #{cli_value}" if (cli_value && !cli_value.empty?)
|
||||||
|
raise text
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -282,7 +286,9 @@ class WpscanOptions
|
|||||||
['--cookie', GetoptLong::REQUIRED_ARGUMENT],
|
['--cookie', GetoptLong::REQUIRED_ARGUMENT],
|
||||||
['--log', GetoptLong::NO_ARGUMENT],
|
['--log', GetoptLong::NO_ARGUMENT],
|
||||||
['--no-banner', GetoptLong::NO_ARGUMENT],
|
['--no-banner', GetoptLong::NO_ARGUMENT],
|
||||||
['--throttle', GetoptLong::REQUIRED_ARGUMENT]
|
['--throttle', GetoptLong::REQUIRED_ARGUMENT],
|
||||||
|
['--disable-accept-header', GetoptLong::NO_ARGUMENT],
|
||||||
|
['--disable-referer', GetoptLong::NO_ARGUMENT]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user