Skip to content

Instantly share code, notes, and snippets.

@0x00dec0de
Created October 15, 2015 13:26
Show Gist options
  • Save 0x00dec0de/af29d29cb8b1c288d935 to your computer and use it in GitHub Desktop.
Save 0x00dec0de/af29d29cb8b1c288d935 to your computer and use it in GitHub Desktop.
email grabber
#!ruby
require 'net/http'
require 'uri'
def scrapEmails( urlString )
url = URI.parse( urlString )
req = Net::HTTP::Get.new(url.path)
res = Net::HTTP.start(url.host, url.port) { |http| http.request(req) }
emails = res.body.scan( /[A-Za-z0-9]+[@ | (at) | (AT) ][A-Za-z0-9]+\.[A-Za-z]+/i )
return emails
end
email_addresses = scrapEmails( ARGV[ 0 ] )
email_addresses.length.times { |i| puts (i + 1).to_s + " " + email_addresses[ i ] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment