Sha256: 7b6527d459ec1aa5659268dfa304b8ef9ca27731204aea725dd38b757d4c3f36
Contents?: true
Size: 880 Bytes
Versions: 2
Compression:
Stored size: 880 Bytes
Contents
# frozen_string_literal: true require "json" require "uri" module Miteru class Feeds class UrlScan < Feed HOST = "urlscan.io" VERSION = 1 URL = "https://#{HOST}/api/v#{VERSION}" attr_reader :size def initialize(size = 100) @size = size raise ArgumentError, "size must be less than 10,000" if size > 10_000 end def urls url = url_for("/search/") url.query = URI.encode_www_form( q: "PhishTank OR OpenPhish OR CertStream-Suspicious", size: size ) res = JSON.parse(get(url)) res["results"].map { |result| result.dig("task", "url") } rescue HTTPResponseError, JSON::ParserError => e puts "Failed to load urlscan.io feed (#{e})" [] end private def url_for(path) URI(URL + path) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
miteru-0.12.10 | lib/miteru/feeds/urlscan.rb |
miteru-0.12.9 | lib/miteru/feeds/urlscan.rb |