写了一个AJAX的webshell给大家玩玩

sh/bash/dash/ksh/zsh等Shell脚本
回复
MP3
帖子: 12
注册时间: 2010-08-24 19:40

写了一个AJAX的webshell给大家玩玩

#1

帖子 MP3 » 2012-03-15 21:46

可通过浏览器操控服务器,当然也包括手机浏览器

有两个小毛病:按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" />&nbsp;&nbsp'
echo '<input type="button" value="clear" onclick=clear() />'
echo '</form>'
echo '</body>'
echo '</html>'
附件
webshell.png
头像
qy117121
论坛版主
帖子: 50587
注册时间: 2007-12-14 13:40
系统: Winbuntu
来自: 志虚国乌由市
联系:

Re: 写了一个AJAX的webshell给大家玩玩

#2

帖子 qy117121 » 2012-03-15 21:47

我想想该说什么,还是路过吧
渠月 · QY   
本人只会灌水,不负责回答问题
无聊可以点一下→ http://u.nu/ubuntu

邮箱 [email protected]
MP3
帖子: 12
注册时间: 2010-08-24 19:40

Re: 写了一个AJAX的webshell给大家玩玩

#3

帖子 MP3 » 2012-03-15 21:49

错啦,手机浏览器好象不支持ajax
头像
qy117121
论坛版主
帖子: 50587
注册时间: 2007-12-14 13:40
系统: Winbuntu
来自: 志虚国乌由市
联系:

Re: 写了一个AJAX的webshell给大家玩玩

#4

帖子 qy117121 » 2012-03-15 21:50

MP3 写了:错啦,手机浏览器好象不支持ajax
:em04
渠月 · QY   
本人只会灌水,不负责回答问题
无聊可以点一下→ http://u.nu/ubuntu

邮箱 [email protected]
头像
灰色小狼
帖子: 4585
注册时间: 2008-12-06 10:38
系统: Arch

Re: 写了一个AJAX的webshell给大家玩玩

#5

帖子 灰色小狼 » 2012-03-15 22:08

自动滚动的话抓取textarea的onchange事件

代码: 全选

<textarea id= "text" onchange="document.all.text.scrollTop=document.all.text.scrollHeight; ">
头像
lilydjwg
论坛版主
帖子: 4258
注册时间: 2009-04-11 23:46
系统: Arch Linux
联系:

Re: 写了一个AJAX的webshell给大家玩玩

#6

帖子 lilydjwg » 2012-03-15 22:17

灰色小狼 写了:自动滚动的话抓取textarea的onchange事件

代码: 全选

<textarea id= "text" onchange="document.all.text.scrollTop=document.all.text.scrollHeight; ">
麻烦先去 w3school 学习下基本知识好不?HTML 属性的等号后边能有空格?document 哪来 all 属性?标准的 getElementById 不知道?this 关键字不会用?

再加句,change 事件只有在 blur 时才会发生。要输入时发生的话得用 input 事件。
头像
灰色小狼
帖子: 4585
注册时间: 2008-12-06 10:38
系统: Arch

Re: 写了一个AJAX的webshell给大家玩玩

#7

帖子 灰色小狼 » 2012-03-15 22:21

哦,还有clear,不要用innerHTML,用text.value=""
头像
灰色小狼
帖子: 4585
注册时间: 2008-12-06 10:38
系统: Arch

Re: 写了一个AJAX的webshell给大家玩玩

#8

帖子 灰色小狼 » 2012-03-15 22:34

lilydjwg 写了:
灰色小狼 写了:自动滚动的话抓取textarea的onchange事件

代码: 全选

<textarea id= "text" onchange="document.all.text.scrollTop=document.all.text.scrollHeight; ">
麻烦先去 w3school 学习下基本知识好不?HTML 属性的等号后边能有空格?document 哪来 all 属性?标准的 getElementById 不知道?this 关键字不会用?

再加句,change 事件只有在 blur 时才会发生。要输入时发生的话得用 input 事件。
ok,我就会google
头像
phoenixlzx
帖子: 2245
注册时间: 2009-07-29 20:11
系统: Arch Linux
来自: Gensokyo
联系:

Re: 写了一个AJAX的webshell给大家玩玩

#9

帖子 phoenixlzx » 2012-03-15 22:39

喔,看起来很好玩
回复