Skip to content

Instantly share code, notes, and snippets.

@matiasinsaurralde
Last active December 17, 2015 23:58
Show Gist options
  • Save matiasinsaurralde/5692820 to your computer and use it in GitHub Desktop.
Save matiasinsaurralde/5692820 to your computer and use it in GitHub Desktop.
nicpy
#!/usr/bin/env ruby
# encoding: utf-8
require 'net/http'
def find_email(body)
body.scan(Regexp.new(/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\b/)).uniq.first
end
input = ARGV[0].gsub('.py', '').split('.')
http = Net::HTTP.start('www.nic.py')
req = Net::HTTP::Post.new( '/cgi-nic/consultas/domdetzzz' )
req.set_form_data( {'dom' => input.first, 'tip' => input.last } )
req['Referer'] = 'http://www.nic.py/cgi-nic/consultas/domlistzzz'
response = http.request(req)
p find_email( response.body )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment