Compare commits

..

No commits in common. "dnsflask" and "master" have entirely different histories.

16 changed files with 12 additions and 178 deletions

25
gui.py
View File

@ -1,25 +0,0 @@
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')

View File

@ -1,7 +0,0 @@
#!/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,5 +1,4 @@
#!/usr/bin/python2.7
#GUI REWRITE
import whois
import signal
import dns.resolver
@ -27,8 +26,6 @@ colour_default = gc.getColour(jsonData["colour_default"])
CSVFile = jsonData["country_codes"]
# Endconfig block
dnsrecs = {}
if platform.system().lower() == "linux":
import readline
else:
@ -82,7 +79,6 @@ def parseInput(inData):
lookupDomain(tmpInData)
def recLookup(inData):
global dnsrecs
for dnsrec in dnsrecords:
try:
data = dns.resolver.query(inData, dnsrec)
@ -90,51 +86,41 @@ 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)
dnsrecs[dnsrec] = rdata
print( indent + colour_pretty + "%s:\t%s%s" % (dnsrec, colour_good, rdata) + colour_default)
else:
tmpData = cnameToA(rdata.to_text())
#print( indent + colour_pretty + "%s:\t%s%s -> %s" % (dnsrec, colour_good, rdata, tmpData) + colour_default)
dnsrecs[dnsrec] = rdata
print( indent + colour_pretty + "%s:\t%s%s -> %s" % (dnsrec, colour_good, rdata, tmpData) + colour_default)
else:
tmpData = cnameToA(rdataTMP[1])
#print( indent + colour_pretty + "%s:\t%s%s -> %s" % (dnsrec, colour_good, rdata, tmpData) + colour_default)
dnsrecs[dnsrec] = rdata
print( indent + colour_pretty + "%s:\t%s%s -> %s" % (dnsrec, colour_good, rdata, tmpData) + colour_default)
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:
#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
print(indent + colour_pretty + "%s:\t%s%s" % (sub, colour_good, rdata) + colour_default)
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)
dnsrecs[sub] = rdata
print(indent + colour_pretty + "%s:\t%s%s -> %s" % (sub, colour_good, rdata, cnameToA(sub + "." + inData).to_text()) + colour_default)
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():
@ -170,8 +156,6 @@ 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

Binary file not shown.

View File

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

File diff suppressed because one or more lines are too long

View File

@ -1,46 +0,0 @@
.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;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,48 +0,0 @@
<!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>