Initial commit

This commit is contained in:
net909
2023-09-28 16:21:06 +08:00
parent 498772eb04
commit ba7be004c0
640 changed files with 87745 additions and 0 deletions
+150
View File
@@ -0,0 +1,150 @@
<?php
/**
* 腾讯域名拦截查询
*/
namespace plugin\web\checkurl;
use app\Plugin;
use Exception;
class App extends Plugin
{
public function index()
{
return $this->view();
}
public function query(){
$link = input('post.url', null, 'trim');
$type = input('post.type');
if(!$link) return msg('error','no url');
$captcha_result = verify_captcha4();
if($captcha_result !== true){
return msg('error', '验证失败,请重新验证');
}
try{
if($type == 'wx'){
$msg = $this->query_wx($link);
}else{
$msg = $this->query_qq($link);
}
}catch(Exception $e){
return msg('error', $e->getMessage());
}
return msg('ok','success',$msg);
}
private function query_qq_old($link){
$url = 'https://cgi.urlsec.qq.com/index.php?m=gwComplainMergeIntoWechat&a=checkBlackStatus&callback=url_query&url='.urlencode($link);
$data=$this->guanjia_curl($url);
$arr = jsonp_decode($data, true);
if(!$arr) throw new Exception('查询接口返回数据解析失败');
$msg['检测URL'] = $link;
if($arr['reCode']==0 && $arr['data']==1) {
$msg['域名状态'] = '<font color="red">已拦截</font>';
}elseif($arr['reCode']==-202){
$msg['域名状态'] = '<font color="green">未拦截</font>';
}elseif($arr['reCode']==-203){
$msg['域名状态'] = '<font color="orange">仅微信拦截</font>';
}else{
$msg['查询失败'] = ''.$arr['data'];
}
return $msg;
}
private function query_qq($link){
$url='https://cgi.urlsec.qq.com/index.php?m=check&a=check&callback=url_query&url='.urlencode($link);
$data=$this->guanjia_curl($url);
$arr = jsonp_decode($data, true);
if(!$arr) throw new Exception('查询接口返回数据解析失败');
if(isset($arr['reCode']) && $arr['reCode']==0) {
$arr = $arr['data']['results'];
//print_r($arr);
$msg['检测URL'] = $arr['url'];
if($arr['whitetype']==3||$arr['whitetype']==4){
$msg['域名状态'] = '<font color="green">白名单</font>';
}elseif($arr['whitetype']==2){
$msg['域名状态'] = '<font color="red">已拦截</font>';
$msg['拦截原因'] = $arr['WordingTitle'];
$msg['拦截详情'] = $arr['Wording'];
}elseif($arr['whitetype']==1){
if($arr['eviltype']!=0){
if($arr['eviltype']==2800 || $arr['eviltype']==2804)
$msg['域名状态'] = '<font color="orange">QQ内拦截</font>';
else
$msg['域名状态'] = '<font color="orange">其他拦截('.$arr['eviltype'].')</font>';
}else{
$msg['域名状态'] = '<font color="green">未拦截</font><br/>';
}
$msg['安全联盟认证'] = ($arr['certify']==1?'是':'否');
}
if($arr['detect_time']!=0){
$msg['记录时间'] = date("Y-m-d H:i:s", $arr['detect_time']);
}
if($arr['isDomainICPOk']==1){
$msg['是否已备案'] = '是';
$msg['备案主体'] = $arr['Orgnization'];
$msg['备案号'] = $arr['ICPSerial'];
}else{
$msg['是否已备案'] = '否';
}
}else{
$msg['检测URL'] = $arr['url'];
$msg['查询失败'] = $arr['data'];
}
return $msg;
}
private function query_wx($link){
$url = 'https://mp.weixinbridge.com/mp/wapredirect?url='.urlencode($link);
$data=get_curl($url,0,0,0,1);
$msg['检测URL'] = $link;
if(strpos($data,'https://weixin110.qq.com/')!==false){
preg_match('/location: (.*?)\r\n/i', $data, $match);
$data = get_curl($match[1]);
preg_match('/var cgiData = (.*?)};/', $data, $match);
if($arr = json_decode($match[1].'}', true)){
if($arr['type']=='block'){
$msg['微信拦截状态'] = '<font color="red">已拦截</font>';
$msg['微信拦截原因'] = $arr['desc'];
}else{
$msg['微信拦截状态'] = '<font color="green">未拦截</font>';
}
}else{
$msg['微信拦截状态'] = '<font color="red">已拦截</font>';
}
}else{
$msg['微信拦截状态'] = '<font color="green">未拦截</font>';
}
return $msg;
}
private function guanjia_curl($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$httpheader[] = "Accept: application/json";
$httpheader[] = "Accept-Language: zh-CN,zh;q=0.8";
$httpheader[] = "Connection: close";
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
curl_setopt($ch, CURLOPT_REFERER, 'https://urlsec.qq.com/check.html');
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$ret = curl_exec($ch);
curl_close($ch);
return $ret;
}
}
+129
View File
@@ -0,0 +1,129 @@
{extend name="common/plugin_layout" /}
{block name="title"}{$plugin.title} - {:config_get('title')}{/block}
{block name="main"}
<div class="container-xl" id="app">
<div class="col-sm-12 col-md-10 col-xl-8 center-block">
<div class="card card-preview">
<div class="card-inner mt-3">
<div class="nya-title nk-ibx-action-item progress-rating">
<span class="nk-menu-text font-weight-bold">腾讯域名拦截查询</span>
</div>
<div class="form-group">
<label class="form-label">请输入要查询的网址:</label>
<div class="form-control-wrap">
<input type="text" v-model="input" placeholder="请输入要查询的网址" class="form-control form-control-lg" ref="input" autocomplete="off">
</div>
</div>
<div class="row">
<div class="col-6">
<button class="btn btn-dim btn-outline-info btn-block btn-lg card-link" @click="query('qq')" :disabled="query_disabled">
查询管家&QQ拦截
</button>
</div>
<div class="col-6">
<button class="btn btn-dim btn-outline-success btn-block btn-lg card-link" @click="query('wx')" :disabled="query_disabled">
查询微信拦截
</button>
</div>
</div>
</div>
</div>
<div class="card card-preview" v-show="showresult" style="display:none">
<div class="card-inner mt-3">
<div class="nya-title nk-ibx-action-item progress-rating">
<span class="nk-menu-text font-weight-bold">查询结果</span>
</div>
<ul class="list-group">
<li class="list-group-item" v-for="(item,index) in result_info"><b>{{index}}</b><span v-html="item"></span></li>
</ul>
</div>
</div>
</div>
</div>
{/block}
{block name="script"}
<script src="{$cdn_cdnjs}vue/2.6.14/vue.min.js"></script>
<script src="https://static.geetest.com/v4/gt4.js"></script>
<script>
new Vue({
el: '#app',
data: {
query_disabled: true,
input: '',
type: '',
showresult: false,
result_info: [],
captcha: null
},
mounted() {
this.$refs.input.focus();
var that=this;
initGeetest4({
captchaId: "99b142aaece96330d0f3ffb565ffb3ef",
product: 'bind',
protocol: 'https://',
riskType: 'ai',
},function (captcha) {
captcha.onReady(function(){
that.query_disabled=false;
that.captcha = captcha;
}).onSuccess(function(){
var result = captcha.getValidate();
if (!result) {
layer.closeAll();
return alert('请先完成验证');
}
var data = { url: that.input, type: that.type};
$.ajax({
url: '/api/{$plugin.alias}/query',
type: 'post',
dataType: 'json',
data: Object.assign(data, result),
cache: false,
success: function (data) {
layer.closeAll();
if(data.status=='ok'){
that.showresult = true;
that.result_info = data.data;
captcha.reset();
}else{
layer.alert(data.message, {icon: 5});
captcha.reset();
}
},
error: function () {
layer.closeAll();
layer.msg('服务器错误', {icon: 5});
captcha.reset();
}
});
}).onError(function(){
alert('验证码加载失败,请刷新页面重试');
})
});
},
methods: {
checkURL()
{
var url = this.input.trim();
if (url.indexOf(" ")>=0){
url = url.replace(/ /g,"");
}
if (url.toLowerCase().indexOf("http://")<0 && url.toLowerCase().indexOf("https://")<0){
url = "http://"+url;
}
this.input = url;
},
query(type) {
if(this.input.trim() == ''){
layer.alert('要查询的网址不能为空');return;
}
this.checkURL();
layer.load(0, {shade:0.1});
this.type = type;
this.captcha.showCaptcha();
},
},
})
</script>
{/block}