mountainguan / ql-plugin-disguise
为GET/POST请求制作混淆头。
V4.1.0
2018-12-29 07:20 UTC
Requires
- jaeger/querylist: ^4.0
This package is auto-updated.
Last update: 2024-09-29 03:58:10 UTC
README
为GET/POST请求制作混淆头。
QueryList V4 插件 - 混淆插件
给Post/Get方法加上带有混淆信息的headers。
安装
composer require mountainguan/ql-plugin-disguise
API
- disguiseIp($otherArgs,$ip): 添加自定义或随机headers -- 混淆QueryList的otherArgs中的IP地址,返回 QueryList
- disguiseUa($otherArgs,$ua): 添加自定义或随机headers -- 混淆QueryList的otherArgs中的UserAgent,返回 QueryList
安装选项
QueryList::use(DisguisePlugin::class,$opt1,$opt2)
- $opt1:
disguiseIp函数别名。 - $opt2:
disguiseUa函数别名。
用法
- 安装插件
use QL\QueryList; use QL\Ext\DisguisePlugin; $ql = QueryList::getInstance(); $ql->use(DisguisePlugin::class); //or Custom function name $ql->use(DisguisePlugin::class,'disguiseIp','disguiseUa');
- 仅以随机方式混淆IP。
print_r($ql->disguiseIp()->disguise_headers);
//or custom
print_r($ql->disguiseIp([],'66.248.172.185')->disguise_headers);
输出
Array (
[headers] => Array (
[X-Forwarded-For] => 66.248.172.185
[Proxy-Client-IP] => 66.248.172.185
[WL-Proxy-Client-IP] => 66.248.172.185
[HTTP_CLIENT_IP] => 66.248.172.185
[X-Real-IP] => 66.248.172.185
)
)
- 仅以随机方式混淆UserAgent。
print_r($ql->disguiseUa()->disguise_headers);
//or custom
print_r($ql->disguiseUa([],'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11')->disguise_headers);
输出
Array
(
[headers] => Array (
[User-Agent] => Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11
)
)
- 随机使用两个函数。
print_r($ql->disguiseIp()->disguiseUa()->disguise_headers);
输出
Array (
[headers] => Array (
[X-Forwarded-For] => 222.122.96.204
[Proxy-Client-IP] => 222.122.96.204
[WL-Proxy-Client-IP] => 222.122.96.204
[HTTP_CLIENT_IP] => 222.122.96.204
[X-Real-IP] => 222.122.96.204
[User-Agent] => Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)
)
)
- 使用post/get请求的otherArgs参数可以实现更完美的混淆。
print_r($ql->disguiseIp(
array('headers'=>[ 'Accept'=>'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'Accept-Encoding'=>'gzip, deflate, br',
'Accept-Language'=>'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7',
'Connection'=>'keep-alive'])
)->disguiseUa()->disguise_headers);
注意:otherArgs参数必须是如Array('headers'=>[...])的形式。
输出
Array (
[headers] => Array (
[Accept] => text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
[Accept-Encoding] => gzip, deflate, br
[Accept-Language] => en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7
[Connection] => keep-alive
[X-Forwarded-For] => 60.169.94.187
[Proxy-Client-IP] => 60.169.94.187
[WL-Proxy-Client-IP] => 60.169.94.187
[HTTP_CLIENT_IP] => 60.169.94.187
[X-Real-IP] => 60.169.94.187
[User-Agent] => Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729; InfoPath.3; rv:11.0) like Gecko
)
)
- 支持带有混淆的原生get/post方法,并为GHttp的postJson()方法添加支持。
$ql = QueryList::getInstance();
$ql->use(DisguisePlugin::class);
$ql->disguiseIp()->disguiseUa()->get('http://httpbin.org/get',[
'param1' => 'testvalue',
'params2' => 'somevalue'
],[
//设置超时时间,单位:秒
'timeout' => 30,
'headers' => [
'Referer' => 'https://querylist.cc/',
'Accept' => 'application/json',
'X-Foo' => ['Bar', 'Baz'],
'Cookie' => 'abc=111;xxx=222'
]
]);
echo $ql->getHtml();die;