Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Iteratively brutes dns hostnames

View brutedns.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
#!/usr/bin/env ruby
 
#
## Brute code stolen form: https://gist.github.com/petehamilton/4755855
#
 
@domain = 'contoso.com'
 
def result?(sub)
results = %x(dig +noall #{sub}.#{@domain} +answer)
if results != ""
puts "============================"
puts "FOUND: \t#{sub}"
puts "============================"
puts "#{results}"
puts "============================"
end
1 == 2
end
 
def crack_yielding(chars)
crack_yield(chars){ |p|
return p if result?(p)
}
end
 
 
def crack_yield(chars)
chars.each { |c| yield c }
 
crack_yield(chars) { |c|
chars.each do |x|
yield c + x
end
}
end
 
chars = ('a'..'z').to_a
(0..9).each {|x| chars << x.to_s}
 
crack_yielding(chars)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.