Advertisement
iAnonGuy

SubHai? [a Wordlist Based Subdomain Finder]

May 29th, 2016
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.48 KB | None | 0 0
  1. require 'socket'
  2.  
  3. puts "\n---------------------------------------------------------------------------------
  4.   _____       _     _    _       _   ___  
  5.  / ____|     | |   | |  | |     (_) |__ \\
  6. | (___  _   _| |__ | |__| | __ _ _     ) |
  7.  \\___ \\| | | | '_ \\|  __  |/ _` | |   / /
  8.  ____) | |_| | |_) | |  | | (_| | |  |_|  
  9. |_____/ \\__,_|_.__/|_|  |_|\\__,_|_|  (_) ~ AnonGuy [ an0nguy @ protonmail.ch ]"
  10.  
  11. print "\nPlease Enter The Domain Name -- "
  12. domain = gets.chomp.chomp('/').sub(/^https?\:\/\/(www.)?/, '')
  13. print 'Wordlist                     -- '
  14. dictionary = gets.chomp # Your wordlist, or dictionary, if you may ..
  15. testDomain = 'l0lwal33t.'+domain
  16. count = 0
  17.  
  18. def exists(subdomain)
  19.     begin
  20.         Socket.gethostbyname(subdomain)
  21.     rescue SocketError
  22.         return false
  23.     end
  24.         return true
  25. end
  26.  
  27. puts '---------------------------------------------------------------------------------'
  28.  
  29. if exists(testDomain) == true
  30.     abort("Wildcard Subdomain (*) exists! :(\nEnding Script Execution . . .\n---------------------------------------------------------------------------------")
  31. end
  32.  
  33. File.new(dictionary).each_line do |word|
  34.     subdomain = "#{word.chomp}.#{domain}"
  35.     if exists(subdomain) == true
  36.         count += 1
  37.         puts "#{count.to_s} -- #{subdomain} exists!"
  38.     end
  39. end
  40.  
  41. puts "---------------------------------------------------------------------------------\nTotal Subdomains Found --\> #{count.to_s}\n---------------------------------------------------------------------------------"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement