Added POST support for the / route and basic DNS lookups

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

No files matched your search

+11 -4
View File
@@ -1,12 +1,19 @@
from flask import Flask, render_template, request
from flask import Flask, render_template, request
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():
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+4 -3
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 -->