diff --git a/doc/Array.html b/doc/Array.html index 9b0b767e..8bae154d 100644 --- a/doc/Array.html +++ b/doc/Array.html @@ -85,6 +85,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • diff --git a/doc/Browser.html b/doc/Browser.html index a800bee6..6487c717 100644 --- a/doc/Browser.html +++ b/doc/Browser.html @@ -101,6 +101,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • @@ -226,6 +228,11 @@
    +
    USER_AGENT_MODES
    + +
    + + @@ -294,7 +301,7 @@
    -# File lib/browser.rb, line 57
    +# File lib/browser.rb, line 58
     def self.instance(options = {})
       unless @@instance
         @@instance = new(options)
    @@ -330,7 +337,7 @@
                 
                 
    -# File lib/browser.rb, line 64
    +# File lib/browser.rb, line 65
     def self.reset
       @@instance = nil
     end
    @@ -369,11 +376,11 @@
    -# File lib/browser.rb, line 140
    +# File lib/browser.rb, line 142
     def forge_request(url, params = {})
       Typhoeus::Request.new(
    -    url.to_s,
    -    merge_request_params(params)
    +      url.to_s,
    +      merge_request_params(params)
       )
     end
    @@ -405,10 +412,10 @@
    -# File lib/browser.rb, line 128
    +# File lib/browser.rb, line 130
     def get(url, params = {})
       run_request(
    -    forge_request(url, params.merge(:method => :get))
    +      forge_request(url, params.merge(:method => :get))
       )
     end
    @@ -443,7 +450,7 @@ browser object, hydra will not have the new @max_threads and
    -# File lib/browser.rb, line 101
    +# File lib/browser.rb, line 102
     def load_config(config_file = nil)
       @config_file = config_file || @config_file
     
    @@ -484,7 +491,7 @@ browser object, hydra will not have the new @max_threads and
                 
                 
    -# File lib/browser.rb, line 93
    +# File lib/browser.rb, line 94
     def max_threads=(max_threads)
       if max_threads.nil? or max_threads <= 0
         max_threads = 1
    @@ -520,17 +527,17 @@ browser object, hydra will not have the new @max_threads and
                 
                 
    -# File lib/browser.rb, line 147
    +# File lib/browser.rb, line 149
     def merge_request_params(params = {})
       if @proxy
         params = params.merge(:proxy => @proxy)
       end
     
    -  if !params.has_key?(:disable_ssl_host_verification)
    +  unless params.has_key?(:disable_ssl_host_verification)
         params = params.merge(:disable_ssl_host_verification => true)
       end
     
    -  if !params.has_key?(:disable_ssl_peer_verification)
    +  unless params.has_key?(:disable_ssl_peer_verification)
         params = params.merge(:disable_ssl_peer_verification => true)
       end
     
    @@ -541,7 +548,7 @@ browser object, hydra will not have the new @max_threads and
       end
     
       # Used to enable the cache system if :cache_timeout > 0
    -  if !params.has_key?(:cache_timeout)
    +  unless params.has_key?(:cache_timeout)
         params = params.merge(:cache_timeout => @cache_timeout)
       end
     
    @@ -576,10 +583,10 @@ browser object, hydra will not have the new @max_threads and
                 
                 
    -# File lib/browser.rb, line 134
    +# File lib/browser.rb, line 136
     def post(url, params = {})
       run_request(
    -    forge_request(url, params.merge(:method => :post))
    +      forge_request(url, params.merge(:method => :post))
       )
     end
    @@ -611,15 +618,15 @@ browser object, hydra will not have the new @max_threads and
    -# File lib/browser.rb, line 81
    +# File lib/browser.rb, line 82
     def user_agent
       case @user_agent_mode
    -  when "semi-static"
    -    unless @user_agent
    +    when "semi-static"
    +      unless @user_agent
    +        @user_agent = @available_user_agents.sample
    +      end
    +    when "random"
           @user_agent = @available_user_agents.sample
    -    end
    -  when "random"
    -    @user_agent = @available_user_agents.sample
       end
       @user_agent
     end
    @@ -652,11 +659,11 @@ browser object, hydra will not have the new @max_threads and
    -# File lib/browser.rb, line 68
    +# File lib/browser.rb, line 69
     def user_agent_mode=(ua_mode)
       ua_mode ||= "static"
     
    -  if @@user_agent_modes.include?(ua_mode)
    +  if USER_AGENT_MODES.include?(ua_mode)
         @user_agent_mode = ua_mode
         # For semi-static user agent mode, the user agent has to be nil the first time (it will be set with the getter)
         @user_agent = nil if ua_mode === "semi-static"
    diff --git a/doc/BruteForce.html b/doc/BruteForce.html
    index de5d7045..4cd89924 100644
    --- a/doc/BruteForce.html
    +++ b/doc/BruteForce.html
    @@ -77,6 +77,8 @@
             
               
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • @@ -304,21 +306,21 @@ on large wordlists, although bareable.

    if response.body =~ /login_error/ puts "\nIncorrect username and/or password." if @verbose elsif response.code == 302 - puts "\n [SUCCESS] Username : #{username} Password : #{password}\n" + puts "\n " + green("[SUCCESS]") + " Username : #{username} Password : #{password}\n" found << { :name => username, :password => password } password_found = true elsif response.timed_out? - puts "ERROR: Request timed out." + puts red("ERROR:") + " Request timed out." elsif response.code == 0 - puts "ERROR: No response from remote server. WAF/IPS?" + puts red("ERROR:") + " No response from remote server. WAF/IPS?" # code is a fixnum, needs a string for regex elsif response.code.to_s =~ /^50/ - puts "ERROR: Server error, try reducing the number of threads." + puts red("ERROR:") + " Server error, try reducing the number of threads." else - puts "\nERROR: We recieved an unknown response for #{password}..." + puts "\n" + red("ERROR:") + " We recieved an unknown response for #{password}..." if @verbose - puts "Code: #{response.code.to_s}" - puts "Body: #{response.body}" + puts red("Code: #{response.code.to_s}") + puts red("Body: #{response.body}") puts end end diff --git a/doc/CREDITS.html b/doc/CREDITS.html index 725d9ef4..de771b21 100644 --- a/doc/CREDITS.html +++ b/doc/CREDITS.html @@ -41,6 +41,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • diff --git a/doc/CacheFileStore.html b/doc/CacheFileStore.html index 24ca0e9f..8d0b8139 100644 --- a/doc/CacheFileStore.html +++ b/doc/CacheFileStore.html @@ -91,6 +91,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • @@ -276,10 +278,10 @@ binary format Marshal does not need any “require”

    # File lib/cache_file_store.rb, line 34 def initialize(storage_path, serializer = Marshal) @storage_path = File.expand_path(storage_path) - @serializer = serializer + @serializer = serializer # File.directory? for ruby <= 1.9 otherwise, it makes more sense to do Dir.exist? :/ - if !File.directory?(@storage_path) + unless File.directory?(@storage_path) Dir.mkdir(@storage_path) end end
    @@ -425,7 +427,7 @@ binary format Marshal does not need any “require”

     # File lib/cache_file_store.rb, line 58
     def write_entry(key, data_to_store, cache_timeout)
    -  if (cache_timeout > 0)
    +  if cache_timeout > 0
         File.open(get_entry_file_path(key), 'w') do |f|
           f.write(@serializer.dump(data_to_store))
         end
    diff --git a/doc/Exploit.html b/doc/Exploit.html
    index 487ea20d..d1f36c7f 100644
    --- a/doc/Exploit.html
    +++ b/doc/Exploit.html
    @@ -109,6 +109,8 @@
             
               
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • @@ -441,7 +443,7 @@ session_spawn_timer = Time.new while sessions.nil? or sessions.empty? # wait for a session to spawn with a timeout of 1 minute - if (Time.now - session_spawn_timer > 60) + if Time.now - session_spawn_timer > 60 puts "[ERROR] Session was not created... exiting." return false end diff --git a/doc/Generate_List.html b/doc/Generate_List.html index 5c6c747a..e27b93d9 100644 --- a/doc/Generate_List.html +++ b/doc/Generate_List.html @@ -91,6 +91,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • @@ -263,23 +265,23 @@ # File lib/wpstools/generate_list.rb, line 27 def initialize(type, verbose) if type =~ /plugins/ - @type = "plugin" - @svn_url = 'http://plugins.svn.wordpress.org/' - @file_name = DATA_DIR + '/plugins.txt' - @popular_url = 'http://wordpress.org/extend/plugins/browse/popular/' - @popular_regex = %{<h3><a href="http://wordpress.org/extend/plugins/(.+)/">.+</a></h3>} + @type = "plugin" + @svn_url = 'http://plugins.svn.wordpress.org/' + @file_name = DATA_DIR + '/plugins.txt' + @popular_url = 'http://wordpress.org/extend/plugins/browse/popular/' + @popular_regex = %{<h3><a href="http://wordpress.org/extend/plugins/(.+)/">.+</a></h3>} elsif type =~ /themes/ - @type = "theme" - @svn_url = 'http://themes.svn.wordpress.org/' - @file_name = DATA_DIR + '/themes.txt' - @popular_url = 'http://wordpress.org/extend/themes/browse/popular/' - @popular_regex = %{<h3><a href="http://wordpress.org/extend/themes/(.+)">.+</a></h3>} + @type = "theme" + @svn_url = 'http://themes.svn.wordpress.org/' + @file_name = DATA_DIR + '/themes.txt' + @popular_url = 'http://wordpress.org/extend/themes/browse/popular/' + @popular_regex = %{<h3><a href="http://wordpress.org/extend/themes/(.+)">.+</a></h3>} else raise "Type #{type} not defined" end - @verbose = verbose - @browser = Browser.instance - @hydra = @browser.hydra + @verbose = verbose + @browser = Browser.instance + @hydra = @browser.hydra end
    @@ -411,17 +413,16 @@ parse the response for the names.

    @hydra.queue(request) if queue_count == @browser.max_threads - @hydra.run - queue_count = 0 - end + @hydra.run + queue_count = 0 + end end @hydra.run found_items.sort! - found_items.uniq! - return found_items + found_items.uniq end
    @@ -452,7 +453,7 @@ parse the response for the names.

    -# File lib/wpstools/generate_list.rb, line 100
    +# File lib/wpstools/generate_list.rb, line 99
     def save(items)
       items.sort!
       items.uniq!
    diff --git a/doc/GitUpdater.html b/doc/GitUpdater.html
    index 2dfd95bc..878ac76c 100644
    --- a/doc/GitUpdater.html
    +++ b/doc/GitUpdater.html
    @@ -89,6 +89,8 @@
             
               
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • diff --git a/doc/Malwares.html b/doc/Malwares.html index 0e3d196a..f679e02a 100644 --- a/doc/Malwares.html +++ b/doc/Malwares.html @@ -81,6 +81,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • @@ -333,8 +335,8 @@ # File lib/wpscan/modules/malwares.rb, line 28 def malwares(malwares_file_path = nil) if @malwares.nil? - malwares_found = [] - malwares_file = Malwares.malwares_file(malwares_file_path) + malwares_found = [] + malwares_file = Malwares.malwares_file(malwares_file_path) index_page_body = Browser.instance.get(@uri.to_s).body File.open(malwares_file, 'r') do |file| diff --git a/doc/Object.html b/doc/Object.html index 6bf2cd25..f6593bfd 100644 --- a/doc/Object.html +++ b/doc/Object.html @@ -77,10 +77,16 @@
  • #banner
  • +
  • #colorize
  • +
  • #get_equal_string_end
  • +
  • #green
  • +
  • #help
  • +
  • #red
  • +
  • #require_files_from_directory
  • #usage
  • @@ -101,6 +107,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • @@ -372,7 +380,7 @@ +
    + + + +
    + colorize(text, color_code) + click to toggle source +
    + + +
    + + + + + +
    +
    +# File lib/common_helper.rb, line 125
    +def colorize(text, color_code)
    +  "\e[#{color_code}m#{text}\e[0m"
    +end
    +
    + +
    + + + + +
    + +
    @@ -435,7 +476,7 @@ break end end - if looping == false or (counter * -1 ) > base.length + if looping == false or (counter * -1) > base.length break end already_found = "#{character if character}#{already_found}" @@ -454,6 +495,39 @@
    +
    + + + +
    + green(text) + click to toggle source +
    + + +
    + + + + + +
    +
    +# File lib/common_helper.rb, line 133
    +def green(text)
    +  colorize(text, 32)
    +end
    +
    + +
    + + + + +
    + +
    @@ -518,6 +592,39 @@
    +
    + + + +
    + red(text) + click to toggle source +
    + + +
    + + + + + +
    +
    +# File lib/common_helper.rb, line 129
    +def red(text)
    +  colorize(text, 31)
    +end
    +
    + +
    + + + + +
    + +
    diff --git a/doc/README.html b/doc/README.html index 0b0eca7b..dba47cfd 100644 --- a/doc/README.html +++ b/doc/README.html @@ -41,6 +41,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • diff --git a/doc/RpcClient.html b/doc/RpcClient.html index 8d018161..1402ac61 100644 --- a/doc/RpcClient.html +++ b/doc/RpcClient.html @@ -109,6 +109,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • @@ -344,11 +346,10 @@ wpscan -P wpscan -f -t Web -u /RPC2 name = exploit/unix/webapp/php_include

    -# File lib/wpscan/msfrpc_client.rb, line 96
    +# File lib/wpscan/msfrpc_client.rb, line 93
     def exploit(name, opts)
       authenticate()
    -  result = @server.call('module.execute', @auth_token, 'exploit', name, opts)
    -  return result
    +  @server.call('module.execute', @auth_token, 'exploit', name, opts)
     end
    @@ -382,8 +383,7 @@ wpscan -P wpscan -f -t Web -u /RPC2 name = exploit/unix/webapp/php_include

    # File lib/wpscan/msfrpc_client.rb, line 72 def get_exploit_info(name) authenticate() - result = @server.call('module.info', @auth_token, 'exploit', name) - return result + @server.call('module.info', @auth_token, 'exploit', name) end
    @@ -414,11 +414,10 @@ wpscan -P wpscan -f -t Web -u /RPC2 name = exploit/unix/webapp/php_include

    -# File lib/wpscan/msfrpc_client.rb, line 80
    +# File lib/wpscan/msfrpc_client.rb, line 79
     def get_options(name)
       authenticate()
    -  result = @server.call('module.options', @auth_token, 'exploit',name)
    -  return result
    +  @server.call('module.options', @auth_token, 'exploit',name)
     end
    @@ -449,11 +448,10 @@ wpscan -P wpscan -f -t Web -u /RPC2 name = exploit/unix/webapp/php_include

    -# File lib/wpscan/msfrpc_client.rb, line 88
    +# File lib/wpscan/msfrpc_client.rb, line 86
     def get_payloads(name)
       authenticate()
    -  result = @server.call('module.compatible_payloads', @auth_token, name)
    -  return result
    +  @server.call('module.compatible_payloads', @auth_token, name)
     end
    @@ -484,11 +482,10 @@ wpscan -P wpscan -f -t Web -u /RPC2 name = exploit/unix/webapp/php_include

    -# File lib/wpscan/msfrpc_client.rb, line 104
    +# File lib/wpscan/msfrpc_client.rb, line 100
     def jobs()
       authenticate()
    -  result = @server.call('job.list', @auth_token)
    -  return result
    +  @server.call('job.list', @auth_token)
     end
    @@ -519,11 +516,10 @@ wpscan -P wpscan -f -t Web -u /RPC2 name = exploit/unix/webapp/php_include

    -# File lib/wpscan/msfrpc_client.rb, line 120
    +# File lib/wpscan/msfrpc_client.rb, line 114
     def kill_session(id)
       authenticate()
    -  result = @server.call('session.stop', @auth_token, id)
    -  return result
    +  @server.call('session.stop', @auth_token, id)
     end
    @@ -597,11 +593,10 @@ wpscan -P wpscan -f -t Web -u /RPC2 name = exploit/unix/webapp/php_include

    -# File lib/wpscan/msfrpc_client.rb, line 142
    +# File lib/wpscan/msfrpc_client.rb, line 133
     def meterpreter_read(id)
       authenticate()
    -  result = @server.call('session.meterpreter_read', @auth_token, id)
    -  return result
    +  @server.call('session.meterpreter_read', @auth_token, id)
     end
    @@ -632,11 +627,10 @@ wpscan -P wpscan -f -t Web -u /RPC2 name = exploit/unix/webapp/php_include

    -# File lib/wpscan/msfrpc_client.rb, line 148
    +# File lib/wpscan/msfrpc_client.rb, line 138
     def meterpreter_write(id, data)
       authenticate()
    -  result = @server.call('session.meterpreter_write', @auth_token, id, data)
    -  return result
    +  @server.call('session.meterpreter_write', @auth_token, id, data)
     end
    @@ -667,11 +661,10 @@ wpscan -P wpscan -f -t Web -u /RPC2 name = exploit/unix/webapp/php_include

    -# File lib/wpscan/msfrpc_client.rb, line 128
    +# File lib/wpscan/msfrpc_client.rb, line 121
     def read_shell(id)
       authenticate()
    -  result = @server.call('session.shell_read', @auth_token, id)
    -  return result
    +  @server.call('session.shell_read', @auth_token, id)
     end
    @@ -702,11 +695,10 @@ wpscan -P wpscan -f -t Web -u /RPC2 name = exploit/unix/webapp/php_include

    -# File lib/wpscan/msfrpc_client.rb, line 112
    +# File lib/wpscan/msfrpc_client.rb, line 107
     def sessions()
       authenticate()
    -  result = @server.call('session.list', @auth_token)
    -  return result
    +  @server.call('session.list', @auth_token)
     end
    @@ -737,11 +729,10 @@ wpscan -P wpscan -f -t Web -u /RPC2 name = exploit/unix/webapp/php_include

    -# File lib/wpscan/msfrpc_client.rb, line 136
    +# File lib/wpscan/msfrpc_client.rb, line 128
     def write_shell(id, data)
       authenticate()
    -  result = @server.call('session.shell_write', @auth_token, id, data)
    -  return result
    +  @server.call('session.shell_write', @auth_token, id, data)
     end
    diff --git a/doc/SvnUpdater.html b/doc/SvnUpdater.html index ebb1f7f8..be911f42 100644 --- a/doc/SvnUpdater.html +++ b/doc/SvnUpdater.html @@ -87,6 +87,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • @@ -202,6 +204,24 @@ + +
    +

    Constants

    +
    + +
    REVISION_PATTERN
    + +
    + + +
    TRUNK_URL
    + +
    + + +
    +
    + @@ -232,7 +252,7 @@
     # File lib/updater/svn_updater.rb, line 26
     def is_installed?
    -  %[svn info "#{@repo_directory}" --xml 2>&1] =~ /revision=/ ? true : false
    +  %[svn info "#@repo_directory" --xml 2>&1] =~ /revision=/ ? true : false
     end
    @@ -265,8 +285,8 @@
     # File lib/updater/svn_updater.rb, line 30
     def local_revision_number
    -  local_revision = %[svn info "#{@repo_directory}" --xml 2>&1]
    -  local_revision[@@revision_pattern, 1].to_s
    +  local_revision = %[svn info "#@repo_directory" --xml 2>&1]
    +  local_revision[REVISION_PATTERN, 1].to_s
     end
    @@ -299,7 +319,7 @@
     # File lib/updater/svn_updater.rb, line 35
     def update
    -  %[svn up "#{@repo_directory}"]
    +  %[svn up "#@repo_directory"]
     end
    diff --git a/doc/Svn_Parser.html b/doc/Svn_Parser.html index 5728744f..42dfdb12 100644 --- a/doc/Svn_Parser.html +++ b/doc/Svn_Parser.html @@ -85,6 +85,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • @@ -290,11 +292,11 @@
     # File lib/wpstools/parse_svn.rb, line 26
     def initialize(svn_root, verbose, keep_empty_dirs = false)
    -  @svn_root = svn_root
    -  @verbose = verbose
    -  @keep_empty_dirs = keep_empty_dirs
    -  @svn_browser = Browser.instance
    -  @svn_hydra = @svn_browser.hydra
    +  @svn_root         = svn_root
    +  @verbose          = verbose
    +  @keep_empty_dirs  = keep_empty_dirs
    +  @svn_browser      = Browser.instance
    +  @svn_hydra        = @svn_browser.hydra
     end
    @@ -337,8 +339,7 @@ dirs = get_root_directories end urls = get_svn_project_urls(dirs) - entries = get_svn_file_entries(urls) - return entries + get_svn_file_entries(urls) end diff --git a/doc/Updater.html b/doc/Updater.html index 9318f8ee..590e8588 100644 --- a/doc/Updater.html +++ b/doc/Updater.html @@ -91,6 +91,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • diff --git a/doc/UpdaterFactory.html b/doc/UpdaterFactory.html index d9174eef..c1759ba1 100644 --- a/doc/UpdaterFactory.html +++ b/doc/UpdaterFactory.html @@ -85,6 +85,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • diff --git a/doc/Vulnerable.html b/doc/Vulnerable.html index 32578155..4277cbe9 100644 --- a/doc/Vulnerable.html +++ b/doc/Vulnerable.html @@ -83,6 +83,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • @@ -205,11 +207,11 @@

    Attributes

    -
    - +
    +
    - vulns_xmlvulns_file[R]
    @@ -268,7 +270,7 @@ be empty)

    def vulnerabilities vulnerabilities = [] - xml = Nokogiri::XML(File.open(@vulns_xml)) do |config| + xml = Nokogiri::XML(File.open(@vulns_file)) do |config| config.noblanks end diff --git a/doc/WebSite.html b/doc/WebSite.html index 89f9c184..dcf80a41 100644 --- a/doc/WebSite.html +++ b/doc/WebSite.html @@ -81,6 +81,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • @@ -224,7 +226,7 @@
    -# File lib/wpscan/modules/web_site.rb, line 50
    +# File lib/wpscan/modules/web_site.rb, line 52
     def is_online?
       Browser.instance.get(@uri.to_s).code != 0
     end
    @@ -261,15 +263,17 @@ def is_wordpress? wordpress = false - response = Browser.instance.get(login_url(), - { :follow_location => true, :max_redirects => 2 } + response = Browser.instance.get( + login_url(), + {:follow_location => true, :max_redirects => 2} ) if response.body =~ %{WordPress} wordpress = true else - response = Browser.instance.get(xmlrpc_url(), - { :follow_location => true, :max_redirects => 2 } + response = Browser.instance.get( + xmlrpc_url(), + {:follow_location => true, :max_redirects => 2} ) if response.body =~ %{XML-RPC server accepts POST requests only} @@ -309,8 +313,9 @@ redirection or nil

    -# File lib/wpscan/modules/web_site.rb, line 56
    +# File lib/wpscan/modules/web_site.rb, line 58
     def redirection(url = nil)
    +  redirection = nil
       url ||= @uri.to_s
       response = Browser.instance.get(url)
     
    @@ -349,7 +354,7 @@ redirection or nil

    -# File lib/wpscan/modules/web_site.rb, line 45
    +# File lib/wpscan/modules/web_site.rb, line 47
     def xmlrpc_url
       @uri.merge("xmlrpc.php").to_s
     end
    diff --git a/doc/WpConfigBackup.html b/doc/WpConfigBackup.html index f547a1c0..dd5ec418 100644 --- a/doc/WpConfigBackup.html +++ b/doc/WpConfigBackup.html @@ -77,6 +77,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • @@ -222,10 +224,11 @@
     # File lib/wpscan/modules/wp_config_backup.rb, line 49
     def self.config_backup_files
    -  [
    -    'wp-config.php~','#wp-config.php#','wp-config.php.save','wp-config.php.swp','wp-config.php.swo','wp-config.php_bak',
    -    'wp-config.bak', 'wp-config.php.bak', 'wp-config.save'
    -  ] # thanks to Feross.org for these
    +  %{
    +    wp-config.php~ #wp-config.php# wp-config.php.save wp-config.php.swp wp-config.php.swo wp-config.php_bak
    +    wp-config.bak wp-config.php.bak wp-config.save wp-config.old wp-config.php.old wp-config.php.orig
    +    wp-config.orig wp-config.php.original wp-config.original
    +  } # thanks to Feross.org for these
     end
    @@ -266,14 +269,14 @@ an array of backup config files url

     # File lib/wpscan/modules/wp_config_backup.rb, line 24
     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
     
       backups.each do |file|
         file_url = @uri.merge(URI.escape(file)).to_s
    -    request  = browser.forge_request(file_url)
    +    request = browser.forge_request(file_url)
     
         request.on_complete do |response|
           if response.body[%{define}] and not response.body[%{<\s?html}]
    diff --git a/doc/WpDetector.html b/doc/WpDetector.html
    index 46ca318b..9cf2a0e3 100644
    --- a/doc/WpDetector.html
    +++ b/doc/WpDetector.html
    @@ -85,6 +85,8 @@
             
               
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • @@ -242,12 +244,12 @@ already_present = false result.each do |r| # Already found via passive detection - if r[:name] == enum_result[:name] + if r.name == enum_result.name already_present = true break end end - if not already_present + unless already_present result << enum_result end end @@ -300,12 +302,14 @@ names.uniq! names.each do |item| - items << { + items << WpItem.new( :url => url, :name => item, - :path => "#{type}/#{item}/", - :wp_content_dir => wp_content_dir - } + :type => type, + :path => "#{item}/", + :wp_content_dir => wp_content_dir, + :vulns_file => "" + ) end items end
    diff --git a/doc/WpEnumerator.html b/doc/WpEnumerator.html index 63c40b5a..0042d206 100644 --- a/doc/WpEnumerator.html +++ b/doc/WpEnumerator.html @@ -85,6 +85,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • @@ -271,11 +273,7 @@ enumerate_size = targets.size targets.each do |target| - # Timthumb files have no /timthumbs/ directory - unless options[:type] =~ /timthumbs/ - target[:path] = "#{options[:type]}/#{target[:path]}" - end - url = "#{target[:url]}#{target[:wp_content_dir]}/#{target[:path]}" + url = target.get_url request = enum_browser.forge_request(url, { :cache_timeout => 0, :follow_location => true }) request_count += 1 @@ -338,7 +336,7 @@
    -# File lib/wpscan/wp_enumerator.rb, line 88
    +# File lib/wpscan/wp_enumerator.rb, line 84
     def self.generate_items(options = {})
       only_vulnerable   = options[:only_vulnerable_ones]
       file              = options[:file]
    @@ -346,18 +344,22 @@
       wp_content_dir    = options[:wp_content_dir]
       url               = options[:url]
       type              = options[:type]
    +  plugins_dir       = options[:wp_plugins_dir]
       targets_url       = []
     
    -  if only_vulnerable == false
    +  unless only_vulnerable
         # Open and parse the 'most popular' plugin list...
    -    File.open(file, 'r') do |f|
    +    File.open(file, "r") do |f|
           f.readlines.collect do |line|
    -        targets_url << {
    +        targets_url << WpItem.new(
                 :url            => url,
                 :path           => line.strip,
                 :wp_content_dir => wp_content_dir,
    -            :name           => File.dirname(line.strip)
    -        }
    +            :name           => File.dirname(line.strip),
    +            :vulns_file     => vulns_file,
    +            :type           => type,
    +            :wp_plugins_dir => plugins_dir
    +        )
           end
         end
       end
    @@ -371,17 +373,20 @@
         # We check if the plugin name from the plugin_vulns_file is already in targets, otherwise we add it
         xml.xpath(options[:vulns_xpath_2]).each do |node|
           name = node.attribute("name").text
    -      targets_url << {
    +      targets_url << WpItem.new(
               :url            => url,
               :path           => name,
               :wp_content_dir => wp_content_dir,
    -          :name           => name
    -      }
    +          :name           => name,
    +          :vulns_file     => vulns_file,
    +          :type           => type,
    +          :wp_plugins_dir => plugins_dir
    +      )
           end
       end
     
    -  targets_url.flatten!
    -  targets_url.uniq!
    +  targets_url.flatten! { |t| t.name }
    +  targets_url.uniq! { |t| t.name }
       # randomize the plugins array to *maybe* help in some crappy IDS/IPS/WAF detection
       targets_url.sort_by! { rand }
     end
    diff --git a/doc/WpFullPathDisclosure.html b/doc/WpFullPathDisclosure.html index 0ec6f309..cf0b7495 100644 --- a/doc/WpFullPathDisclosure.html +++ b/doc/WpFullPathDisclosure.html @@ -77,6 +77,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • diff --git a/doc/WpItem.html b/doc/WpItem.html index e1fc769e..e67b0fdb 100644 --- a/doc/WpItem.html +++ b/doc/WpItem.html @@ -79,6 +79,8 @@
  • #extract_name_from_url
  • +
  • #get_sub_folder
  • +
  • #get_url
  • #get_url_without_filename
  • @@ -109,6 +111,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • @@ -262,6 +266,23 @@ +
    +
    + +
    + + + + +
    + type[RW] +
    + +
    + + +
    @@ -282,13 +303,13 @@
    -
    - +
    + - +
    - vulns_xmlvulns_file[RW]
    @@ -330,6 +351,23 @@ +
    +
    + +
    + + + + +
    + wp_plugin_dir[RW] +
    + +
    + + +
    @@ -348,7 +386,7 @@
    new(options = {}) + class="method-args">(options) click to toggle source
    @@ -362,19 +400,22 @@
     # File lib/wpscan/wp_item.rb, line 25
    -def initialize(options = {})
    +def initialize(options)
    +  @type           = options[:type]
       @wp_content_dir = options[:wp_content_dir] || "wp-content"
    +  @wp_plugin_dir  = options[:wp_plugins_dir] || "plugins"
       @url            = options[:url]
       @path           = options[:path]
       @name           = options[:name] || extract_name_from_url
    -  @vulns_xml      = options[:vulns_xml]
    -  @vulns_xpath    = options[:vulns_xpath].sub(/\$name\$/, @name)
    +  @vulns_file     = options[:vulns_file]
    +  @vulns_xpath    = options[:vulns_xpath].sub(/\$name\$/, @name) unless options[:vulns_xpath] == nil
     
    -  raise("url not set") unless @url
    -  raise("path not set") unless @path
    +  raise("url not set")            unless @url
    +  raise("path not set")           unless @path
       raise("wp_content_dir not set") unless @wp_content_dir
    -  raise("name not set") unless @name
    -  raise("vulns_xml not set") unless @vulns_xml
    +  raise("name not set")           unless @name
    +  raise("vulns_file not set")     unless @vulns_file
    +  raise("type not set")           unless @type
     end
    @@ -411,7 +452,7 @@
    -# File lib/wpscan/wp_item.rb, line 97
    +# File lib/wpscan/wp_item.rb, line 121
     def <=>(other)
       other.name <=> self.name
     end
    @@ -444,7 +485,7 @@
    -# File lib/wpscan/wp_item.rb, line 87
    +# File lib/wpscan/wp_item.rb, line 111
     def ==(other)
       other.name == self.name
     end
    @@ -477,7 +518,7 @@
    -# File lib/wpscan/wp_item.rb, line 92
    +# File lib/wpscan/wp_item.rb, line 116
     def ===(other)
       other.name == self.name
     end
    @@ -510,7 +551,7 @@
    -# File lib/wpscan/wp_item.rb, line 107
    +# File lib/wpscan/wp_item.rb, line 131
     def changelog_url
       get_url_without_filename.merge("changelog.txt")
     end
    @@ -543,7 +584,7 @@
    -# File lib/wpscan/wp_item.rb, line 70
    +# File lib/wpscan/wp_item.rb, line 94
     def directory_listing?
       # Need to remove to file part from the url
       Browser.instance.get(get_url_without_filename).body[%{<title>Index of}] ? true : false
    @@ -577,7 +618,7 @@
                 
                 
    -# File lib/wpscan/wp_item.rb, line 76
    +# File lib/wpscan/wp_item.rb, line 100
     def extract_name_from_url
       get_url.to_s[%{^(https?://.*/([^/]+)/)}, 2]
     end
    @@ -591,6 +632,50 @@
    +
    + + + +
    + get_sub_folder() + click to toggle source +
    + + +
    + + + + + +
    +
    +# File lib/wpscan/wp_item.rb, line 43
    +def get_sub_folder
    +  case @type
    +    when "plugins"
    +      folder = @wp_plugin_dir
    +    when "themes"
    +      folder = "themes"
    +    when "timthumbs"
    +      # not needed
    +      folder = nil
    +    else
    +      raise("unknown type #@type")
    +  end
    +  folder
    +end
    +
    + +
    + + + + +
    + +
    @@ -610,14 +695,20 @@
    -# File lib/wpscan/wp_item.rb, line 41
    +# File lib/wpscan/wp_item.rb, line 59
     def get_url
       url = @url.to_s.end_with?("/") ? @url.to_s : "#@url/"
       # remove first and last /
       wp_content_dir = @wp_content_dir.sub(/^\//, "").sub(/\/$/, "")
       # remove first /
       path = @path.sub(/^\//, "")
    -  URI.parse("#{url}#{wp_content_dir}/#{path}")
    +  if type == "timthumbs"
    +    # timthumbs have folder in path variable
    +    ret = URI.parse("#{url}#{wp_content_dir}/#{path}")
    +  else
    +    ret = URI.parse("#{url}#{wp_content_dir}/#{get_sub_folder}/#{path}")
    +  end
    +  ret
     end
    @@ -648,7 +739,7 @@
    -# File lib/wpscan/wp_item.rb, line 51
    +# File lib/wpscan/wp_item.rb, line 75
     def get_url_without_filename
       location_url = get_url.to_s
       valid_location_url = location_url[%{^(https?://.*/)[^.]+\.[^/]+$}, 1]
    @@ -686,7 +777,7 @@
                 
                 
    -# File lib/wpscan/wp_item.rb, line 121
    +# File lib/wpscan/wp_item.rb, line 145
     def has_changelog?
       unless @changelog
         status = Browser.instance.get(changelog_url).code
    @@ -723,7 +814,7 @@
                 
                 
    -# File lib/wpscan/wp_item.rb, line 112
    +# File lib/wpscan/wp_item.rb, line 136
     def has_readme?
       unless @readme
         status = Browser.instance.get(readme_url).code
    @@ -760,7 +851,7 @@
                 
                 
    -# File lib/wpscan/wp_item.rb, line 102
    +# File lib/wpscan/wp_item.rb, line 126
     def readme_url
       get_url_without_filename.merge("readme.txt")
     end
    @@ -793,7 +884,7 @@
    -# File lib/wpscan/wp_item.rb, line 81
    +# File lib/wpscan/wp_item.rb, line 105
     def to_s
       item_version = version
       "#@name#{' v' + item_version.strip if item_version}"
    @@ -827,7 +918,7 @@
                 
                 
    -# File lib/wpscan/wp_item.rb, line 61
    +# File lib/wpscan/wp_item.rb, line 85
     def version
       unless @version
         response = Browser.instance.get(get_url.merge("readme.txt").to_s)
    diff --git a/doc/WpOptions.html b/doc/WpOptions.html
    index 21ef0ff6..871d1290 100644
    --- a/doc/WpOptions.html
    +++ b/doc/WpOptions.html
    @@ -83,6 +83,8 @@
             
               
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • diff --git a/doc/WpPlugin.html b/doc/WpPlugin.html index 49db6f0a..884a062a 100644 --- a/doc/WpPlugin.html +++ b/doc/WpPlugin.html @@ -87,6 +87,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • @@ -232,7 +234,8 @@
     # File lib/wpscan/wp_plugin.rb, line 20
     def initialize(options = {})
    -  options[:vulns_xml]     = options[:vulns_xml] || DATA_DIR + '/plugin_vulns.xml'
    +  options[:vulns_file]    = (options[:vulns_file] != nil and options[:vulns_file] != "") ?
    +      options[:vulns_file] : DATA_DIR + "/plugin_vulns.xml"
       options[:vulns_xpath]   = "//plugin[@name='$name$']/vulnerability"
       options[:vulns_xpath_2] = "//plugin"
       options[:type]          = "plugins"
    @@ -276,9 +279,9 @@ href="http://www.exploit-db.com/ghdb/3714/">www.exploit-db.com/ghdb/3714/

    -# File lib/wpscan/wp_plugin.rb, line 33
    +# File lib/wpscan/wp_plugin.rb, line 34
     def error_log?
    -  response_body = Browser.instance.get(error_log_url(), :headers => { "range" => "bytes=0-700"}).body
    +  response_body = Browser.instance.get(error_log_url(), :headers => {"range" => "bytes=0-700"}).body
       response_body[%{PHP Fatal error}] ? true : false
     end
    @@ -310,7 +313,7 @@ href="http://www.exploit-db.com/ghdb/3714/">www.exploit-db.com/ghdb/3714/

    -# File lib/wpscan/wp_plugin.rb, line 38
    +# File lib/wpscan/wp_plugin.rb, line 39
     def error_log_url
       get_url.merge("error_log").to_s
     end
    diff --git a/doc/WpPlugins.html b/doc/WpPlugins.html index ac0dc6d2..9e1ce0e8 100644 --- a/doc/WpPlugins.html +++ b/doc/WpPlugins.html @@ -77,6 +77,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • @@ -229,14 +231,16 @@ options[:vulns_xpath] = "//plugin[@name='#{@name}']/vulnerability" options[:vulns_xpath_2] = "//plugin" options[:type] = "plugins" - result = WpDetector.aggressive_detection(options) + result = WpDetector.aggressive_detection(options) plugins = [] result.each do |r| plugins << WpPlugin.new( - :url => r[:url], - :path => r[:path], - :wp_content_dir => r[:wp_content_dir], - :name => r[:name] + :url => r.url, + :path => r.path, + :wp_content_dir => r.wp_content_dir, + :name => r.name, + :type => "plugins", + :wp_plugins_dir => r.wp_plugin_dir ) end plugins.sort_by { |p| p.name } @@ -278,17 +282,19 @@ plugins can be found in the source code :

    -# File lib/wpscan/modules/wp_plugins.rb, line 49
    +# File lib/wpscan/modules/wp_plugins.rb, line 51
     def plugins_from_passive_detection(options)
       plugins = []
       temp = WpDetector.passive_detection(options[:url], "plugins", options[:wp_content_dir])
     
       temp.each do |item|
         plugins << WpPlugin.new(
    -        :url            => item[:url],
    -        :name           => item[:name],
    -        :path           => item[:path],
    -        :wp_content_dir => options[:wp_content_dir]
    +        :url            => item.url,
    +        :name           => item.name,
    +        :path           => item.path,
    +        :wp_content_dir => options[:wp_content_dir],
    +        :type           => "plugins",
    +        :wp_plugins_dir  => options[:wp_plugin_dir]
         )
       end
       plugins.sort_by { |p| p.name }
    diff --git a/doc/WpReadme.html b/doc/WpReadme.html
    index 84ae682e..2ccec6db 100644
    --- a/doc/WpReadme.html
    +++ b/doc/WpReadme.html
    @@ -77,6 +77,8 @@
             
               
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • diff --git a/doc/WpTarget.html b/doc/WpTarget.html index 8c08910c..ef4994fa 100644 --- a/doc/WpTarget.html +++ b/doc/WpTarget.html @@ -159,6 +159,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • @@ -493,7 +495,7 @@ # File lib/wpscan/wp_target.rb, line 112 def has_debug_log? # We only get the first 700 bytes of the file to avoid loading huge file (like 2Go) - response_body = Browser.instance.get(debug_log_url(), :headers => { "range" => "bytes=0-700"}).body + response_body = Browser.instance.get(debug_log_url(), :headers => {"range" => "bytes=0-700"}).body response_body[%{\[[^\]]+\] PHP (?:Warning|Error|Notice):}] ? true : false end
    @@ -778,7 +780,7 @@ # File lib/wpscan/wp_target.rb, line 105 def wp_plugins_dir unless @wp_plugins_dir - @wp_plugins_dir = wp_content_dir() + "/plugins" + @wp_plugins_dir = "plugins" end @wp_plugins_dir end
    diff --git a/doc/WpTheme.html b/doc/WpTheme.html index 5171a3b6..c74123fa 100644 --- a/doc/WpTheme.html +++ b/doc/WpTheme.html @@ -91,6 +91,8 @@
  • CREDITS
  • +
  • Gemfile
  • +
  • README
  • @@ -286,7 +288,7 @@
    -# File lib/wpscan/wp_theme.rb, line 42
    +# File lib/wpscan/wp_theme.rb, line 44
     def self.find(target_uri)
       self.methods.grep(/find_from_/).each do |method_to_call|
         theme = self.send(method_to_call, target_uri)
    @@ -326,8 +328,10 @@
     
     # File lib/wpscan/wp_theme.rb, line 25
     def initialize(options = {})
    -  options[:vulns_xml]   = options[:vulns_xml] || DATA_DIR + '/wp_theme_vulns.xml'
    +  options[:vulns_file]    = (options[:vulns_file] != nil and options[:vulns_file] != "") ?
    +      options[:vulns_file] : DATA_DIR + "/wp_theme_vulns.xml"
       options[:vulns_xpath] = "//theme[@name='$name$']/vulnerability"
    +  options[:type]        = "themes"
       @version              = options[:version]
       @style_url            = options[:style_url]
       super(options)
    @@ -367,11 +371,12 @@