Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- """
- Whois.py via vicheck.ca
- Need to have pycurl installed
- tdr(dot)local(at)gmail(dot)com
- """
- import re
- import sys
- import pycurl
- import cStringIO
- import urllib
- if len(sys.argv)<=1:
- print 'Usage: whois.py <IP address | Domain name>'
- sys.exit()
- input = sys.argv[1]
- response = cStringIO.StringIO()
- c = pycurl.Curl()
- c.setopt(c.POST, 1)
- c.setopt(c.URL, "https://www.vicheck.ca/whois.php")
- post_params = [('ip', input)]
- resp_data = urllib.urlencode(post_params)
- c.setopt(c.POSTFIELDS, resp_data)
- #c.setopt(c.HTTPPOST, data)
- c.setopt(c.SSL_VERIFYPEER, 0)
- c.setopt(c.SSL_VERIFYHOST, 0)
- c.setopt(c.WRITEFUNCTION, response.write)
- #c.setopt(c.VERBOSE, 1)
- c.perform()
- c.close()
- results = response.getvalue()
- #result = re.findall(r'<.+?>', results)
- result = re.sub(r'<.+?>', '', results, flags=re.DOTALL)
- print '\n\n'+result[345:-450]
Add Comment
Please, Sign In to add comment