class Subdomain_enum

Attributes

max_thread[RW]
target[RW]
timeout[RW]
wordlist[RW]

Public Class Methods

new() click to toggle source
# File lib/opnsrcint/subdomain_enum.rb, line 23
def initialize
  @timeout = TIME_OUT
  @max_thread = MAX_THREAD
  @wordlist = WORDLIST
end

Public Instance Methods

brut() click to toggle source
# File lib/opnsrcint/subdomain_enum.rb, line 72
def brut

  File.open(@wordlist).readlines.map do |line|

    Thread::new do

      print_domain(
        [line.chomp, @target.strip].join(".")
      )

    end

    sleep 0.03

    while Thread::list.length > @max_thread;end

  end

  while Thread::list.length > 1;end

end
get_domain(domain) click to toggle source
# File lib/opnsrcint/subdomain_enum.rb, line 41
def get_domain(domain)
  NAME_SERVERS.keys.shuffle.map do |dns|

    begin

      Timeout::timeout(@timeout) do
        addrs = Resolv::new(
          loader(NAME_SERVERS[dns])
        ).getaddresses(domain)


        if addrs.length > 0
          return addrs
        end

      end
    
    rescue Timeout::Error => e
    end

  end
  return []
end
loader(list) click to toggle source
# File lib/opnsrcint/subdomain_enum.rb, line 29
def loader(list)
  return Resolv::DefaultResolver.replace_resolvers([
    Resolv::Hosts.new,
    Resolv::DNS.new(
      nameserver: list,
      ndots: 1
    )
  ])
end
print_domain(domain) click to toggle source