Skip to content

Commit

Permalink
Remove nokogiri and use regex to parse crtsh responses
Browse files Browse the repository at this point in the history
  • Loading branch information
jolle committed Jun 24, 2017
1 parent 6c78a70 commit 0bd42c4
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 10 deletions.
1 change: 0 additions & 1 deletion aquatone.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]

spec.add_dependency "httparty", "~> 0.14.0"
spec.add_dependency "nokogiri", "~> 1.8.0"
spec.add_dependency "childprocess", "~> 0.7.0"

spec.add_development_dependency "bundler", "~> 1.13"
Expand Down
1 change: 0 additions & 1 deletion lib/aquatone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

require "httparty"
require "childprocess"
require "nokogiri"

require "aquatone/version"
require "aquatone/port_lists"
Expand Down
4 changes: 0 additions & 4 deletions lib/aquatone/collector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ def post_request(uri, body=nil, options={})
Aquatone::HttpClient.post(uri, options)
end

def parse_html(html)
Nokogiri::HTML(html)
end

def url_escape(string)
CGI.escape(string)
end
Expand Down
6 changes: 2 additions & 4 deletions lib/aquatone/collectors/crtsh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ class Crtsh < Aquatone::Collector
def run
response = get_request("https://crt.sh/?dNSName=%25.#{url_escape(domain.name)}")

parsed = parse_html(response.body)

parsed.css('table').css('table').css('tr').css('td:nth-child(4)').map do |column|
add_host(column.text.gsub("*.", ""))
response.body.to_enum(:scan, /<TD>([a-zA-Z0-9_.-]+\.#{domain.name})<\/TD>/).map do |column|
add_host(column[0])
end
end
end
Expand Down

0 comments on commit 0bd42c4

Please sign in to comment.