From 71b630131ce4df29d42dd99506fe526a95fd25c3 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 22 May 2017 13:49:51 +1000 Subject: [PATCH] Added BASIC URL parser for domain lookup, currently seperates the domain name from the TLD. Also updated TODO list --- HTTPy.py | 21 +++++++++++++-------- TODO | 4 +++- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/HTTPy.py b/HTTPy.py index bc57a6c..fdbbaa2 100755 --- a/HTTPy.py +++ b/HTTPy.py @@ -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()) + + diff --git a/TODO b/TODO index e477658..cb77b88 100644 --- a/TODO +++ b/TODO @@ -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