class URLhausMonitor::Checker
Constants
- BASE_URL
- LIMIT
Public Instance Methods
lookup_by_asn(asn)
click to toggle source
# File lib/urlhaus_monitor/checker.rb, line 18 def lookup_by_asn(asn) lookup "#{BASE_URL}/feeds/asn/#{asn}" end
lookup_by_country(country)
click to toggle source
# File lib/urlhaus_monitor/checker.rb, line 10 def lookup_by_country(country) lookup "#{BASE_URL}/feeds/country/#{country}" end
lookup_by_tld(tld)
click to toggle source
# File lib/urlhaus_monitor/checker.rb, line 14 def lookup_by_tld(tld) lookup "#{BASE_URL}/feeds/tld/#{tld}" end
Private Instance Methods
convert(lines)
click to toggle source
# File lib/urlhaus_monitor/checker.rb, line 31 def convert(lines) [].tap do |entries| lines.each do |line| next if line.start_with? "#" entries << Entry.new(line) end end end
lookup(url)
click to toggle source
# File lib/urlhaus_monitor/checker.rb, line 24 def lookup(url) res = HTTP.get(url) return nil unless res.code == 200 convert res.body.to_s.lines[0..LIMIT] end