Class: Snackhack2::Subdomains2
- Inherits:
-
Object
- Object
- Snackhack2::Subdomains2
- Defined in:
- lib/snackhack2/subdomains2.rb
Instance Method Summary collapse
- #fetch(url) ⇒ Object
-
#initialize(site) ⇒ Subdomains2
constructor
A new instance of Subdomains2.
- #run ⇒ Object
- #save ⇒ Object
- #wordlist ⇒ Object
Constructor Details
#initialize(site) ⇒ Subdomains2
Returns a new instance of Subdomains2.
4 5 6 7 |
# File 'lib/snackhack2/subdomains2.rb', line 4 def initialize(site) @site = site @urls = [] end |
Instance Method Details
#fetch(url) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/snackhack2/subdomains2.rb', line 26 def fetch(url) begin Sync do |task| task.with_timeout(2) do internet = Async::HTTP::Internet.new m = internet.get(url, { "user-agent" => Snackhack2::UA }) if m.status == 200 or m.status == 301 @urls << url end m.read end end rescue => e puts e end end |
#run ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/snackhack2/subdomains2.rb', line 17 def run File.readlines(wordlist).each do |a| url = "https://" + a.strip + "." + @site.gsub("https://", "") fetch(url) puts url end save end |
#save ⇒ Object
13 14 15 |
# File 'lib/snackhack2/subdomains2.rb', line 13 def save Snackhack2::file_save(@site, "subdomain_brute2", @urls.join("\n")) end |
#wordlist ⇒ Object
9 10 11 |
# File 'lib/snackhack2/subdomains2.rb', line 9 def wordlist File.join(__dir__, 'lists', 'subdomains.txt') end |