Created
October 15, 2015 13:26
-
-
Save 0x00dec0de/af29d29cb8b1c288d935 to your computer and use it in GitHub Desktop.
email grabber
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!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