Skip to content

Instantly share code, notes, and snippets.

@nuit
Created October 20, 2013 04:36
Show Gist options
  • Save nuit/7065114 to your computer and use it in GitHub Desktop.
Save nuit/7065114 to your computer and use it in GitHub Desktop.
whois.py
from bs4 import BeautifulSoup
import requests
import re
import socket
url=raw_input(">> ")
site = 'http://www.iana.org/whois?q='+url
r = requests.get(site)
soup = BeautifulSoup(r.text)
for s in soup.findAll('pre'):
regex = re.compile(r'<[^<]*?>')
whois = regex.sub('', str(s))
print whois
@stefanpejcic
Copy link

stefanpejcic commented Dec 29, 2019

#python3

from bs4 import BeautifulSoup
import requests
import re
import socket

url=input(">> ")
site = 'http://www.iana.org/whois?q='+url
r = requests.get(site)
soup = BeautifulSoup(r.text, "html.parser")

for s in soup.findAll('pre'):
regex = re.compile(r'<[^<]*?>')
whois = regex.sub('', str(s))
print (whois)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment