Skip to content

Instantly share code, notes, and snippets.

@RISCfuture
Created July 29, 2023 04:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RISCfuture/27c61ba92459ae74262df8e993c41455 to your computer and use it in GitHub Desktop.
Save RISCfuture/27c61ba92459ae74262df8e993c41455 to your computer and use it in GitHub Desktop.
Find sites in 1Password that support Universal Two-Factor
require 'json'
require 'uri'
require 'net/http'
require 'active_support/core_ext/enumerable'
directory_uri = URI.parse('https://api.2fa.directory/v3/all.json')
directory_sites = JSON.parse(Net::HTTP.get(directory_uri))
.map(&:last).index_by { |s| s['domain'] }
op_sites = JSON.parse(`op item list --categories login --format=json`)
op_sites.each do |op_site|
urls = op_site['urls']&.map { |u| URI.parse(u['href']) } or next
urls.each do |url|
next unless (directory_site = directory_sites[url.hostname])
next unless directory_site['tfa']&.include?('u2f')
puts "#{op_site['title']} (#{url.hostname}) - U2F supported"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment