diff --git a/assets/api_templates/domain_status.html b/assets/api_templates/domain_status.html
new file mode 100644
index 0000000..6bf2c30
--- /dev/null
+++ b/assets/api_templates/domain_status.html
@@ -0,0 +1,32 @@
+
+
+
+ {% for res in results %}
+
{{ res }}
+ {% endfor %}
+
diff --git a/src/main.py b/src/main.py
index ff2e1bb..7665d92 100644
--- a/src/main.py
+++ b/src/main.py
@@ -16,16 +16,17 @@ def main():
@app.route('/domain/status/', 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/"