Added templating

This commit is contained in:
Stephen Cochrane 2021-02-11 16:19:23 +02:00
parent 3d0bfeac13
commit 3a85b7f864
2 changed files with 38 additions and 5 deletions

View File

@ -0,0 +1,32 @@
<style>
body {
background-color:black;
color:white
}
a {
color:#DC143C
}
.header {
padding: 60px;
text-align: center;
font-size: 30px;
}
.para {
text-align: center;
font-size:15
}
input[type=text] {
border: 2px solid black;
border-radius: 4px;
}
</style>
<div class=header>{{ TITLE }}</div>
<div class=para>
{% for res in results %}
<p>{{ res }}</p>
{% endfor %}
</div>

View File

@ -16,16 +16,17 @@ def main():
@app.route('/domain/status/<dom>', methods = ["GET"])
def domstatus(dom):
results = []
if dom == 'all':
dom = ''
for sub in domains:
ip = os.popen('ping -c 1 -w 5 %s.%s | head -1 | cut -d \" \" -f 3' % (sub, main_domain)).read()
dom += sub + ':' + ip + '\n'
results.append("%s.%s:%s" % (sub, main_domain, ip))
elif dom not in domains:
dom = "unknown domain"
results = "unknown domain"
else:
dom += ':' + str(os.popen('ping -c 1 -w 5 %s.%s | head -1 | cut -d \" \" -f 3' % (dom, main_domain)).read())
return dom
ip = os.popen('ping -c 1 -w 5 %s.%s | head -1 | cut -d \" \" -f 3' % (dom, main_domain)).read()
results.append("%s.%s:%s" % (dom, main_domain, ip))
return render_template('domain_status.html', results=results, TITLE=str("Results for " + dom))
def setup():
app.template_folder = "../assets/api_templates/"