Last Updated: February 25, 2016
·
1.911K
· blazeeboy

Download a list of email gravatar images

this is a small practice of downloading a list of anonymous emails gravatar images, this could give you a good indicator of what email is active.
the script is for fun use only, i got the list of emails from pastebin
and you can use any emails list.

Gist : https://github.com/blazeeboy/RubyScripts/tree/master/2014-06-24

#!/usr/bin/env ruby
# Author : Emad Elsaid (https://github.com/blazeeboy)
require 'open-uri'
require 'digest'

EMAIL_LIST = 'http://pastebin.com/raw.php?i=KdDrmNsX'
SAVE_TO = '/home/eelsaid/Desktop/gravatar/'

# read emails from source
emails = open(EMAIL_LIST).read.lines

# iterate over all emails, get the gravatar image
# and save it locally with the email as file name
# but i convert the @ character to a dot .
emails.each do | email |
  gravatar_id = Digest::MD5::hexdigest(email.strip.downcase)
  gravatar_url = "http://secure.gravatar.com/avatar/#{gravatar_id}"
  image_data = open(gravatar_url).read
  file_name = email.strip.downcase.gsub '@', '.'
  File.write "#{SAVE_TO}#{file_name}", image_data
end