Sha256: f3df83a06013678c19c2a18dae13577d58e5921484616d5c9c0b690cf00d7688

Contents?: true

Size: 630 Bytes

Versions: 4

Compression:

Stored size: 630 Bytes

Contents

# frozen_string_literal: true

require "json"

module Miteru
  class Feeds
    class UrlScan < Feed
      ENDPOINT = "https://urlscan.io/api/v1"

      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 = "#{ENDPOINT}/search/?q=certstream-suspicious&size=#{size}"
        res = JSON.parse(get(url))
        res["results"].map { |result| result.dig("task", "url") }
      rescue HTTPResponseError => e
        puts "Failed to load urlscan.io feed (#{e})"
        []
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
miteru-0.9.6 lib/miteru/feeds/urlscan.rb
miteru-0.9.5 lib/miteru/feeds/urlscan.rb
miteru-0.9.4 lib/miteru/feeds/urlscan.rb
miteru-0.9.3 lib/miteru/feeds/urlscan.rb