Added BASIC URL parser for domain lookup, currently seperates the domain name from the TLD. Also updated TODO list
This commit is contained in:
parent
bba88bf90a
commit
71b630131c
21
HTTPy.py
21
HTTPy.py
@ -2,7 +2,7 @@
|
|||||||
from HTMLParser import HTMLParser
|
from HTMLParser import HTMLParser
|
||||||
import httplib
|
import httplib
|
||||||
|
|
||||||
starttag = ""
|
currtag = ""
|
||||||
conf_temp = "pre"
|
conf_temp = "pre"
|
||||||
#URL https://www.whois.com/whois/benjamyn-testing.com
|
#URL https://www.whois.com/whois/benjamyn-testing.com
|
||||||
#class df-block-raw
|
#class df-block-raw
|
||||||
@ -10,31 +10,36 @@ conf_temp = "pre"
|
|||||||
class MyHTMLParser(HTMLParser):
|
class MyHTMLParser(HTMLParser):
|
||||||
def handle_starttag(self, tag, attrs):
|
def handle_starttag(self, tag, attrs):
|
||||||
global conf_temp
|
global conf_temp
|
||||||
global starttag
|
global currtag
|
||||||
if tag == conf_temp:
|
if tag == conf_temp:
|
||||||
# starttag = tag
|
# starttag = tag
|
||||||
for name, value in attrs:
|
for name, value in attrs:
|
||||||
if name == "class" and value == "df-raw":
|
if name == "class" and value == "df-raw":
|
||||||
print tag
|
print tag
|
||||||
starttag = tag
|
currtag = tag
|
||||||
# pass
|
# pass
|
||||||
#print starttag
|
#print starttag
|
||||||
|
|
||||||
def handle_endtag(self, tag):
|
def handle_endtag(self, tag):
|
||||||
global starttag
|
global currtag
|
||||||
if tag == "pre":
|
if tag == "pre":
|
||||||
starttag = ""
|
currtag = ""
|
||||||
|
|
||||||
def handle_data(self, data):
|
def handle_data(self, data):
|
||||||
#print starttag
|
#print starttag
|
||||||
if starttag == conf_temp:
|
if currtag == conf_temp:
|
||||||
print data
|
print data
|
||||||
|
|
||||||
|
domain = raw_input("Enter a domain: ")
|
||||||
|
print domain
|
||||||
|
partDomain = domain.partition(".")
|
||||||
|
print partDomain
|
||||||
|
|
||||||
conn = httplib.HTTPSConnection("www.whois.com")
|
conn = httplib.HTTPSConnection("www.whois.com")
|
||||||
conn.request("GET", "/whois/ventraip.com.au")
|
conn.request("GET", "/whois/" + domain)
|
||||||
r1 = conn.getresponse()
|
r1 = conn.getresponse()
|
||||||
parser = MyHTMLParser()
|
parser = MyHTMLParser()
|
||||||
|
|
||||||
parser.feed(r1.read())
|
parser.feed(r1.read())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
4
TODO
4
TODO
@ -1,6 +1,8 @@
|
|||||||
#TODO: Trim unwanted data, it is setup as a string now :D
|
#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
|
#TODO: Add extra nice features
|
||||||
#Full DNS record lookup
|
#Full DNS record lookup
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user