Compare commits

...

12 Commits

Author SHA1 Message Date
e62b756155 Adjusted template (dns.html) for DNS and whois
Adjusted main.py to return values instead of print them
2018-05-13 23:43:59 +10:00
b704eea43f FUCK U CSS 2018-05-07 23:02:00 +10:00
9c8665b716 Made code easier to read with indents 2018-05-07 21:46:28 +10:00
18eb6cdca4 Added better colors and shit 2018-05-07 21:36:17 +10:00
9d5a9eb391 Made resources static and added rounded corners 2018-05-07 09:44:59 +10:00
0a33f67577 . 2018-05-02 17:18:49 +10:00
048c46f2bc Added POST support for the / route and basic DNS lookups 2018-05-02 09:41:09 +10:00
3c173e851b PROGRESS git add --allgit add --allgit add --all git add --all11! :D 2018-05-01 21:49:42 +10:00
0c9bfd8d3e added more pretty 2018-05-01 15:59:45 +10:00
9a91620cf0 Added basic shit 2018-05-01 11:41:14 +10:00
3b2b0bcff4 Added easier install 2018-05-01 11:04:27 +10:00
7f2468e1a9 added venv 2018-05-01 10:28:28 +10:00
16 changed files with 178 additions and 12 deletions

25
gui.py Normal file
View File

@ -0,0 +1,25 @@
from flask import Flask, render_template, request
import main as dnspy
app = Flask(__name__)
app.config['DEBUG'] = True
@app.route('/', methods=['POST', 'GET'])
def index():
if request.method == 'POST':
data = request.form['domain']
print(data)
dnsinfo, whois = dnspy.lookupDomain(str(data))
#dnsinfo = {"." : "."}
return render_template('dns.html', whois=whois, dnsinfo=dnsinfo)
else:
whois = {"Status" : "Please enter a domain"}
dnsinfo = {"Stub" : "Data"}
return render_template('dns.html', whois=whois, dnsinfo=dnsinfo)
@app.route('/domain/', methods=['POST', 'GET'])
def getDomain():
data = request.form['domain']
return data
if __name__ == '__main__':
app.run(host='0.0.0.0')

7
install.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
git clone http://git.vps.benjamyn-testing.com/benjamyn/whois
pip install -r requirements.txt
cd whois
python2 setup.py install

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

34
main.py
View File

@ -1,4 +1,5 @@
#!/usr/bin/python2.7
#GUI REWRITE
import whois
import signal
import dns.resolver
@ -26,6 +27,8 @@ colour_default = gc.getColour(jsonData["colour_default"])
CSVFile = jsonData["country_codes"]
# Endconfig block
dnsrecs = {}
if platform.system().lower() == "linux":
import readline
else:
@ -79,6 +82,7 @@ def parseInput(inData):
lookupDomain(tmpInData)
def recLookup(inData):
global dnsrecs
for dnsrec in dnsrecords:
try:
data = dns.resolver.query(inData, dnsrec)
@ -86,41 +90,51 @@ def recLookup(inData):
rdataTMP = rdata.to_text().split(" ")
if dnsrec != "MX":
if dnsrec != "NS":
print( indent + colour_pretty + "%s:\t%s%s" % (dnsrec, colour_good, rdata) + colour_default)
#print( indent + colour_pretty + "%s:\t%s%s" % (dnsrec, colour_good, rdata) + colour_default)
dnsrecs[dnsrec] = rdata
else:
tmpData = cnameToA(rdata.to_text())
print( indent + colour_pretty + "%s:\t%s%s -> %s" % (dnsrec, colour_good, rdata, tmpData) + colour_default)
#print( indent + colour_pretty + "%s:\t%s%s -> %s" % (dnsrec, colour_good, rdata, tmpData) + colour_default)
dnsrecs[dnsrec] = rdata
else:
tmpData = cnameToA(rdataTMP[1])
print( indent + colour_pretty + "%s:\t%s%s -> %s" % (dnsrec, colour_good, rdata, tmpData) + colour_default)
#print( indent + colour_pretty + "%s:\t%s%s -> %s" % (dnsrec, colour_good, rdata, tmpData) + colour_default)
dnsrecs[dnsrec] = rdata
except Exception as e:
pass
def subLookup(inData, sub):
global dnsrecs
try:
data = dns.resolver.query(sub + '.' + inData)
for rdata in data:
if data.qname == data.canonical_name:
print(indent + colour_pretty + "%s:\t%s%s" % (sub, colour_good, rdata) + colour_default)
#Old function printed the result now I am returning the result, may add to a dict.
#print(indent + colour_pretty + "%s:\t%s%s" % (sub, colour_good, rdata) + colour_default)
dnsrecs[sub] = rdata
else:
for rdata in dns.resolver.query(sub + '.' + inData, "CNAME"):
print(indent + colour_pretty + "%s:\t%s%s -> %s" % (sub, colour_good, rdata, cnameToA(sub + "." + inData).to_text()) + colour_default)
#print(indent + colour_pretty + "%s:\t%s%s -> %s" % (sub, colour_good, rdata, cnameToA(sub + "." + inData).to_text()) + colour_default)
dnsrecs[sub] = rdata
except Exception as e:
pass
def lookupDomain(inData):
global dnsrecs
dnsrecs = {}
try:
result = domainWhois(inData)
except Exception as E:
print('%s : TLD most likely needs to be configured' % (E))
result = "Error"
print("\nWhois Information")
printWhois(result)
print("\nDNS Records")
#print("\nWhois Information")
#printWhois(result)
#print("\nDNS Records")
recLookup(inData)
print("\nSub Domains")
#print("\nSub Domains")
for subs in subdomains:
subLookup(inData, subs)
return dnsrecs, result
def lookupIP(inData):
with warnings.catch_warnings():
@ -156,6 +170,8 @@ def checkIfIP(in1):
signal.signal(signal.SIGINT, signal_handler)
if __name__ == '__main__':
while running == 1:
parseInput(raw_input("Please Enter a domain" + prompt) )
print('\n')

