blob: a09ae4a5635e5becc2cc4bf60b115ad80a068f9b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#!/usr/local/bin/python3 -I
from sys import exit
import subprocess
def checkconns():
try:
conntable = open("/var/www/htdocs/table.connusers", "w")
except:
print("Can't access connected user table. Who are you?")
exit(0)
connusers = list(set(subprocess.check_output("/usr/bin/who -q; exit 0", stderr=subprocess.STDOUT,shell=True).decode().splitlines()[0].split()))
conntable.write("<ul>\n")
for conn in connusers:
conntable.write("<li><a href=\"https://"+ conn +".tilde.institute\">"+ conn +"</a></li>\n")
conntable.write("</ul>\n")
if __name__ == '__main__':
checkconns()
|