Sha256: 57ee2435e29eb69470d3ce402bfec91aa196728ae198f93b0841a6e55c67667c

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 KB

Contents

module WPScan
  module Finders
    module Users
      # WP JSON API
      #
      # Since 4.7 - Need more investigation as it seems WP 4.7.1 reduces the exposure, see https://github.com/wpscanteam/wpscan/issues/1038)
      #
      class WpJsonApi < CMSScanner::Finders::Finder
        # @param [ Hash ] opts
        #
        # @return [ Array<User> ]
        def aggressive(_opts = {})
          found = []

          JSON.parse(Browser.get(api_url).body).each do |user|
            found << WPScan::User.new(user['slug'],
                                      id: user['id'],
                                      found_by: found_by,
                                      confidence: 100,
                                      interesting_entries: [api_url])
          end

          found
        rescue JSON::ParserError
          found
        end

        # @return [ String ] The URL of the API listing the Users
        def api_url
          @api_url ||= target.url('wp-json/wp/v2/users/')
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
wpscan-3.0.8 app/finders/users/wp_json_api.rb
wpscan-3.0.7 app/finders/users/wp_json_api.rb
wpscan-3.0.6 app/finders/users/wp_json_api.rb
wpscan-3.0.5 app/finders/users/wp_json_api.rb
wpscan-3.0.4 app/finders/users/wp_json_api.rb
wpscan-3.0.3 app/finders/users/wp_json_api.rb
wpscan-3.0.2 app/finders/users/wp_json_api.rb