BIN
main.pyc Normal file

Binary file not shown.

3
requirements.txt Normal file
View File

@ -0,0 +1,3 @@
ipwhois
dnspython
flask

7
static/css/bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

46
static/css/test.css Normal file
View File

@ -0,0 +1,46 @@
.records {
font-size: 12px;
padding: 30px;
color: #363636;
}
.myNav {
background-color: #A4A4A4;
color: #363636;
}
.column {
width: 40%;
background-color: #B1B1B1;
padding: 2%;
float: left;
}
.row:after {
content: "";
display: table;
clear: both;
}
.buffer {
width: 2%;
background-color: #363636;
clear: both;
}
.allmostbiggertext {
font-size: 12px;
font-weight: 700;
padding-top: 10px;
}
.body {
background-color: #363636;
justify-content: center;
}
.col-centered{
float: none;
margin: 0 auto;
}

7
static/js/bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

2
static/js/jquery-3.3.1.slim.min.js vendored Normal file

File diff suppressed because one or more lines are too long

5
static/js/popper.min.js vendored Normal file

File diff suppressed because one or more lines are too long

48
templates/dns.html Normal file
View File

@ -0,0 +1,48 @@
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="/static/css/bootstrap.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="/static/css/test.css">
<title>DNSPy2: Electric Boogaloo</title>
</head>
<body class='body'>
<div class="navbar myNav">
<div class="container" style="width: 100%">
<h3>DNSPy2: Electric Boogaloo
<form action="/" method='post'></h3>
<label class='allmostbiggertext'><span style="display:inline-block; width: 40px;"></span>Domain Name:
<input type='Text' name='domain'>
<input type='Submit'>
</form>
</div>
</div>
<div class="container records justify-content-between row col-centered" style="width: 70%;">
<div class="column rounded">
<b>Whois Information:</b>
{% for key, value in whois.iteritems() %}
<li><b>{{ key }} </b> - {{ value }}</li>
{% endfor %}
</div>
<div class="buffer">
</div>
<div class="column rounded">
<b>DNS Records</b>
{% for key, value in dnsinfo.iteritems() %}
<li><b>{{ key }} </b> - {{ value }}</li>
{% endfor %}
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="/static/js/jquery-3.3.1.slim.min.js" crossorigin="anonymous"></script>
<script src="/static/js/popper.min.js" crossorigin="anonymous"></script>
<script src="/static/js/bootstrap.min.js" crossorigin="anonymous"></script>
</body>
</html>