Skip to content

Instantly share code, notes, and snippets.

@ninoseki
Created September 13, 2020 03:54
Show Gist options
  • Save ninoseki/e05ce53f7144f9fb89104efe8d4064f5 to your computer and use it in GitHub Desktop.
Save ninoseki/e05ce53f7144f9fb89104efe8d4064f5 to your computer and use it in GitHub Desktop.
require "json"
require 'certificate-transparency-client'
require "parallel"
ct = CT::Client.new "https://ct.example.org"
list = JSON.parse(File.read("all_logs_list.json"))
logs = list.dig("logs") || []
urls = logs.map { |log| "https://" + log.dig("url") }.map { |url| url[0..-2] }
Parallel.each(urls) do |url|
ct = CT::Client.new(url)
entries = ct.get_entries(0, 1023)
p [url, entries.length]
rescue SocketError, EOFError, Net::OpenTimeout, OpenSSL::SSL::SSLError, Errno::ECONNREFUSED, CertificateTransparency::Client::HTTPError
next
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment