diff options
-rwxr-xr-x | index.py | 36 | ||||
-rwxr-xr-x | server.py | 14 |
2 files changed, 50 insertions, 0 deletions
diff --git a/index.py b/index.py new file mode 100755 index 0000000..cf8dd15 --- /dev/null +++ b/index.py @@ -0,0 +1,36 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -* + +import cgi +import http.client +import sys + +from socket import gethostbyname, gaierror + +form = cgi.FieldStorage() +print("Content-type: text/html; charset=utf-8\n") + + +name = "Website" +urls = ["neodarz.ovh","plex.neodarz.ovh","git.neodarz.ovh"] + +for url in urls: + try: + c = http.client.HTTPConnection(url) + c.request("HEAD", '') + status = str(c.getresponse().status) + except gaierror: + status = "Name or service unknow !" + + + + html = """<!DOCTYPE html> + <head> + <title>Mon programme</title> + </head> + <body> + <p><a href='""" + url + """'> """ + url + """</a> ->""" + status + """</p> + </body> + </html>""" + + print(html) diff --git a/server.py b/server.py new file mode 100755 index 0000000..89b86dc --- /dev/null +++ b/server.py @@ -0,0 +1,14 @@ +#!/usr/bin/python3 + +import http.server + +PORT = 8889 +server_address = ("", PORT) + +server = http.server.HTTPServer +handler = http.server.CGIHTTPRequestHandler +handler.cgi_directories = ["/"] +print("Serveur actif sur le port : ", PORT) + +httpd = server(server_address, handler) +httpd.serve_forever() |