Added BASIC URL parser for domain lookup, currently seperates the domain name from the TLD. Also updated TODO list

This commit is contained in:
Benjamyn Love 2017-05-22 13:49:51 +10:00
parent bba88bf90a
commit 71b630131c
2 changed files with 16 additions and 9 deletions

View File

@ -2,7 +2,7 @@
from HTMLParser import HTMLParser
import httplib
starttag = ""
currtag = ""
conf_temp = "pre"
#URL https://www.whois.com/whois/benjamyn-testing.com
#class df-block-raw
@ -10,31 +10,36 @@ conf_temp = "pre"
class MyHTMLParser(HTMLParser):
def handle_starttag(self, tag, attrs):
global conf_temp
global starttag
global currtag
if tag == conf_temp:
# starttag = tag
for name, value in attrs:
if name == "class" and value == "df-raw":
print tag
starttag = tag
currtag = tag
# pass
#print starttag
def handle_endtag(self, tag):
global starttag
global currtag
if tag == "pre":
starttag = ""
currtag = ""
def handle_data(self, data):
#print starttag
if starttag == conf_temp:
if currtag == conf_temp:
print data
domain = raw_input("Enter a domain: ")
print domain
partDomain = domain.partition(".")
print partDomain
conn = httplib.HTTPSConnection("www.whois.com")
conn.request("GET", "/whois/ventraip.com.au")
conn.request("GET", "/whois/" + domain)
r1 = conn.getresponse()
parser = MyHTMLParser()
parser.feed(r1.read())

4
TODO
View File

@ -1,6 +1,8 @@
#TODO: Trim unwanted data, it is setup as a string now :D
#TODO: Add input to ask domain
#TODO: Add input to ask domain - Kinda implemented, needs work and validation
#TODO implement TLD/gTLD lists to check against.
#TODO: Add extra nice features
#Full DNS record lookup