#!/usr/bin/env python3 import cgi import cgitb import time import os import sys # Needed for sys.exit() # Enable error reporting cgitb.enable() # Create instance of FieldStorage form = cgi.FieldStorage() try: # Set the content type to HTML print("Content-Type: text/html\n") # Output a simple HTML page print("") print("
") print("Your web server is working correctly!
") files = os.listdir('.') for file in files: print(file) print("") print("") except Exception: # Print error page and exit with error code cgitb.handler() sys.exit(1)