有两个小毛病:按clear按钮不能清屏,输出不能自动下滚,哪位帮改一下?
代码: 全选
#!/bin/sh
echo 'Content-Type: text/html'
echo
CMD=${QUERY_STRING##c=}
CMD=`echo -n $CMD | sed -e 's#%20# #g' -e 's#%2F#/#g'`
if [ -n "$CMD" ] ; then
echo $CMD
$CMD
exit
fi
echo '<html>'
echo '<head>'
echo "<title>WebShell</title>"
cat <<'EOF'
<script type="text/javascript">
var xmlhttp;
function loadXMLDoc(url) {
xmlhttp=null;
if (window.XMLHttpRequest)
xmlhttp=new XMLHttpRequest();
else if (window.ActiveXObject)
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
if (xmlhttp!=null) {
xmlhttp.onreadystatechange=state_Change;
xmlhttp.open("GET", url, true);
xmlhttp.send(null);
} else
alert("Your browser does not support XMLHTTP.");
}
function state_Change() {
if (xmlhttp.readyState==4) {
if (xmlhttp.status==200) {
document.getElementById('output').innerHTML+=xmlhttp.responseText+'\n';
ready();
}
else
alert("Failed: " + xmlhttp.statusText);
}
}
function run(thisform) {
with (thisform) with (c)
if (value!=null && value!="")
loadXMLDoc("/cgi-bin/webshell?c="+encodeURIComponent(value));
return false;
}
function ready() {
c=document.getElementById('c');
c.value="";
c.focus();
}
function clear() {
document.getElementById('output').innerHTML="";
}
</script>
EOF
echo '</head>'
echo '<body bgcolor="#E0E0E0" onload="ready()">'
echo '<textarea id="output" cols="120" rows="25" readonly="readonly">'
echo '</textarea>'
echo '<form method="GET" onsubmit="return run(this)">'
echo 'cmd: <input type="text" id="c" name="c" size="80" maxlength="80" />'
echo '<input type="submit" value="submit" />  '
echo '<input type="button" value="clear" onclick=clear() />'
echo '</form>'
echo '</body>'
echo '</html>'