Browse Source

added stuff

main
david 8 years ago
parent
commit
7e94591315
  1. 20
      app.py
  2. 17
      openvpn-status.log
  3. 10
      templates/footer.html
  4. 10
      templates/form.html
  5. 5
      templates/status.html

20
app.py

@ -1,14 +1,28 @@
#!/usr/bin/env python
from flask import Flask, render_template
from flask import Flask, render_template, redirect, url_for, abort, request
import openvpnstatus
app = Flask(__name__)
@app.route('/')
@app.route('/status', methods=['GET', 'POST'])
def status():
o = openvpnstatus.openvpnstatus()
return render_template('status.html', connections = o.connections, routes = o.routes)
@app.route('/redirect')
def redir():
return redirect('https://www.socialnerds.org')
@app.route('/form', methods=['GET', 'POST'])
def formular():
something = "iatren"
if request.method == 'POST':
value = request.form['textfield']
return render_template("footer.html", test=value, test2=value)
else:
return render_template("form.html")
if __name__ == '__main__':
app.run(host='0.0.0.0')
app.run(debug=True)

17
openvpn-status.log

@ -0,0 +1,17 @@
OpenVPN CLIENT LIST
Updated,Sat Aug 24 20:03:17 2013
Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since
charon,81.10.251.191:2051,1440046004,13937806723,Mon Aug 19 16:28:10 2013
basti,90.146.227.139:39863,56493297,243721445,Mon Aug 19 16:28:19 2013
arsbox1,81.10.213.34:57529,39563115,143056221,Thu Aug 22 09:17:36 2013
ROUTING TABLE
Virtual Address,Common Name,Real Address,Last Ref
10.30.0.10,arsbox1,81.10.213.34:57529,Fri Aug 23 20:17:32 2013
10.30.0.6,charon,81.10.251.191:2051,Sat Aug 24 20:03:16 2013
10.1.6.0/26,arsbox1,81.10.213.34:57529,Thu Aug 22 09:17:37 2013
10.1.2.0/26,charon,81.10.251.191:2051,Mon Aug 19 16:28:11 2013
10.1.3.0/26,basti,90.146.227.139:39863,Mon Aug 19 16:28:19 2013
10.30.0.26,basti,90.146.227.139:39863,Mon Aug 19 16:28:19 2013
GLOBAL STATS
Max bcast/mcast queue length,0
END

10
templates/footer.html

@ -0,0 +1,10 @@
{% extends "form.html" %}
{% block body %}
{% if test2 %}
<p>
Hello, my dear {{ test2 }}!
</p>
<hr>
<a href="form">form</a> | <a href="status">status</a>
{% endif %}
{% endblock %}

10
templates/form.html

@ -0,0 +1,10 @@
<!doctype html>
<title>Form</title>
<h1>Form</h1>
<h3>What is your name?</h3>
<form method=post action="form">
<input type=text name=textfield value="{{ test }}">
<input type=submit value=submit>
</form>
{% block body %}{% endblock %}

5
templates/status.html

@ -1,6 +1,9 @@
<!doctype html>
<title>OpenVPN Status</title>
<h1>OpenVPN Status</h1>
<form method="post" action="status">
<input type="submit" value="refresh status">
</form>
<h3>Connections:</h3>
<table border="0" width="80%">
{% for connection in connections %}
@ -11,7 +14,6 @@
</tr>
{% endfor %}
</table>
<hr width="80%" align="left">
<h3>Routing Table:</h3>
<table border="0" width="80%">
{% for route in routes %}
@ -22,4 +24,3 @@
</tr>
{% endfor %}
</table>
<hr width="80%" align="left">