Sha256: 79d03bf2c639ae8b3cf1c6823bb4854fd4250ac8107db0f1d6d7f3972ac60f9c

Contents?: true

Size: 931 Bytes

Versions: 1

Compression:

Stored size: 931 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].inner_text.chomp
            { domain: domain, ip: ip }
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ryo-0.3.2 lib/ryo/plugin/subdomain/dnsdumpster.rb