-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvpn-serve.py
More file actions
executable file
·36 lines (30 loc) · 822 Bytes
/
vpn-serve.py
File metadata and controls
executable file
·36 lines (30 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/python3
from flask import Flask
from flask import request
PORT=42145
DIR="/home/me/.vpn"
app = Flask(__name__)
# TODO: Update this to take .isHidden into consideration
@app.route("/")
def home():
try:
file = open(f"{DIR}/.statusmessage", 'r')
message = file.read()
except:
message="{\
\"ip\":\"Unknown\",\
\"vpnip\":\"Unknown\",\
\"homeip\":\"Unknown\",\
\"localip\":\"Unknown\",\
\"file\":\"Unknown\",\
\"type\":\"Unknown\",\
\"city\":\"Unknown\",\
\"text\":\"Status Error VPN\",\
\"messages\": [{\"label\": {\"text\":\"VPN Status Read Error\",\"color\":\"#ff0000\"},\"progress\":{\"value\":0}}],\
\"tooltip\":\"ip: Unknown\\ncity: Unknown\\nkillswitch: Unknown\",\
\"class\":[\"Unknown\"],\
\"alt\":\"Unknown\"\
}"
return message
if __name__ == "__main__":
app.run(port=PORT, host="127.0.0.1")