Sha256: 1075e4419e9c6d6ada55e547fdc2b1f170b445e88ab8b95372803c4059cdd2d5

Contents?: true

Size: 936 Bytes

Versions: 4

Compression:

Stored size: 936 Bytes

Contents

# frozen_string_literal: true

module Ryo
  module Plugin
    module Subdomain
      class DNSDumpster < Base
        def endpoint
          "https://dnsdumpster.com"
        end

        def fetch_body
          res = Client.http.get(endpoint)
          csrftoken = res.cookies.find { |c| c.name == "csrftoken" }.value
          params = { csrfmiddlewaretoken: csrftoken, targetip: fld }

          res = Client.http.cookies(csrftoken: csrftoken).headers(referer: endpoint).post(endpoint, form: params)
          res.body.to_s
        end

        def parse
          tables = doc.css("table.table")
          return [] if tables.empty?
          table = tables.last
          table.css("tr").map do |row|
            cols = row.css("td")
            domain = cols.first.text.lines.first.chomp
            ip = cols[1].text.lines.first.chomp
            { domain: domain, ip: ip }
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ryo-0.3.1 lib/ryo/plugin/subdomain/dnsdumpster.rb
ryo-0.3.0 lib/ryo/plugin/subdomain/dnsdumpster.rb
ryo-0.2.0 lib/ryo/plugin/subdomain/dnsdumpster.rb
ryo-0.1.0 lib/ryo/plugin/subdomain/dnsdumpster.rb