PwnedCheck
Ruby gem to check to see if an email address is on http://haveibeenpwned.com
Version | 1.0.17 |
---|---|
Author | Carl Sampson (@chs) |
Page | http://www.chs.us/PwnedCheck |
Github | http://github.com/sampsonc/PwnedCheck |
Installation
gem install PwnedCheck
Usage
require 'pwnedcheck'
# The 4 cases.
# [email protected] is a valid address on the site
# [email protected] is a valid address, but not on the site
# foo.bar.com is an invalid format
# mralexgray is a user id in snapchat
list = ['[email protected]', '[email protected]', 'foo.bar.com', 'mralexgray']
list.each do |item|
begin
sites = PwnedCheck::check(item)
if sites.length == 0
puts "#{item} --> Not found on http://haveibeenpwned.com"
else
sites.each do |site|
puts "#{item} --> #{site}"
end
end
rescue PwnedCheck::InvalidEmail => e
puts "#{item} --> #{e.message}"
end
end
````