伪造IP 和UA 请求

sanlanlan 2018-8-9 标签: PHP 浏览:5189 评论:0


$binfo =array('Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; InfoPath.2; AskTbPTV/5.17.0.25589; Alexa Toolbar)','Mozilla/5.0 (Windows NT 5.1; rv:22.0) Gecko/20100101 Firefox/22.0','Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET4.0C; Alexa Toolbar)','Mozilla/4.0(compatible; MSIE 6.0; Windows NT 5.1; SV1)',$_SERVER['HTTP_USER_AGENT']);

$userinfo = $binfo[mt_rand(0,3)];

$cip = '123.125.68.'.mt_rand(10,254);
$xip = '125.90.88.'.mt_rand(10,254);
$header = array( 
'CLIENT-IP:'.$cip, 
'X-FORWARDED-FOR:'.$xip, 
);

$url = 'http://www.xixinice.com/index.php?action=addcom';
$requestUrl = 'http://www.baidu.com';
$data = ['gid'=>'40','comname'=>'66 or 1=1','comment'=>'okok or 1=1'];
$data = ['gid'=>'40','comname'=>'66','comment'=>'okok'];
$ch  =curl_init();
$timeOut = 10;

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_REFERER, $requestUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_USERAGENT, $userinfo);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeOut);

$con = curl_exec($ch);

curl_close($ch);


本文相关标签: php IP.UA

发表评论: