Added POST support for the / route and basic DNS lookups

This commit is contained in:
2018-05-02 09:41:09 +10:00
parent 3c173e851b
commit 048c46f2bc
8 changed files with 15 additions and 7 deletions

13
gui.py
View File

@ -3,10 +3,17 @@ import main as dnspy
app = Flask(__name__)
app.config['DEBUG'] = True
@app.route('/')
@app.route('/', methods=['POST', 'GET'])
def index():
dnsinfo = dnspy.domainWhois('benjamyn.love')
return render_template('dns.html', dnsinfo=dnsinfo)
if request.method == 'POST':
data = request.form['domain']
print(data)
dnsinfo = dnspy.domainWhois(str(data))
#dnsinfo = {"." : "."}
return render_template('dns.html', dnsinfo=dnsinfo)
else:
dnsinfo = {"Status" : "Please enter a domain"}
return render_template('dns.html', dnsinfo=dnsinfo)
@app.route('/domain/', methods=['POST', 'GET'])
def getDomain():

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
main.pyc

Binary file not shown.

View File

@ -9,12 +9,12 @@
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<link rel="stylesheet" href="/static/css/test.css">
<title>Hello, world!</title>
<title>DNSPy2: Electric Boogaloo</title>
</head>
<body class='body'>
<div class="navbar myNav">
<h3>DNSPy2: Electric Boogaloo
<form action="/domain/" method='post'></h3>
<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'>
@ -22,6 +22,7 @@
</div>
<div class="container records">
<div class="column">
<b>Whois Information:</b>
{% for key, value in dnsinfo.iteritems() %}
<li><b>{{ key }} </b> - {{ value }}</li>
{% endfor %}
@ -29,7 +30,7 @@
<div class="buffer column">
</div>
<div class="column">
test
<b>DNS Records</b>
</div>
</div>
<!-- Optional JavaScript -->