add a horrible OS detector

This commit is contained in:
mattx 2020-09-06 20:22:49 +00:00
parent 87050e1389
commit 7d8ca2b71a
2 changed files with 14 additions and 0 deletions

13
distro.py Executable file
View File

@ -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")

View File

@ -10,3 +10,4 @@ welcome to my site, it's pretty empty as you can see at the moment
- [about this](about.html)
- [a frogcat! use with curl](frogcat)
- [image formats a friend made for a minecraft computer mod](sifarchive)
- [Horrible OS detection script](distro.py)