add a horrible OS detector
This commit is contained in:
parent
87050e1389
commit
7d8ca2b71a
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env python
|
||||
import os
|
||||
import re
|
||||
print("Content-Type: text/html; charset=utf-8")
|
||||
print()
|
||||
print("<title>Distro detect</title>")
|
||||
ua = os.environ["HTTP_USER_AGENT"]
|
||||
if ua.startswith("Mozilla/5.0"):
|
||||
info = re.findall(r"\((.*?)\)", ua)
|
||||
distro = info[0].split("; ")[1]
|
||||
print("<p>You are using " + distro + "</p>")
|
||||
else:
|
||||
print("This only works with Firefox")
|
Loading…
Reference in New Issue