From 6f69e7c3d06cacc654afa71c721c171421ed005d Mon Sep 17 00:00:00 2001 From: NeodarZ Date: Fri, 23 Sep 2016 16:19:19 +0200 Subject: First commit --- index.py | 36 ++++++++++++++++++++++++++++++++++++ server.py | 14 ++++++++++++++ 2 files changed, 50 insertions(+) create mode 100755 index.py create mode 100755 server.py 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 = """ + + Mon programme + + +

""" + url + """ ->""" + status + """

+ + """ + + 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() -- cgit v1.2.1