Class: Ryo::Plugin::Subdomain::DNSDumpster

Inherits:
Base
  • Object
show all
Defined in:
lib/ryo/plugin/subdomain/dnsdumpster.rb

Instance Attribute Summary

Attributes inherited from Base

#fld

Instance Method Summary collapse

Methods inherited from Base

#discover, discover, #doc, #initialize

Constructor Details

This class inherits a constructor from Ryo::Plugin::Subdomain::Base

Instance Method Details

#endpointObject



7
8
9
# File 'lib/ryo/plugin/subdomain/dnsdumpster.rb', line 7

def endpoint
  "https://dnsdumpster.com"
end

#fetch_bodyObject



11
12
13
14
15
16
17
18
# File 'lib/ryo/plugin/subdomain/dnsdumpster.rb', line 11

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

#parseObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/ryo/plugin/subdomain/dnsdumpster.rb', line 20

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