class DoorKnock::Feed

Constants

URLSCAN_ENDPOINT
URLSCAN_QUERY

Public Class Methods

phishy_urls(size = 100) click to toggle source
# File lib/doorknock/feed.rb, line 29
def self.phishy_urls(size = 100)
  new.phishy_urls(size)
end

Public Instance Methods

phishy_urls(size = 100) click to toggle source
# File lib/doorknock/feed.rb, line 12
def phishy_urls(size = 100)
  res = HTTP.get(
    URLSCAN_ENDPOINT,
    params: {
      q: URLSCAN_QUERY,
      size: size
    }
  )
  return [] if res.code != 200

  json = JSON.parse(res.body.to_s)
  results = json["results"]
  results.map { |result| result.dig("page", "url") }.compact.uniq.map do |url|
    url.end_with?("/") ? url[0..-2] : url
  end
end