首頁  >  文章  >  後端開發  >  PHP Web木馬掃描器程式碼 v10 安全測試工具

PHP Web木馬掃描器程式碼 v10 安全測試工具

WBOY
WBOY原創
2016-07-29 08:47:441633瀏覽

scanner.php

複製程式碼 程式碼如下:


/**************PHP Web木馬掃描器********************************/
/* [+] 作者: alibaba */
/* [+] QQ: 1499281192 */
/* [+] MSN: weeming21@hotmail.com * /
/* [+] 首發: t00ls.net , 轉載請註明t00ls */
/* [+] 版本: v1.0 */
/* [+] 功能: web版php木馬掃描工具*/
/* [+] 注意: 掃描出來的文件不一定就是後門, */
/* 請自行判斷、審核、比較原文件。 */
/* 如果你不確定掃出來的文件是否為後門, */
/* 歡迎你把該文件發給我進行分析。*/
/************************************************** **** **** *****/
ob_start();
set_time_limit(0);
$使用者名稱= "t00ls"; //設定使用者名稱
$password = "t00ls"; //設定密碼
$ md5 = md5(md5($username).md5($password));
$version = "PHP Web木馬掃描器v1.0";
$realpath = realpath('./');
$selfpath = $_SERVERVERpath = realpath('./');
$selfpath = $_SERVERVER ['PHP_SELF'];
$selfpath = substr($selfpath, 0, strrpos($selfpath,'/'));
define('REALPATH', str_replace('//','/',str_replace('\ ','/',substr($realpath, 0, strlen($realpath) - strlen($selfpath)))) ;
define('MYFILE', basename(__FILE__));
define('MYPATH', str_replace ('\', '/', dirname(__FILE__)).'/');
define('MYFULLPATH', str_replace('\', '/', (__FILE__)));
define('HOST', "http://".$_SERVER['HTTP_HOST']);
? >

;

<?php echo $version?>
/>
;
body {margin:0px;}
body,td{字體: 12px Arial,Tahoma;line-height: 16px;}
a {顏色: #00f;text-decoration:underline;}
a:hover{顏色: # f00;文字裝飾:無;}
.alt1 td{邊框頂部:1px實心#fff;邊框底部:1px實心#ddd;背景:#f1f1f1;填充:5px 10px 5px 5px;}
.alt2 td2 td2 tdpx #fff;底部邊框:1px 實心#ddd;背景:#f9f9f9;填充:5px 10px 5px 5px;}
.focus td{邊框頂部:1px 實心#fff;邊框底部:1px實心ffffdffdfff;填充:5px 10px 5px 5px;}
.head td{邊框頂部:1px 實心#fff;邊框底部:1px 實心#ddd;背景:#e9e9e9;填充:5px 10px 5px 5px;-wepx 5px; head td span{font-weight:normal;}
;
頭>
;
if(!(isset($_COOKIE['t00ls']) && $_COOKIE[ 't00ls'] == $md5) && !(isset($_POST['用戶名']) && isset($ _POST['密碼']) && (md5(md5($_POST['用戶名']). md5($_POST['密碼']))==$md5)))
{
echo '使用者名稱: 密碼: ';
}
elseif(isset($_POST['使用者名稱']) && isset($_POST['密碼']) && (md5(md5($_POST['使用者名稱']).md5($_POST['密碼'] ) ))==$md5))
{
setcookie("t00ls", $md5, time()+60*60*24*365,"/");
echo "登陸成功! ";
header( '刷新: 1; url='.MYFILE.'?action=scan' );
退出();
}
else
{
setcookie("t00ls", $md5, time()+60 *60*24*365,"/");
$setting = getSetting();
$action = isset($_GET['action'])?$_GET['action']:"";
if($ action=="logout")
{
setcookie ("t00ls", "", time() - 3600);
Header("位置:".MYFILE);
退出();
}
if($action= ="下載" && isset($_GET['file']) && trim($_GET['file'])!="")
{
$file = $_GET['file '];
ob_clean();
if (@file_exists($file)) {
header("內容類型:application/octet-stream");
header("Content-Disposition: filename="".basename($file).""");
echo file_get_contents($file);
}
退出();
}
? >

身體tr>
$版本 「?>


=date("Y-m-d H:i:s",mktime())?>
掃描 |
設定 |
登出





if($action=="setting")
{
if(isset( $_POST['btnsetting']))
{
$Ssetting = array();
$Ssetting['user']=isset($_POST['checkuser'])?$_POST['checkuser']:"php | php?| phtml";
$Ssetting['all']=isset($_POST['checkall'])&&$_POST['checkall']=="on"?1:0;
$Ssetting['hta' ]=isset($_POST['checkhta'])&&$_POST['checkhta']=="on"?1:0;
setcookie("t00ls_s", base64_encode(serialize($Ssetting)), time()+ 60*60*24*365,"/");
echo「設定完成!";
header( 'refresh: 1; url='.MYFILE.'?action=setting' );
exit();
}
?>


扫描设定

















文件后缀:
>
>
 




}
else
{
$dir = isset($_POST['path'])?$_POST['path']:MYPATH;
$dir = substr($dir,-1)!="/"?$dir."/":$dir;
?>






扫描路径:

  


if(isset($_POST['btnScan']))
{
$start=mktime();
$is_user = array();
$is_ext = "";
$list = "";
if(trim($setting['user'])!="")
{
$is_user = explode("|",$setting['user']);
if(count($is_user)>0)
{
foreach($is_user as $key=>$value)
$is_user[$key]=trim(str_replace("?","(.)",$value));
$is_ext = "(\.".implode("($|\.))|(\.",$is_user)."($|\.))";
}
}
if($setting['hta']==1)
{
$is_hta=1;
$is_ext = strlen($is_ext)>0?$is_ext."|":$is_ext;
$is_ext.="(^\.htaccess$)";
}
if($setting['all']==1 || (strlen($is_ext)==0 && $setting['hta']==0))
{
$is_ext="(.+)";
}
$php_code = getCode();
if(!is_readable($dir))
$dir = MYPATH;
$count=$scanned=0;
scan($dir,$is_ext);
$end=mktime();
$spent = ($end - $start);
?>
扫描: 文件 | 发现: 可疑文件 | 耗时:



編號。
檔案
更新時間
原因
特徵
動作


表>
}
}
}
ob_flush();
? >
身體>

function scan($path = '.',$is_ext){
global $php_code,$count,$scanned,$list;
$ignore = array( '.', '..' );
$replace=array(" ","n","r","t");
$dh = @opendir( $path );
while(false!== ($file=readdir($dh))){
if( !in_array( $file, $ignore ) ){
if( is_dir( "$path$file" ) ){
scan( "$path$file/" ,$is_ext);
} else {
$current = $path.$file;
if(MYFULLPATH==$current) 繼續;
if(!preg_match("/$is_ext/i",$file)) 繼續;
if(is_read($current))
{
$scanned++;
$c
$c
foreach($php_code as $key => $value)
{
if(preg_match"/$value/$ content))
{
$count++;
$j = $count % 2 + 1;
$filetime = date('Y-m-d H:i:s',filemtime($current));
$reason =explode("- >",$key);
$url = str_replace(REALPATH,HOST,$current);
preg_match("/$value/i",$content,$arr);
$list.="
$current
$filetime
;$reason[0]
$reason[1]
下載
";
//回顯$key . “-”。 $路徑。 $file ."(" . $arr[0] . ")" ."
";
//回顯$path。 $檔."
";
休息;
}
}
}
}
}
}
closedir( $dh );
}
函數SetSetSetSet() 對 = getcom if(isset($_COOKIE['t00ls_s']))
{
$Ssetting = 反序列化(base64_decode($_COOKIE['t00ls_s']));
$Ssetting['user']=isset($Ssetting[' user'])?$Ssetting['user']:"php | php? | phtml | shtml";
$Ssetting['all']=isset($Ssetting['all'])?intval($Ssetting[' all']):0;
$Ssetting['hta']=isset($Ssetting['hta'])?intval($Ssetting['hta']):1;
}
else
{
$Ssetting[ 'user']="php | php?| phtml | shtml";
$Ssetting['all']=0;
$Ssetting['hta']=1;
setcookie("t00ls_s", base64_encode(serialize($ Ssetting)), time()+60*60*24*365,"/");
}
返回$Ssetting;
}
function getCode()
{
return array(
'後門特徵->cha88.cn'=>'cha88.cn',
'後門特徵->c99shell'=>'c99shell', cnmm> '=>'phpspy',
'後門特徵->Scanners'=>'Scanners',
'後門特徵->cmd.php'=>'cmd.php',
'後門特徵->str_rot13'=>' str_rot13',
'後門特徵->webshel​​l'=>'webshel​​l',
'後門特徵->EgY_SpIdEr'=>'EgY_SpIdEr',
'後門特徵->tools88.com'=>'tools8.com' '後門特徵->SECFORCE'=>'SECFORCE',
'後門特徵->eval("?>'=>'eval(('|")?>',
'可疑代碼特徵->system('= >'system(',
'可疑代碼特徵->passthru('=>'passthru(',
'可疑代碼特徵->shell_exec('=>'shell_exec(',
'可疑代碼特徵->exec(' =>'exec(',
'可疑程式碼特徵->popen('=>'popen(',
'可疑程式碼特徵->proc_open'=>'proc_open',
'可疑程式碼特徵->eval($' =>'eval(('|"|s*)\$',
'可疑程式碼特徵->assert($'=>'assert(('|"|s*)\$',
'危險MYSQL程式碼->returns string soname'=>'returnsstringsoname',
'危險MYSQL程式碼->into outfile'=>'intooutfile',
'危險MYSQL程式碼->load_file'=>'select(s+)(.*)load_file' ,
'加密後門特徵->eval(gzinflate('=>'eval(gzinflate(',
'加密後門特徵->eval(base64_decode('=>'eval(base64_decode(',
'加密後門特徵-> eval(gzuncompress('=>'eval(gzuncompress(',
'加密後門特徵->eval(gzdecode('=>'eval(gzdecode(',
'加密後門特徵->eval(str_rot13('=>' eval(str_rot13(',
'加密後門特徵->gzuncompress(base64_decode('=>'gzuncompress(base64_decode(',
'加密後門特徵->base64_decode(gzuncompress('=>'base64_decode.d;一句話後門特徵->eval($_'=>'eval(('|"|s*)\$_(POST|GET|REQUEST|COOKIE)',
'一句話後門特徵->assert($_ '=>'assert(('|"|s*)\$_(POST|GET|REQUEST|COOKIE)',
'一句話後門特徵->require($_'=>'require(('|" |s*)\$_(POST|GET|REQUEST|COOKIE)',
'一句話後門特徵->require_once($_'=>'require_once(('|"|s*)\$_(POST| GET|REQUEST|COOKIE)',
'一句話後門特徵->include($_'=>'include(('|"|s*)\$_(POST|GET|REQUEST|COOKIE)',
'一句話後門特徵->include_once($_'=>'include_once(('|"|s*)\$_(POST|GET|REQUEST|COOKIE)',
'一句話後門特徵->call_user_func("assert "'=>'call_user_func(("|')assert("|')',
'一句話後門特徵->call_user_func($_'=>'call_user_func(('|"|s*)\$_( POST|GET|REQUEST|COOKIE)',
'一句話後門特徵->$_POST/GET/REQUEST/COOKIE[?]($_POST/GET/REQUEST/COOKIE[?]'=>'$_(POST| GET|REQUEST|COOKIE)[([^]]+)](('|"|s*)\$_(POST|GET|REQUEST|COOKIE)[',
'一句話後門特徵->echo(file_get_contents ($_POST/GET/REQUEST/COOKIE'=>'echo(file_get_contents(('|"|s*)\$_(POST|GET|REQUEST|COOKIE)',
'上傳後門特徵->file_put_contents($_POST /GET/REQUEST/COOKIE,$_POST/GET/REQUEST/COOKIE'=>'file_put_contents(('|"|s*)\$_(POST|GET|REQUEST|COOKIE)[([^]]+)] ,('|"|s*)\$_(POST|GET|REQUEST|COOKIE)',
'上傳後門特徵->fputs(fopen("?","w"),$_POST/GET/REQUEST/ COOKIE['=>'fputs(fopen((.+),('|")w('|")),('|"|s*)\$_(POST|GET|REQUEST|COOKIE)[' ,
'.htaccess插馬特徵->SetHandler application/x-httpd-php'=>'SetHandlerapplication/x-httpd-php',
'.htaccess插馬特徵->php_value auto_prepend_file'=>'_valueauto_preend_valufileto_preend__val '.htaccess插馬特性->php_value auto_append_file'=>'php_valueauto_append_file'
);
}
?>


一個在php環境下掃描php電話代碼

代碼如下:


特徵碼:
後門特徵->cha88.cn
後門特徵->c99shell
後門特徵->phpspy
後門特徵->Scanners
後門特徵->cmd.php
後門特徵->Scanners
後門特徵->cmd.php
webshel​​l
後門特徵->EgY_SpIdEr
後門特徵->tools88.com
後門特徵->SECFORCE
後門特徵->eval("?>
可疑代碼特徵->system(
後門特徵->eval("?>
可疑代碼特徵->system(
特徵->shell_exec(
可疑程式碼特徵->exec(
可疑程式碼特徵->popen(
可疑程式碼特徵->proc_open
可疑程式碼特徵->eval($
可疑程式碼特徵->assert($
危險程式碼特徵->SQLMY程式碼->returns string soname
危險MYSQL程式碼->into outfile
危險MYSQL程式碼->load_file
加密後門特徵->eval(gzinflate(
加密後門特徵->eval(base64_decode(
(

加密後門特徵->gzuncompress(base64_decode(
加密後門特徵->base64_decode(gzuncompress(
一句話後門特徵->eval($_
後門特徵->assert($_
($_
一句話後門特徵->require_once($_
一句話後門特徵->include($_
一句話後門特徵->include_once($_
一句話後門特徵->call_user_func("assert"
一句話後門特徵->call_user_func($_
一句話後門特徵->$_POST/GET/REQUEST/COOKIE[?]($_POST/GET/REQUEST/COOKIE[?]
一句話後門特徵->echo(file_get_contents(file_get_contents(file_get_contents(file_get_contents(file_get_contents(file_get_contents(file_get) $_POST/GET/REQUEST/COOKIE
上傳後門特徵->file_put_contents($_POST/GET/REQUEST/COOKIE,$_POST/GET/REQUEST/COOKIE
上傳後門特徵->fputs(fopen("?","w" ),$_POST/GET/REQUEST/COOKIE[
.htaccess插馬特徵->SetHandler application/x-httpd-php

.htaccess插馬特性->php_value auto_prepend_file
.htaccess插馬特性->php_value auto_prepend_file
.htaccessess插馬特徵->app_value auto_prepend_file

.htaccessess插馬特徵-php_value懶惰設計,直接套用phpspy樣式

注意: 掃描出來的文件並不一定就是後門, 請自行判斷、審核、對比原文件。

以上就介紹了 PHP Web木馬掃描器程式碼 v10 安全測試工具,包含了方面的內容,希望對PHP教學有興趣的朋友有所幫助。

🎜 🎜
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn