0
は、既存の投稿からのアドバイスを見て、やった:のpythonのcgi - ヘッダーエラーから抜け出すことができない
(1)置くことによって "SyntaxError: EOF while scanning triple-quoted string literal
" の世話をした
(2)たぶん"print "Content-type: text/html\n\n"
"と
でも悪いヘッダを世話しました。
[Tue Jul 12 14:55:59 2016] [error] [client 172.16.1.18] malformed header from script. Bad header=172.16.1.18 [has executed] d: reset.py, referer: http://172.16.1.18/cgi-bin/index.cgi?message=
アドバイスをいただければ幸いです。
ありがとうございました。 "ダニエル・ローズマン" に
【にindex.cgiの一部】
<form name="input" action="/cgi-bin/reset.py" method="get">
<input type="submit" value="Reset">
[reset.py]
#!/usr/bin/python
import cgi
import cgitb; cgitb.enable() # for troubleshooting
import os
import subprocess
form = cgi.FieldStorage()
from subprocess import *
message = form.getvalue("message", "(no message)")
print os.environ["REMOTE_ADDR"]+ " [has executed] " + Popen('ls', shell=True, stdin=PIPE, stdout=PIPE).communicate()[0]
print "Content-type: text/html\n\n"
print """
<html>
<h2><title>Resetting</title>
<body>
<h3> Resetting </h3>
<p>Done</p>
</body>
</html"
print """
print cgi.escape(message)
最初のprint文は何ですか? –
私はこのリセットスクリプトを実行した人を表示するために "reset.py"をします。私はこれを理解するとすぐに 'ls'がスクリプトに置き換えられます。 – SndLt
しかし、ヘッダーの一部として印刷しています。それはあなたの問題の一部ではありませんか? –