config file

This commit is contained in:
FireFart
2014-03-22 14:47:31 +01:00
parent b1b8066fe5
commit 7942eaf64b
11 changed files with 139 additions and 2 deletions

View File

@@ -31,7 +31,10 @@ class Browser
# sets browser defaults
browser_defaults
# overrides defaults with user supplied values
# load config file
conf = options[:config_file]
load_config(conf) if conf
# overrides defaults with user supplied values (overwrite values from config)
override_config(options)
unless @hydra
@@ -74,6 +77,24 @@ class Browser
@user_agent = "WPScan v#{WPSCAN_VERSION} (http://wpscan.org)"
end
#
# If an option was set but is not in the new config_file
# it's value is kept
#
# @param [ String ] config_file
#
# @return [ void ]
def load_config(config_file = nil)
if File.symlink?(config_file)
raise '[ERROR] Config file is a symlink.'
else
data = JSON.parse(File.read(config_file))
end
override_config(data)
end
# @param [ String ] url
# @param [ Hash ] params
#