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}
+90
View File
@@ -0,0 +1,90 @@
<?php
/**
* 域名DNS查询
*/
namespace plugin\web\dns;
use app\Plugin;
use Exception;
class App extends Plugin
{
const DOH_API = [
'alidns' => [
'url' => 'https://dns.alidns.com/resolve',
'isproxy' => false,
],
'dnspod' => [
'url' => 'https://doh.pub/resolve',
'isproxy' => false,
],
'360' => [
'url' => 'https://doh.360.cn/resolve',
'isproxy' => false,
],
'google' => [
'url' => 'https://dns.google/resolve',
'isproxy' => true,
],
];
const DNS_TYPE = [
1 => 'A',
5 => 'CNAME',
16 => 'TXT',
28 => 'AAAA',
2 => 'NS',
6 => 'SOA',
];
public function index()
{
return $this->view();
}
public function query(){
$name = input('post.name', null, 'trim');
$type = input('post.type/d');
$doh = input('?post.doh') ? input('post.doh', null, 'trim') : 'alidns';
if(!$name || !$type) return msg('error','no name');
try{
$result = $this->doh_resolve($doh, $type, $name);
$list = [];
foreach($result as $row){
$row['typename'] = isset(self::DNS_TYPE[$row['type']]) ? self::DNS_TYPE[$row['type']] : $row['type'];
$list[] = $row;
}
}catch(Exception $e){
return msg('error', $e->getMessage());
}
return msg('ok','success',$list);
}
private function doh_resolve($doh, $type, $name){
if(!array_key_exists($doh, self::DOH_API)) throw new Exception('不存在该DNS服务器');
$url = self::DOH_API[$doh]['url'].'?name='.urlencode($name).'&type='.$type;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
$arr = json_decode($data, true);
if(!$arr){
throw new Exception('DOH接口查询失败');
}else{
if(isset($arr['Answer'])){
return $arr['Answer'];
}else{
return [];
}
}
}
}
+170
View File
@@ -0,0 +1,170 @@
{extend name="common/plugin_layout" /}
{block name="title"}{$plugin.title} - {:config_get('title')}{/block}
{block name="main"}
<style>
.query-title {
text-align: right;
}
.table-title th{word-break: keep-all;}
td{word-break: break-all;}
</style>
<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">域名DNS查询</span>
</div>
<div class="form-group">
<div class="form-control-wrap">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">域名</span>
</div>
<input type="text" v-model="set.name" placeholder="请输入域名" class="form-control form-control-lg" @keyup.enter="query" ref="input" autocomplete="off">
</div>
</div>
</div>
<div class="form-group">
<div class="form-control-wrap">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">解析类型</span>
</div>
<select class="form-control form-control-lg" v-model="set.type">
<option v-for="v in dns_types" :value="v.key">{{v.value}}</option>
</select>
</div>
</div>
</div>
<div class="form-group">
<div class="form-control-wrap">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">DNS服务器</span>
</div>
<select class="form-control form-control-lg" v-model="set.doh">
<option v-for="v in doh_list" :value="v.key">{{v.value}}</option>
</select>
<div class="input-group-append">
<button class="btn btn-dim btn-outline-primary btn-block btn-lg" @click="query" :disabled="query_disabled">
查询
</button>
</div>
</div>
</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>
<div class="alert alert-warning text-center" v-if="result_list.length==0"><h6><em class="icon ni ni-info"></em> 没有查询到解析记录</h6></div>
<div v-if="result_list.length>0">
<h6>域名 <span class="text-primary">{{result_input}}</span> 的解析记录:</h6>
<div class="table-responsive">
<table class="table table-hover table-bordered">
<thead class="table-title">
<th>域名</th><th>解析类型</th><th>解析记录值</th><th>TTL</th>
</thead>
<tbody>
<tr v-for="(item,index) in result_list" :key="index">
<td>{{item.name}}</td><td>{{item.typename}}</td><td>{{item.data}}</td><td>{{item.TTL}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="script"}
<script src="{$cdn_cdnjs}vue/2.6.14/vue.min.js"></script>
<script>
new Vue({
el: '#app',
data: {
query_disabled: false,
set: {
name: '',
type: '1',
doh: 'alidns',
},
dns_types: [
{key: '1', value: 'A'},
{key: '5', value: 'CNAME'},
{key: '16', value: 'TXT'},
{key: '28', value: 'AAAA'},
{key: '2', value: 'NS'},
{key: '6', value: 'SOA'},
],
doh_list: [
{key: 'alidns', value: '阿里DNS'},
{key: 'dnspod', value: 'DNSPOD'},
{key: '360', value: '360DNS'},
{key: 'google', value: '谷歌DNS'},
],
result_input: '',
showresult: false,
result_list: [],
result_total: 0
},
mounted() {
this.$refs.input.focus();
},
methods: {
checkURL()
{
var url = this.set.name.trim();
if (url.indexOf(" ")>=0){
url = url.replace(/ /g,"");
}
if (url.toLowerCase().indexOf("http://")==0){
url = url.slice(7);
}
if (url.toLowerCase().indexOf("https://")==0){
url = url.slice(8);
}
if (url.slice(url.length-1)=="/"){
url = url.slice(0,url.length-1);
}
this.set.name = url;
},
query() {
this.checkURL();
if(this.set.name == ''){
alert('域名不能为空');return;
}
layer.load(0, {shade:0.1});
var that=this;
$.ajax({
url: '/api/{$plugin.alias}/query',
type: 'post',
dataType: 'json',
data: that.set,
cache: false,
success: function (data) {
layer.closeAll();
if(data.status=='ok'){
that.result_input = that.set.name;
that.showresult = true;
that.result_list = data.data;
}else{
layer.alert(data.message, {icon: 5});
}
},
error: function () {
layer.closeAll();
layer.msg('服务器错误', {icon: 5});
}
});
}
},
})
</script>
{/block}
+17
View File
@@ -0,0 +1,17 @@
<?php
/**
* 网站Favicon获取
*/
namespace plugin\web\favicon;
use app\Plugin;
class App extends Plugin
{
public function index()
{
return $this->view();
}
}
+72
View File
@@ -0,0 +1,72 @@
{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">网站Favicon获取</span>
</div>
<div class="form-group">
<label class="form-label">输入网址或域名:</label>
<div class="form-control-wrap">
<input type="text" id="url" placeholder="输入网址或域名" class="form-control" autocomplete="off">
</div>
</div>
<div class="row">
<div class="col-6">
<button class="btn btn-dim btn-outline-primary btn-block card-link" id="submitget">
<em class="icon ni ni-img"></em> 获取
</button>
</div>
<div class="col-6">
<button class="btn btn-dim btn-outline-primary btn-block card-link" id="reset">
<em class="icon ni ni-trash-empty"></em> 清除缓存
</button>
</div>
</div>
</div>
</div>
<div class="card card-preview">
<div class="card-inner">
<h6><em class="icon ni ni-info"></em> 说明</h6>
<div class="accordion-inner">
<p>Favicon获取接口:</p>
<p><code>https://favicon.cccyun.cc/要获取的网址</code></p>
<p>例如:</p>
<p><code>https://favicon.cccyun.cc/http://tool.cccyun.cc/</code></p>
<p>注:接口有来源校验,空来源将被禁止访问</p>
<p>如果网站变更了favicon,可以点击清除缓存,然后点获取,在跳转后的页面按Ctrl+F5即可显示最新的图标</p>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="script"}
<script>
$(document).ready(function(){
$("#submitget").click(function(){
var url = $("#url").val().trim();
if(url == ''){
alert('网址不能为空');return;
}
window.open('https://favicon.cccyun.cc/'+url)
});
$("#reset").click(function(){
var url = $("#url").val().trim();
if(url == ''){
alert('网址不能为空');return;
}
httpPost('https://favicon.cccyun.cc/api.php', { url: url}, function(data){
if(data.code == 0){
layer.alert(data.msg, {icon:1});
}else{
alert(data.msg);
}
}, true)
})
});
</script>
{/block}
+52
View File
@@ -0,0 +1,52 @@
<?php
/**
* 查看HTTP请求
*/
namespace plugin\web\http;
use app\Plugin;
use think\facade\View;
class App extends Plugin
{
public function index()
{
$ip = real_ip();
$new = new \app\lib\IpLocation();
$arr = $new->getlocation($ip);
$location = '';
if($arr){
$location = $arr['province'].$arr['city'].' '.$arr['area'];
}
$cookie = '';
foreach($_COOKIE as $cookie_key=>$cookie_value){
if($cookie_key == 'admin_token' || $cookie_key == 'user_token' || $cookie_key == 'PHPSESSID') continue;
$cookie .= $cookie_key.'='.$cookie_value.'; ';
}
$_SERVER['HTTP_COOKIE'] = $cookie;
$line = ['<b>'.$_SERVER['REQUEST_METHOD'].'</b> '.$_SERVER['REQUEST_URI'].' '.$_SERVER['SERVER_PROTOCOL']];
foreach ($_SERVER as $name => $value)
{
if (substr($name, 0, 5) == 'HTTP_')
{
$name = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))));
$line[] = '<b>'.$name.'</b>: '.$value;
}
}
if($_SERVER['REQUEST_METHOD'] == 'POST'){
$line[] = '';
$line[] = file_get_contents('php://input');
}
View::assign('ip', $ip);
View::assign('location', $location);
View::assign('line', $line);
return $this->view();
}
}
+25
View File
@@ -0,0 +1,25 @@
{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" style="word-break: break-all;">
<div class="nya-title nk-ibx-action-item progress-rating">
<span class="nk-menu-text font-weight-bold">查看HTTP请求</span>
</div>
IP地址:{$ip}{$location}
<hr/>HTTP请求行:
<hr/>
{volist name="line" id="vo"}
{$vo|raw}<br/>
{/volist}
<hr/>
</div>
</div>
</div>
</div>
{/block}
{block name="script"}
{/block}
+67
View File
@@ -0,0 +1,67 @@
<?php
/**
* HTTP状态查询
*/
namespace plugin\web\http_status;
use app\Plugin;
use Exception;
use think\facade\Db;
use think\facade\View;
class App extends Plugin
{
public function index()
{
return $this->view();
}
public function query(){
$url = input('post.url', null, 'trim');
if(!$url) return msg('error','no url');
if(!filter_var($url,FILTER_VALIDATE_URL)){
return msg('error','输入的URL不符合规范');
}
$captcha_result = verify_captcha4();
if($captcha_result !== true){
return msg('error', '验证失败,请重新验证');
}
$url_arr = parse_url($url);
$ip = gethostbyname($url_arr['host']);
$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: */*";
$httpheader[] = "Accept-Language: zh-CN,zh;q=0.8";
$httpheader[] = "Connection: close";
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_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$data = curl_exec($ch);
$errno = curl_errno($ch);
if ($errno) {
$msg = 'Curl error: ' . curl_error($ch);
return msg('error',$msg);
}
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$header = explode("\r\n", trim($data));
$msg['ip'] = $ip;
$msg['code'] = $httpcode;
$msg['head'] = implode('<br/>', $header);
return msg('ok','success',$msg);
}
}
+144
View File
@@ -0,0 +1,144 @@
{extend name="common/plugin_layout" /}
{block name="title"}{$plugin.title} - {:config_get('title')}{/block}
{block name="main"}
<style>
.query-title {
text-align: right;
}
</style>
<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">HTTP状态查询</span>
</div>
<div class="form-group">
<label class="form-label">页面URL</label>
<div class="form-control-wrap">
<input type="text" v-model="input" placeholder="请输入页面URL" class="form-control form-control-lg" @keyup.enter="query" ref="input" autocomplete="off">
</div>
</div>
<button class="btn btn-dim btn-outline-primary btn-block card-link mb-3" @click="query" :disabled="query_disabled">
查询
</button>
</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>
<div class="table-responsive">
<table class="table table-hover table-bordered">
<tbody>
<tr><td class="query-title">服务器IP</td><td><a :href="'/ip?ip='+result_info.ip" target="_blank">{{result_info.ip}}</a></td></tr>
<tr><td class="query-title">返回状态码</td><td>{{result_info.code}}</td></tr>
<tr><td class="query-title">返回HEAD信息</td><td v-html="result_info.head" class="query-result"></td></tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="card card-preview">
<div class="card-inner">
<h6><em class="icon ni ni-info"></em> 简介</h6>
<div class="accordion-inner">
<p>HTTP状态码(HTTP Status Code</p>
<p>一些常见的状态码为:200 - 服务器成功返回网页 404 - 请求的网页不存在 503 - 服务不可用</p>
<p>所有状态解释:<a href="http://tools.jb51.net/table/http_status_code" target="_blank">点击查看</a></p>
</div>
</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: '',
result_input: '',
showresult: false,
result_info: {
'ip': '',
'code': '',
'head': ''
},
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};
$.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() {
if(this.input.trim() == ''){
layer.alert('要查询的网址不能为空');return;
}
this.checkURL();
layer.load(0, {shade:0.1});
this.captcha.showCaptcha();
},
},
})
</script>
{/block}
+151
View File
@@ -0,0 +1,151 @@
<?php
/**
* ICP备案查询
*/
namespace plugin\web\icp;
use app\Plugin;
use Exception;
use think\facade\Db;
class App extends Plugin
{
const CACHE_TIME = 604800;
public function index()
{
return $this->view();
}
public function query(){
$domain = input('post.domain', null, 'trim');
if(!$domain) return msg('error','no domain');
if(strpos($domain,'.') && !checkdomain($domain)){
return msg('error', '域名格式不正确!');
}
$captcha_result = verify_captcha4();
if($captcha_result !== true){
return msg('error', '验证失败,请重新验证');
}
$cache = Db::name('querycache')->where('type', 'icplist')->where('key|subkey', $domain)->find();
if($cache && time() - strtotime($cache['uptime']) <= self::CACHE_TIME){
$array = json_decode($cache['content'], true);
$data = Db::name('querycache')->where('type', 'icpitem')->whereIn('id', implode(',',$array['list']))->select();
$list = [];
foreach($data as $row){
$list[] = json_decode($row['content'], true);
}
return msg('ok','success',['total'=>$array['total'], 'list'=>$list]);
}
$cache = Db::name('querycache')->where('type', 'icpitem')->where('key|subkey', $domain)->find();
if($cache && time() - strtotime($cache['uptime']) <= self::CACHE_TIME){
$array = json_decode($cache['content'], true);
return msg('ok','success',['total'=>1, 'list'=>[$array]]);
}
try{
$result = $this->execapi($domain);
}catch(Exception $e){
return msg('error', $e->getMessage());
}
if($result['total'] > 1 && count($result['data']) > 1){
$i = 0;
foreach($result['data'] as $row){
$id = Db::name('querycache')->duplicate([
'subkey' => $row['webLicence'],
'content' => json_encode($row),
'uptime' => date('Y-m-d H:i:s')
])->insertGetId([
'type' => 'icpitem',
'key' => $row['domain'],
'subkey' => $row['webLicence'],
'content' => json_encode($row),
'uptime' => date('Y-m-d H:i:s')
]);
$result['data'][$i++]['id'] = $id;
$ids[] = $id;
}
Db::name('querycache')->duplicate([
'subkey' => $result['data'][0]['mainLicence'],
'content' => json_encode(['total'=>$result['total'], 'list'=>$ids]),
'uptime' => date('Y-m-d H:i:s')
])->insert([
'type' => 'icplist',
'key' => $result['data'][0]['unitName'],
'subkey' => $result['data'][0]['mainLicence'],
'content' => json_encode(['total'=>$result['total'], 'list'=>$ids]),
'uptime' => date('Y-m-d H:i:s')
]);
}elseif($result['total'] == 1 && count($result['data']) > 0){
$id = Db::name('querycache')->duplicate([
'subkey' => $result['data'][0]['webLicence'],
'content' => json_encode($result['data'][0]),
'uptime' => date('Y-m-d H:i:s')
])->insertGetId([
'type' => 'icpitem',
'key' => $result['data'][0]['domain'],
'subkey' => $result['data'][0]['webLicence'],
'content' => json_encode($result['data'][0]),
'uptime' => date('Y-m-d H:i:s')
]);
$result['data'][0]['id'] = $id;
}
return msg('ok','success',['total'=>$result['total'], 'list'=>$result['data']]);
}
public function item(){
$id = input('post.id');
if(!$id) return msg('error','no id');
$cache = Db::name('querycache')->where('id', $id)->find();
if($cache){
$array = json_decode($cache['content'], true);
return msg('ok','success',['total'=>1, 'list'=>[$array]]);
}else{
return msg('ok','success',['total'=>0, 'list'=>[]]);
}
}
private function execapi($domain){
$timeStamp = time();
$authKey = md5("testtest" . $timeStamp);
$referer = 'https://beian.miit.gov.cn/';
$headers = ['Origin: https://beian.miit.gov.cn'];
$url = 'https://hlwicpfwc.miit.gov.cn/icpproject_query/api/auth';
$post = 'authKey='.$authKey.'&timeStamp='.$timeStamp;
$response = get_curl($url, $post, $referer, 0, 0, 0, 0, $headers);
$arr = json_decode($response, true);
if(isset($arr['code']) && $arr['code']==200){
$token = $arr['params']['bussiness'];
$url = 'https://hlwicpfwc.miit.gov.cn/icpproject_query/api/icpAbbreviateInfo/queryByCondition';
$post = json_encode(['pageNum'=>'','pageSize'=>'','unitName'=>$domain,'serviceType'=>1]);
$headers[] = 'Content-Type: application/json; charset=UTF-8';
$headers[] = 'token: '.$token;
$response = get_curl($url, $post, $referer, 0, 0, 0, 0, $headers);
$arr = json_decode($response, true);
if(isset($arr['code']) && $arr['code']==200){
$list = [];
foreach($arr['params']['list'] as $row){
$list[] = ['domain'=>$row['domain'], 'mainLicence'=>$row['mainLicence'], 'webLicence'=>$row['serviceLicence'], 'unitName'=>$row['unitName'], 'unitType'=>$row['natureName'], 'updateTime'=>$row['updateRecordTime'], 'limitAccess'=>$row['limitAccess'], 'contentTypeName'=>$row['contentTypeName']];
}
return ['code'=>0, 'total'=>$arr['params']['total'], 'data'=>$list];
}elseif(isset($arr['msg'])){
throw new Exception($arr['msg']);
}else{
throw new Exception('查询接口(query)请求失败');
}
}elseif(isset($arr['msg'])){
throw new Exception($arr['msg']);
}else{
throw new Exception('查询接口(auth)请求失败');
}
}
}
+200
View File
@@ -0,0 +1,200 @@
{extend name="common/plugin_layout" /}
{block name="title"}{$plugin.title} - {:config_get('title')}{/block}
{block name="main"}
<style>
.query-title {
text-align: right;
}
.table-title th{word-break: keep-all;}
</style>
<div class="container-xl" id="app">
<div class="col-md-12 col-xl-10 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">ICP备案查询</span>
</div>
<div class="form-group">
<label class="form-label">输入域名/备案号/单位名称:</label>
<div class="form-control-wrap">
<input type="text" v-model="input" placeholder="请输入域名或备案号或单位名称查询,请勿使用子域名或者带http://www等字符的网址查询" class="form-control form-control-lg" @keyup.enter="query" ref="input" autocomplete="off">
</div>
</div>
<button class="btn btn-dim btn-outline-primary btn-block card-link mb-3" @click="query" :disabled="query_disabled">
查询
</button>
</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>
<div class="alert alert-warning text-center" v-if="result_total==0"><h6><em class="icon ni ni-info"></em> 没有查询到备案记录</h6></div>
<div v-if="result_total==1">
<h6>域名 <span class="text-primary">{{result_info.domain}}</span> 的信息:</h6>
<div class="table-responsive">
<table class="table table-hover table-bordered">
<tbody>
<tr><td class="query-title">网站域名</td><td>{{result_info.domain}}</td></tr>
<tr><td class="query-title">ICP备案/许可证号</td><td>{{result_info.webLicence}}</td></tr>
<tr><td class="query-title">主办单位名称</td><td>{{result_info.unitName}}</td></tr>
<tr><td class="query-title">主办单位性质</td><td>{{result_info.unitType}}</td></tr>
<tr><td class="query-title">审核日期</td><td>{{result_info.updateTime}}</td></tr>
<tr><td class="query-title">是否限制接入</td><td>{{result_info.limitAccess}}</td></tr>
<tr><td class="query-title">网站前置审批项</td><td>{{result_info.contentTypeName}}</td></tr>
</tbody>
</table>
</div>
</div>
<div v-if="result_total>1">
<h6><span class="text-primary">{{result_input}}</span> 共查询到 <span class="text-primary">{{result_total}}</span> 条备案信息:</h6>
<div class="table-responsive">
<table class="table table-hover table-bordered">
<thead class="table-title">
<th>网站域名</th><th>网站备案号</th><th>主办单位名称</th><th>审核日期</th><th>操作</th>
</thead>
<tbody>
<tr v-for="(item,index) in result_list" :key="index">
<td>{{item.domain}}</td><td>{{item.webLicence}}</td><td>{{item.unitName}}</td><td>{{item.updateTime}}</td><td><button class="btn btn-dim btn-outline-info btn-xs" @click="show_item(index)">详情</button></td>
</tr>
</tbody>
</table>
</div>
<p v-if="result_total>10" class="text-info">当前只支持查询最新10条记录,剩余记录请使用域名或网站备案号进行精确查询。</p>
</div>
</div>
</div>
<div class="card card-preview">
<div class="card-inner">
<h6><em class="icon ni ni-info"></em> 简介</h6>
<div class="accordion-inner">
<p>支持输入域名、网站备案号、主体备案号、单位名称(个人姓名、企业名称)进行查询</p>
<p>此ICP查询工具直接对接工信部官网,非第三方接口。<a href="https://blog.cccyun.cn/post-445.html" target="_blank">查询源码下载</a>,请勿对本站进行恶意抓取</p>
</div>
</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: '',
result_input: '',
showresult: false,
result_info: {
id: '',
domain: '',
mainLicence: '',
webLicence: '',
unitName: '',
unitType: '',
updateTime: '',
limitAccess: '',
contentTypeName: '',
},
result_list: [],
result_total: 0,
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;
var searchdomain = getQueryString('domain');
if(searchdomain!=null){
that.input = searchdomain;
that.query()
}
}).onSuccess(function(){
var result = captcha.getValidate();
if (!result) {
layer.closeAll();
return alert('请先完成验证');
}
var data = {domain: that.input};
$.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'){
var data = data.data;
that.result_input = that.input;
that.showresult = true;
that.result_total = data.total;
that.result_list = data.list;
if(data.list.length > 0){
that.result_info = data.list[0];
}
captcha.reset();
}else{
alert(data.message);
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 = url.slice(7);
}
if (url.toLowerCase().indexOf("https://")==0){
url = url.slice(8);
}
if (url.slice(url.length-1)=="/"){
url = url.slice(0,url.length-1);
}
if (url.toLowerCase().indexOf("www.")==0){
url = url.slice(4);
}
this.input = url;
},
query() {
this.checkURL();
if(this.input == ''){
alert('查询内容不能为空');return;
}
layer.load(0, {shade:0.1});
this.captcha.showCaptcha();
},
show_item(index){
this.result_info = this.result_list[index];
this.result_total = 1;
}
},
})
</script>
{/block}
+12
View File
@@ -0,0 +1,12 @@
yum -y install python3
yum -y install mesa-libGL
python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip
pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip3 install opencv-python==4.3.0.38
pip3 install requests
pip3 install flask
pip3 install gevent
nohup python3 ./server.py >> ./server.log 2>&1 &
+165
View File
@@ -0,0 +1,165 @@
# -*- coding: utf-8 -*-
import requests,hashlib,time,base64,cv2,os
def icpquery(info):
if(info == None or len(info) == 0):
return {'code':-1,'msg':'no domain'}
info_data = {
'pageNum':'',
'pageSize':'',
'unitName':info,
'serviceType':1
}
#构造AuthKey
timeStamp = int(round(time.time()*1000))
authSecret = 'testtest' + str(timeStamp)
authKey = hashlib.md5(authSecret.encode(encoding='UTF-8')).hexdigest()
#获取Cookie
cookie_headers = {
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.72 Safari/537.36 Edg/90.0.818.42'
}
cookie = requests.utils.dict_from_cookiejar(requests.get('https://beian.miit.gov.cn/',headers=cookie_headers,verify=False).cookies)['__jsluid_s']
#请求获取Token
t_url = 'https://hlwicpfwc.miit.gov.cn/icpproject_query/api/auth'
t_headers = {
'Host': 'hlwicpfwc.miit.gov.cn',
'Connection': 'keep-alive',
'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="90", "Microsoft Edge";v="90"',
'Accept': '*/*',
'DNT': '1',
'sec-ch-ua-mobile': '?0',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36 Edg/90.0.818.46',
'Origin': 'https://beian.miit.gov.cn',
'Sec-Fetch-Site': 'same-site',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Dest': 'empty',
'Referer': 'https://beian.miit.gov.cn/',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
'Cookie': '__jsluid_s=' + cookie
}
data = {
'authKey': authKey,
'timeStamp': timeStamp
}
t_response = requests.post(t_url,data=data,headers=t_headers,verify=False)
try:
get_token = t_response.json()['params']['bussiness']
except:
return {'code':-1,'msg':'请求被禁止,请稍后或更换头部与IP后再试('+t_response.status_code+')'}
#获取验证图像、UUID
p_url = 'https://hlwicpfwc.miit.gov.cn/icpproject_query/api/image/getCheckImage'
p_headers = {
'Host': 'hlwicpfwc.miit.gov.cn',
'Connection': 'keep-alive',
'Content-Length': '0',
'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="90", "Microsoft Edge";v="90"',
'Accept': 'application/json, text/plain, */*',
'DNT': '1',
'sec-ch-ua-mobile': '?0',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36 Edg/90.0.818.46',
'token': get_token,
'Origin': 'https://beian.miit.gov.cn',
'Sec-Fetch-Site': 'same-site',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Dest': 'empty',
'Referer': 'https://beian.miit.gov.cn/',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
'Cookie': '__jsluid_s=' + cookie
}
p_request = requests.post(p_url,data='',headers=p_headers,verify=False)
try:
p_uuid = p_request.json()['params']['uuid']
big_image = p_request.json()['params']['bigImage']
small_image = p_request.json()['params']['smallImage']
except KeyError:
return {'code':-1,'msg':'获取验证图像失败,请重试('+p_request.status_code+')'}
#解码图片,写入并计算图片缺口位置
with open('bigImage.jpg','wb') as f:
f.write(base64.b64decode(big_image))
f.close()
with open('smallImage.jpg','wb') as f:
f.write(base64.b64decode(small_image))
f.close()
background_image = cv2.imread('bigImage.jpg',cv2.COLOR_GRAY2RGB)
fill_image = cv2.imread('smallImage.jpg',cv2.COLOR_GRAY2RGB)
background_image_canny = cv2.Canny(background_image, 100, 200)
fill_image_canny = cv2.Canny(fill_image, 100, 300)
position_match = cv2.matchTemplate(background_image, fill_image, cv2.TM_CCOEFF_NORMED)
min_val,max_val,min_loc,max_loc = cv2.minMaxLoc(position_match)
position = max_loc
mouse_length = position[0]+1
os.remove('bigImage.jpg')
os.remove('smallImage.jpg')
#通过拼图验证,获取sign
check_url = 'https://hlwicpfwc.miit.gov.cn/icpproject_query/api/image/checkImage'
check_headers = {
'Host': 'hlwicpfwc.miit.gov.cn',
'Accept': 'application/json, text/plain, */*',
'Connection': 'keep-alive',
'Content-Length': '60',
'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="90", "Microsoft Edge";v="90"',
'DNT': '1',
'sec-ch-ua-mobile': '?0',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.72 Safari/537.36 Edg/90.0.818.42',
'token': get_token,
'Content-Type': 'application/json',
'Origin': 'https://beian.miit.gov.cn',
'Sec-Fetch-Site': 'same-site',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Dest': 'empty',
'Referer': 'https://beian.miit.gov.cn/',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
'Cookie': '__jsluid_s=' + cookie
}
check_data = {
'key':p_uuid,
'value':mouse_length
}
check_request = requests.post(check_url,json=check_data,headers=check_headers,verify=False)
try:
sign = check_request.json()['params']
except Exception:
return {'code':-1,'msg':'校验图片信息失败,请重试('+check_request.status_code+')'}
#获取备案信息
info_url = 'https://hlwicpfwc.miit.gov.cn/icpproject_query/api/icpAbbreviateInfo/queryByCondition'
info_headers = {
'Host': 'hlwicpfwc.miit.gov.cn',
'Connection': 'keep-alive',
'Content-Length': '78',
'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="90", "Microsoft Edge";v="90"',
'DNT': '1',
'sec-ch-ua-mobile': '?0',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.72 Safari/537.36 Edg/90.0.818.42',
'Content-Type': 'application/json',
'Accept': 'application/json, text/plain, */*',
'uuid': p_uuid,
'token': get_token,
'sign': sign,
'Origin': 'https://beian.miit.gov.cn',
'Sec-Fetch-Site': 'same-site',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Dest': 'empty',
'Referer': 'https://beian.miit.gov.cn/',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
'Cookie': '__jsluid_s=' + cookie
}
info_request = requests.post(info_url,json=info_data,headers=info_headers,verify=False)
domain_total = info_request.json()['params']['total']
result_list = []
for info_base in info_request.json()['params']['list']:
result_list.append({'domain':info_base['domain'], 'mainLicence':info_base['mainLicence'], 'webLicence':info_base['serviceLicence'], 'unitName':info_base['unitName'], 'unitType':info_base['natureName'], 'updateTime':info_base['updateRecordTime'], 'limitAccess':info_base['limitAccess'], 'contentTypeName':info_base['contentTypeName']})
return {'code':0,'msg':'success','data':result_list, 'total':domain_total}
+34
View File
@@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
import icp,json,flask
HOST='127.0.0.1'
PORT=9088
app = flask.Flask(__name__)
json_header = {'Content-Type':'application/json; charset=utf-8'}
@app.route('/',methods=['GET'])
def home():
domain = flask.request.args.get('domain')
result = icp.icpquery(domain)
return flask.Response(json.dumps(result),headers=json_header)
@app.errorhandler(404)
def notfound(e):
errorStr = '''<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>server</center>
</body>
</html>'''
headers = {
"Content-Type":"text/html"
}
return flask.Response(errorStr,status=404,headers=headers)
if __name__ == '__main__':
from gevent.pywsgi import WSGIServer
http_server = WSGIServer((HOST, PORT), app)
http_server.serve_forever()
#app.run(port=PORT,host=HOST)
+97
View File
@@ -0,0 +1,97 @@
<?php
/**
* IP地址查询
*/
namespace plugin\web\ip;
use app\Plugin;
use Exception;
use think\facade\Db;
use think\facade\View;
class App extends Plugin
{
const CACHE_TIME = 172800;
public function index()
{
View::assign('myip', real_ip());
return $this->view();
}
public function query(){
$ip = input('post.ip', null, 'trim');
$apitype = input('?post.apitype')?input('post.apitype'):'pconline';
if(!$ip || !$apitype) return msg('error','no ip');
if(is_numeric($ip)) $ip = long2ip($ip);
if(filter_var($ip, FILTER_VALIDATE_IP)){
$type = 'ip';
}elseif(checkdomain($ip)){
$type = 'domain';
}else{
return msg('error', 'IP或域名格式不正确!');
}
$captcha_result = verify_captcha4();
if($captcha_result !== true){
return msg('error', '验证失败,请重新验证');
}
if($type == 'domain'){
$ip = gethostbyname($ip);
if(!$ip || !filter_var($ip, FILTER_VALIDATE_IP)){
return msg('error', '未查询到该域名的解析记录');
}
}
$ipnum = bindec(decbin(ip2long($ip)));
if(self::CACHE_TIME > 0){
$cache = Db::name('querycache')->where('type', 'ip')->where('key', $apitype.'-'.$ip)->find();
if($cache && time() - strtotime($cache['uptime']) <= self::CACHE_TIME){
$array = json_decode($cache['content'], true);
return msg('ok','success',['data'=>$array, 'ip'=>$ip, 'ipnum'=>$ipnum, 'type'=>$type]);
}
}
$classname = 'plugin\\web\\ip\\api\\'.$apitype;
if(class_exists($classname)){
$instance = new $classname();
try{
$result = $instance->query($ip);
}catch(Exception $e){
return msg('error', $e->getMessage());
}
}else{
return msg('error', '该查询接口不存在');
}
if(self::CACHE_TIME > 0 && $apitype != 'chunzhen' && $apitype != 'ip2regoin'){
Db::name('querycache')->duplicate([
'content' => json_encode($result),
'uptime' => date('Y-m-d H:i:s')
])->insertGetId([
'type' => 'ip',
'key' => $apitype.'-'.$ip,
'content' => json_encode($result),
'uptime' => date('Y-m-d H:i:s')
]);
}
return msg('ok','success',['data'=>$result, 'ip'=>$ip, 'ipnum'=>$ipnum, 'type'=>$type]);
}
public function item(){
$id = input('post.id');
if(!$id) return msg('error','no id');
$cache = Db::name('querycache')->where('id', $id)->find();
if($cache){
$array = json_decode($cache['content'], true);
return msg('ok','success',$array);
}else{
return msg('error','记录不存在');
}
}
}
+8
View File
@@ -0,0 +1,8 @@
<?php
namespace plugin\web\ip;
interface api
{
public function query($ip);
}
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace plugin\web\ip\api;
use Exception;
use plugin\web\ip\api;
/**
* {"status":"1","info":"OK","infocode":"10000","province":"北京市","city":"北京市","adcode":"110000","rectangle":"116.0119343,39.66127144;116.7829835,40.2164962"}
*/
class amap implements api
{
public function query($ip){
$type = '4';
if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)){
$type = '6';
}
$url = 'https://restapi.amap.com/v5/ip?key=0113a13c88697dcea6a445584d535837&type='.$type.'&ip='.$ip;
$data = get_curl($url);
$arr = json_decode($data, true);
if (isset($arr['status']) && $arr['status']=='1') {
if(empty($arr['country'])){
throw new Exception('接口查询失败:该IP信息不存在');
}
$address = $arr['country'].(isset($arr['province'])&&$arr['province']!=$arr['country']?$arr['province']:'').(isset($arr['city'])?$arr['city']:'').(isset($arr['district'])?$arr['district']:'');
$result['IP所在地'] = $address;
if(isset($arr['isp'])) $result['运营商'] = $arr['isp'];
if(isset($arr['location']) && $arr['location']!='null,null') $result['经纬度'] = $arr['location'];
return $result;
}elseif (isset($arr['info'])) {
throw new Exception('接口查询失败:'.$arr['info']);
}else{
throw new Exception('接口查询失败,返回结果错误');
}
}
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace plugin\web\ip\api;
use Exception;
use plugin\web\ip\api;
/**
* {"status":"0","t":"","set_cache_time":"","data":[{"ExtendedLocation":"","OriginQuery":"113.97.33.248","appinfo":"","disp_type":0,"fetchkey":"113.97.33.248","location":"广东省深圳市 电信","origip":"113.97.33.248","origipquery":"113.97.33.248","resourceid":"6006","role_id":0,"shareImage":1,"showLikeShare":1,"showlamp":"1","titlecont":"IP地址查询","tplt":"ip"}]}
*/
class baidu implements api
{
public function query($ip){
$url = 'https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv/api.php?query='.$ip.'&resource_id=6006&ie=utf8&format=json';
$data = get_curl($url);
$data = mb_convert_encoding($data, 'UTF-8', 'GBK');
$arr = json_decode($data, true);
if (isset($arr['data']) && count($arr['data'])>0) {
return ['IP所在地'=>$arr['data'][0]['location']];
}else{
throw new Exception('接口查询失败,返回结果错误');
}
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace plugin\web\ip\api;
use Exception;
use plugin\web\ip\api;
/**
* {"113.97.33.248":{"continent":"亚洲","country":"中国","province":"广东","city":"深圳","region":"南山","carrier":"电信","division":"440305","en_country":"China","en_short_code":"CN","longitude":"113.93029","latitude":"22.53291"}}
*/
class baota implements api
{
public function query($ip){
$url = 'https://www.bt.cn/api/panel/get_ip_info?ip='.$ip;
$data = get_curl($url);
$arr = json_decode($data, true);
if (isset($arr[$ip])) {
return ['IP所在地'=>$arr[$ip]['country'].''.$arr[$ip]['province'].''.$arr[$ip]['city'].''.$arr[$ip]['region'], 'ISP运营商'=>$arr[$ip]['carrier'], '经纬度'=>$arr[$ip]['longitude'].','.$arr[$ip]['latitude']];
}else{
throw new Exception('接口查询失败,返回结果错误');
}
}
}
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace plugin\web\ip\api;
use Exception;
use plugin\web\ip\api;
/**
* {"ip":"113.97.33.248","beginip":"113.97.17.0","endip":"113.97.81.255","country":"\u5e7f\u4e1c\u7701\u6df1\u5733\u5e02","area":"\u7535\u4fe1","province":"\u5e7f\u4e1c\u7701","city":"\u6df1\u5733\u5e02"}
*/
class chunzhen implements api
{
public function query($ip){
$new = new \app\lib\IpLocation();
$arr = $new->getlocation($ip);
if($arr){
return ['IP所在地'=>$arr['province'].$arr['city'], '运营商'=>$arr['area']];
}else{
throw new Exception('查无此IP数据');
}
}
}
+68
View File
@@ -0,0 +1,68 @@
<?php
namespace plugin\web\ip\api;
use Exception;
use plugin\web\ip\api;
/**
* {"status":"success","country":"加拿大","countryCode":"CA","region":"QC","regionName":"Quebec","city":"蒙特利尔","zip":"H1K","lat":45.6085,"lon":-73.5493,"timezone":"America/Toronto","isp":"Le Groupe Videotron Ltee","org":"Videotron Ltee","as":"AS5769 Videotron Telecom Ltee","query":"24.48.0.1"}
*/
class ip138 implements api
{
public function query($ip){
if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)){
return $this->query_ipv6($ip);
}
//return $this->query_chinaz($ip);
$url = 'https://m.ip138.com/iplookup.asp?ip='.$ip.'&action=2';
$data = get_curl($url);
preg_match('!<td class="th">ASN归属地</td><td>(.*?)</td>!', $data, $match);
if (isset($match[1])) {
return ['IP所在地'=>$match[1]];
}else{
throw new Exception('接口查询失败,返回结果错误');
}
}
public function query_chinaz($ip){
$url = 'http://mip.chinaz.com/?query='.$ip;
$data = get_curl($url);
if(strpos($data,'错误的IP地址')){
throw new Exception('错误的IP地址');
}
$data = getSubstr($data, '<td class="bg-3fa z-tc ww-5">物理地址</td>', '</td>');
$data = getSubstr($data, '<td class="z-tc">', '<br />');
$data = trim(str_replace('&amp;',' ',$data));
if ($data) {
return ['IP所在地'=>$data];
}else{
throw new Exception('接口查询失败,返回结果错误');
}
}
public function query_ipv6($ip){
$url = 'http://ip.zxinc.org/api.php?type=json&ip='.$ip;
$data = get_curl($url);
$arr = json_decode($data, true);
if (isset($arr['code']) && $arr['code']==0) {
return ['IP所在地'=>$arr['data']['location']];
}else{
throw new Exception('接口查询失败,返回结果错误');
}
}
public function query_api($ip){
$url = 'http://api.ip138.com/ip/?ip='.$ip;
$header = ['token: c10d9edc249963398634d009413758f4'];
$data = get_curl($url,0,0,0,0,0,0,$header);
$arr = json_decode($data, true);
if (isset($arr['ret']) && $arr['ret']=='ok') {
return ['IP所在地'=>$arr['data'][0].$arr['data'][1].$arr['data'][2].$arr['data'][3].' '.$arr['data'][4]];
}elseif (isset($arr['msg'])) {
throw new Exception('接口查询失败:'.$arr['msg']);
}else{
throw new Exception('接口查询失败,返回结果错误');
}
}
}
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace plugin\web\ip\api;
use Exception;
use plugin\web\ip\api;
/**
* {"ip":"113.97.33.248","beginip":"113.97.17.0","endip":"113.97.81.255","country":"\u5e7f\u4e1c\u7701\u6df1\u5733\u5e02","area":"\u7535\u4fe1","province":"\u5e7f\u4e1c\u7701","city":"\u6df1\u5733\u5e02"}
*/
class ip2regoin implements api
{
public function query($ip){
$new = new \app\lib\Ip2Region();
$region = $new->search($ip);
if($region){
$region = explode('|',$region);
return [
'IP所在地'=>($region[1]?$region[1]:'').($region[2]?$region[2]:'').($region[3]?$region[3]:'').($region[4]?$region[4]:''),
'运营商'=>($region[11]?$region[11]:''),
];
}else{
throw new Exception('查无此IP数据');
}
}
}
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace plugin\web\ip\api;
use Exception;
use plugin\web\ip\api;
/**
* {"status":"success","country":"加拿大","countryCode":"CA","region":"QC","regionName":"Quebec","city":"蒙特利尔","zip":"H1K","lat":45.6085,"lon":-73.5493,"timezone":"America/Toronto","isp":"Le Groupe Videotron Ltee","org":"Videotron Ltee","as":"AS5769 Videotron Telecom Ltee","query":"24.48.0.1"}
*/
class ipapi implements api
{
public function query($ip){
$url = 'http://ip-api.com/json/'.$ip.'?lang=zh-CN';
$data = get_curl($url);
$arr = json_decode($data, true);
if (isset($arr['status']) && $arr['status']=='success') {
return ['IP所在地'=>$arr['country'].' '.$arr['regionName'].' '.$arr['city'], 'AS编号'=>$arr['as'], 'ISP运营商'=>$arr['isp'], '当地时区'=>$arr['timezone']];
}elseif (isset($arr['message'])) {
throw new Exception('接口查询失败:'.$arr['message']);
}else{
throw new Exception('接口查询失败,返回结果错误');
}
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace plugin\web\ip\api;
use Exception;
use plugin\web\ip\api;
/**
* {"ret":0,"data":{"country_code":"CN","country":"\u4e2d\u56fd","province":"\u5e7f\u4e1c","city":"\u6df1\u5733","isp":"chinatelecom.com.cn","asn":["AS4134 - CHINANET-BACKBONE - No.31,Jin-rong Street, CN"],"ports":[],"ip":"113.97.33.248"},"dns":[{"country_code":"CN","country":"\u4e2d\u56fd","province":"\u5e7f\u4e1c","city":"\u6df1\u5733","isp":"chinatelecom.com.cn","asn":["AS4134 - CHINANET-BACKBONE - No.31,Jin-rong Street, CN"],"ports":[],"ip":"113.97.33.248"}]}
*/
class ipip implements api
{
public function query($ip){
$url = 'https://clientapi.ipip.net/browser/chrome?ip='.$ip.'&l=zh-CN';
$data = get_curl($url);
$arr = json_decode($data, true);
if (isset($arr['ret']) && $arr['ret']==0) {
return ['IP所在地'=>$arr['data']['country'].''.$arr['data']['province'].''.$arr['data']['city'], 'ISP运营商'=>$arr['data']['isp'], 'AS编号'=>$arr['data']['asn'][0]];
}else{
throw new Exception('接口查询失败,返回结果错误');
}
}
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace plugin\web\ip\api;
use Exception;
use plugin\web\ip\api;
/**
* {"ip":"218.89.171.143","pro":"四川省","proCode":"510000","city":"成都市","cityCode":"510100","region":"","regionCode":"0","addr":"四川省成都市 电信","regionNames":"","err":""}
*/
class pconline implements api
{
public function query($ip){
$url = 'http://whois.pconline.com.cn/ipJson.jsp?json=true&ip='.$ip;
$data = get_curl($url);
$data = mb_convert_encoding($data, "UTF-8", "GB2312");
$arr = json_decode($data, true);
if (isset($arr['addr'])) {
return ['IP所在地'=>$arr['addr']];
}else{
throw new Exception('接口查询失败,返回结果错误');
}
}
}
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace plugin\web\ip\api;
use Exception;
use plugin\web\ip\api;
/**
* {"data":{"area":"","country":"中国","isp_id":"100017","queryIp":"113.97.33.248","city":"深圳","ip":"113.97.33.248","isp":"电信","county":"","region_id":"440000","area_id":"","county_id":null,"region":"广东","country_id":"CN","city_id":"440300"},"msg":"query success","code":0}
*/
class taobao implements api
{
public function query($ip){
$url = 'https://ip.taobao.com/outGetIpInfo';
$post = 'ip='.$ip.'&accessKey=alibaba-inc';
$data = get_curl($url, $post, 'https://ip.taobao.com/ipSearch');
$arr = json_decode($data, true);
if (isset($arr['code']) && $arr['code']==0) {
return ['IP所在地'=>$arr['data']['country'].$arr['data']['region'].$arr['data']['city'], '运营商'=>$arr['data']['isp']];
}elseif (isset($arr['msg'])) {
throw new Exception('接口查询失败:'.$arr['msg']);
}else{
throw new Exception('接口查询失败,返回结果错误');
}
}
}
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace plugin\web\ip\api;
use Exception;
use plugin\web\ip\api;
/**
* {"status":0,"message":"Success","request_id":"345c35a0-97d5-4965-8950-5c4643a28bec","result":{"ip":"113.97.33.248","location":{"lat":22.53332,"lng":113.93041},"ad_info":{"nation":"中国","province":"广东省","city":"深圳市","district":"南山区","adcode":440305}}}
*/
class tencent implements api
{
public function query($ip){
$key = 'HOFBZ-A4AK6-BQGSI-ES7F6-HCBN2-SNFQF';
$url = 'https://apis.map.qq.com/ws/location/v1/ip?ip='.$ip.'&key='.$key;
$data = get_curl($url);
$arr = json_decode($data,true);
if(isset($arr['status']) && $arr['status']==0){
$result['code']=0;
$location = $arr['result']['location']['lng'].','.$arr['result']['location']['lat'];
$address = $arr['result']['ad_info']['nation'].$arr['result']['ad_info']['province'].$arr['result']['ad_info']['city'].$arr['result']['ad_info']['district'];
return ['IP所在地'=>$address, '经纬度'=>$location];
}else{
throw new Exception('接口查询失败:'.$arr['message']);
}
}
}
+233
View File
@@ -0,0 +1,233 @@
{extend name="common/plugin_layout" /}
{block name="title"}{$plugin.title} - {:config_get('title')}{/block}
{block name="main"}
<style>
.query-title {
text-align: right;
}
</style>
<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">IP地址查询</span>
</div>
<div class="form-group">
<label class="form-label">IP地址/域名:</label><div class="float-right">我的IP<a href="javascript:" @click="query_my" id="myip">{$myip}</a></div>
<div class="form-control-wrap">
<input type="text" v-model="input" placeholder="请输入IP地址或域名" class="form-control form-control-lg" @keyup.enter="query" ref="input" autocomplete="off">
</div>
</div>
<div class="form-group">
<label class="form-label" for="input">选择查询接口:</label>
<div class="form-control-wrap">
<div class="custom-control custom-radio mr-3 mt-1" v-for="(item,index) in apitypes" :key="index">
<input type="radio" class="custom-control-input" v-model="apitype" name="apitype" :id="item.key" :value="item.key">
<label class="custom-control-label" :for="item.key">{{item.title}}</label>
</div>
</div>
</div>
<button class="btn btn-dim btn-outline-primary btn-block card-link mb-3" @click="query" :disabled="query_disabled">
查询
</button>
</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>
<h6>{{result_type}} <span class="text-primary">{{result_input}}</span> 的信息:</h6>
<div class="table-responsive">
<table class="table table-hover table-bordered">
<tbody>
<tr><td class="query-title">IP地址</td><td>{{result_info.ip}}</td></tr>
<tr><td class="query-title">数字地址</td><td>{{result_info.ipnum}}</td></tr>
<tr v-for="(item,index) in result_info.data"><td class="query-title">{{index}}</td><td>{{item}}</td></tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="card card-preview">
<div class="card-inner">
<h6><em class="icon ni ni-info"></em> 简介</h6>
<div class="accordion-inner">
IP138:查询准确性<span class="text-danger">极高</span>,部分精确到县,速度快,含运营商<span class="text-success">(支持IPv6</span><br/>
高德地图:查询准确性<span class="text-danger">极高</span>,部分精确到县,速度快,含运营商、经纬度<span class="text-success">(支持IPv6</span><br/>
腾讯地图:宽带IP的查询准确性<span class="text-danger">较高</span>,部分精确到县,IDC的IP不准确,速度快<span class="text-success">(支持IPv6</span><br/>
太平洋电脑网:查询准确性<span class="text-danger">较高</span>,速度快,含运营商<span class="text-success">(支持IPv6</span><br/>
IPIP:查询准确性<span class="text-danger">极高</span>,速度快,含运营商、AS号<span class="text-success">(支持IPv6</span><br/>
IP-API:国外IP查询准确性<span class="text-danger">较高</span>,国外接口延迟高,含运营商、AS号<span class="text-success">(支持IPv6</span><br/>
宝塔:查询准确性<span class="text-danger">较高</span>,部分精确到县,速度快,含运营商、经纬度<br/>
淘宝:查询准确性<span class="text-danger">一般</span>,速度较快,有调用频率限制,含运营商<br/>
纯真:本地IP数据库,查询准确性<span class="text-danger">一般</span>,速度最快,含运营商<br/>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="script"}
<script src="{$cdn_cdnjs}vue/2.6.14/vue.min.js"></script>
<script src="{$cdn_cdnjs}jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script src="https://static.geetest.com/v4/gt4.js"></script>
<script>
new Vue({
el: '#app',
data: {
query_disabled: true,
input: '',
apitype: 'amap',
result_input: '',
result_type: 'IP',
showresult: false,
apitypes: [
{
title: '高德地图',
key: 'amap'
},
{
title: 'IP138',
key: 'ip138'
},
{
title: '腾讯地图',
key: 'tencent'
},
{
title: '太平洋',
key: 'pconline'
},
{
title: 'IPIP',
key: 'ipip'
},
{
title: 'IP-API',
key: 'ipapi'
},
{
title: '宝塔',
key: 'baota'
},
{
title: '淘宝',
key: 'taobao'
},
{
title: '百度',
key: 'baidu'
},
{
title: '纯真',
key: 'chunzhen'
},
],
result_info: {
ip: '',
ipnum: '',
data: [],
},
captcha: null
},
watch: {
'apitype'(newVal) {
$.cookie('ip_apitype',newVal)
}
},
mounted() {
this.$refs.input.focus();
if($.cookie('ip_apitype')){
this.apitype = $.cookie('ip_apitype')
}
var that=this;
initGeetest4({
captchaId: "99b142aaece96330d0f3ffb565ffb3ef",
product: 'bind',
protocol: 'https://',
riskType: 'ai',
},function (captcha) {
captcha.onReady(function(){
that.query_disabled=false;
that.captcha = captcha;
var searchip = getQueryString('ip');
if(searchip!=null){
that.input = searchip;
that.query()
}
}).onSuccess(function(){
var result = captcha.getValidate();
if (!result) {
layer.closeAll();
return alert('请先完成验证');
}
var data = {ip: that.input, apitype: that.apitype};
$.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.result_type = data.data.type == 'domain' ? '域名' : 'IP'
that.result_input = that.input;
that.showresult = true;
that.result_info = data.data;
captcha.reset();
}else{
alert(data.message);
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 = url.slice(7);
}
if (url.toLowerCase().indexOf("https://")==0){
url = url.slice(8);
}
if (url.slice(url.length-1)=="/"){
url = url.slice(0,url.length-1);
}
this.input = url;
},
query() {
this.checkURL();
if(this.input == ''){
alert('查询内容不能为空');return;
}
layer.load(0, {shade:0.1});
this.captcha.showCaptcha();
},
query_my() {
var myip = $("#myip").text();
if(myip == '') return;
this.input = myip;
layer.load(0, {shade:0.1});
this.captcha.showCaptcha();
}
},
})
</script>
{/block}
+17
View File
@@ -0,0 +1,17 @@
<?php
/**
* 数字IP地址转换
*/
namespace plugin\web\ip_num;
use app\Plugin;
class App extends Plugin
{
public function index()
{
return $this->view();
}
}
+87
View File
@@ -0,0 +1,87 @@
{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">数字IP地址转换</span>
</div>
<div class="row">
<div class="col-sm-12 col-md-4">
<div class="form-group">
<label class="form-label" for=input">输入数字地址</label>
<div class="form-control-wrap">
<textarea class="form-control" id="numip" rows="8" placeholder="一行一个或用|隔开"></textarea>
</div>
</div>
</div>
<div class="col-sm-12 col-md-4 mb-3" style="padding-top: 32px;">
<button class="btn btn-dim btn-outline-light btn-block" onclick="number_ip()">
<em class="icon ni ni-arrow-right"></em>转为IP地址
</button>
<button class="btn btn-dim btn-outline-light btn-block" onclick="ip_number()">
<em class="icon ni ni-arrow-left"></em>转为数字地址
</button>
<button class="btn btn-dim btn-outline-light btn-block" onclick="reset()">
<em class="icon ni ni-reload"></em>清空
</button>
</div>
<div class="col-sm-12 col-md-4">
<div class="form-group">
<label class="form-label" for=input">输入IP地址</label>
<div class="form-control-wrap">
<textarea class="form-control" id="orgip" rows="8" placeholder="一行一个或用|隔开"></textarea>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="script"}
<script>
function ipToint(ip){
var num = 0;
ip = ip.split(".");
num = Number(ip[0]) * 256 * 256 * 256 + Number(ip[1]) * 256 * 256 + Number(ip[2]) * 256 + Number(ip[3]);
num = num >>> 0;
return num;
}
function intTOiP(num){
var str;
var tt = new Array();
tt[0] = (num >>> 24) >>> 0;
tt[1] = ((num << 8) >>> 24) >>> 0;
tt[2] = (num << 16) >>> 24;
tt[3] = (num << 24) >>> 24;
str = String(tt[0]) + "." + String(tt[1]) + "." + String(tt[2]) + "." + String(tt[3]);
return str;
}
function number_ip(){
var numip = $("#numip").val();
numip = numip.replaceAll('~','|').replaceAll('-','|').replaceAll(/\s+/g,'|')
var result = [];
numip.split('|').forEach(element => {
if(element!='') result.push(intTOiP(element))
});
$("#orgip").val(result.join('\n'));
}
function ip_number(){
var numip = $("#orgip").val();
numip = numip.replaceAll('~','|').replaceAll('-','|').replaceAll(/\s+/g,'|')
var result = [];
numip.split('|').forEach(element => {
if(element!='') result.push(ipToint(element))
});
$("#numip").val(result.join('\n'));
}
function reset() {
$("#numip").val('');
$("#orgip").val('');
}
</script>
{/block}
+17
View File
@@ -0,0 +1,17 @@
<?php
/**
* 中文域名转码
*/
namespace plugin\web\punycode;
use app\Plugin;
class App extends Plugin
{
public function index()
{
return $this->view();
}
}
+94
View File
@@ -0,0 +1,94 @@
{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-primary btn-block card-link" @click="encode">
转码(转成Punycode
</button>
</div>
<div class="col-6">
<button class="btn btn-dim btn-outline-primary btn-block card-link" @click="decode">
解码(转成GBK)
</button>
</div>
</div>
<div class="border p-2 mt-4" v-show="result" v-html="result">
</div>
</div>
</div>
<div class="card card-preview">
<div class="card-inner">
<h6><em class="icon ni ni-info"></em> 简介</h6>
<div class="accordion-inner">
<p>中文域名在解析的时候,须转换为 xn-xxxxxxxx.xxx 形式的Punycode码。本工具支持GBK编码和Punycode编码的相互转换。</p>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="script"}
<script src="{$cdn_cdnjs}vue/2.6.14/vue.min.js"></script>
<script src="{$cdn_cdnjs}punycode/1.4.1/punycode.min.js"></script>
<script>
new Vue({
el: '#app',
data: {
input: '',
result: '',
},
methods: {
checkURL()
{
var url = this.input.trim();
if (url.indexOf(" ")>=0){
url = url.replace(/ /g,"");
}
if (url.toLowerCase().indexOf("http://")==0){
url = url.slice(7);
}
if (url.toLowerCase().indexOf("https://")==0){
url = url.slice(8);
}
if (url.slice(url.length-1)=="/"){
url = url.slice(0,url.length-1);
}
if (url.toLowerCase().indexOf("www.")==0){
url = url.slice(4);
}
this.input = url;
},
encode() {
this.checkURL();
if(this.input == ''){
alert('域名不能为空');return;
}
var new_code = punycode.toASCII(this.input);
this.result = '转码域名:'+this.input+'<br/>转码结果:'+new_code;
},
decode() {
this.checkURL();
if(this.input == ''){
alert('域名不能为空');return;
}
var new_code = punycode.toUnicode(this.input);
this.result = '解码域名:'+this.input+'<br/>解码结果:'+new_code;
},
},
})
</script>
{/block}
+115
View File
@@ -0,0 +1,115 @@
<?php
/**
* 网页源代码查看
*/
namespace plugin\web\viewhtml;
use app\Plugin;
use Exception;
class App extends Plugin
{
const ualist = [
'pc' => 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36',
'android' => 'Mozilla/5.0 (Linux; U; Android 10; zh-cn; Mi 10 Build/QKQ1.191117.002) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/10.2 Mobile Safari/537.36',
'ios' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1',
'harmonyos' => 'Mozilla/5.0 (Linux; Android 10; HarmonyOS; LYA-AL00; HMSCore 6.4.0.312; GMSCore 20.15.16) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.105 HuaweiBrowser/12.0.5.302 Mobile Safari/537.36',
'wechat' => 'Mozilla/5.0 (Linux; Android 11; M2011K2C Build/RKQ1.200928.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045713 Mobile Safari/537.36 MMWEBID/2820 MicroMessenger/8.0.11.1980(0x28000B3B) Process/tools WeChat/arm64 Weixin NetType/5G Language/zh_CN ABI/arm64',
'qq' => 'Mozilla/5.0 (Linux; Android 12; IN2010 Build/RKQ1.211119.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/97.0.4692.98 Mobile Safari/537.36 V1_AND_SQ_8.8.68_2538_YYB_D A_8086800 QQ/8.8.68.7265 NetType/4G WebP/0.4.1 Pixel/1080 StatusBarHeight/108 SimpleUISwitch/0 QQTheme/3445 InMagicWin/0 StudyMode/0 CurrentMode/0 CurrentFontScale/1.0 GlobalDensityScale/0.90000004 AppId/537112599',
'alipay' => 'Mozilla/5.0 (Linux; U; Android 11; zh-CN; MI 10 Build/RKQ1.200928.002) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/69.0.3497.100 UWS/3.22.2.19 Mobile Safari/537.36 UCBS/3.22.2.19_210818212654 NebulaSDK/1.8.100112 Nebula AlipayDefined(nt:3G,ws:411|0|2.625) AliApp(AP/10.2.30.7000) AlipayClient/10.2.30.7000 Language/zh-Hans useStatusBar/true isConcaveScreen/true Region/CN NebulaX/1.0.0 Ariver/1.0.0',
'baidu' => 'Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)',
'mbaidu' => 'Mozilla/5.0 (Linux;u;Android 4.2.2;zh-cn;) AppleWebKit/534.46 (KHTML,like Gecko) Version/5.1 Mobile Safari/10600.6.3 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)',
'google' => 'Googlebot/2.1 (+http://www.googlebot.com/bot.html)',
'qqmgr' => 'Mozilla/5.0 (Linux; U; Android 4.4.2; zh-cn; GT-I9500 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko)Version/4.0 MQQBrowser/5.0 QQ-URL-Manager',
];
public function index()
{
return $this->view();
}
public function getdata(){
$url = input('post.url', null, 'trim');
$ua = input('post.ua');
$useragent = $ua == 'diy' ? input('post.uastr', null, 'trim') : self::ualist[$ua];
$referer = input('post.referer', null, 'trim');
$post = input('post.post');
$cookie = input('post.cookie');
if(!$url) return msg('error','no url');
if(!filter_var($url,FILTER_VALIDATE_URL)){
return msg('error','输入的URL不符合规范');
}
$captcha_result = verify_captcha4();
if($captcha_result !== true){
return msg('error', '验证失败,请重新验证');
}
$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: */*";
$httpheader[] = "Accept-Language: zh-CN,zh;q=0.8";
$httpheader[] = "Connection: close";
if(!empty($post) && substr($post, 0, 1) == '{' && substr($post, -1 ,1) == '}'){
$httpheader[] = "Content-Type: application/json; charset=utf-8";
}
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
if(input('post.header')=='1'){
curl_setopt($ch, CURLOPT_HEADER, true);
}
if(!empty($referer)){
curl_setopt($ch, CURLOPT_REFERER, $referer);
}
if(!empty($cookie)){
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
if(!empty($post)){
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_POSTFIELDS, $post);
}
$data = curl_exec($ch);
$errno = curl_errno($ch);
if ($errno) {
$msg = 'Curl error: ' . curl_error($ch);
return msg('error',$msg);
}
curl_close($ch);
$data = (input('post.encoding')=='') ? $data : mb_convert_encoding($data, 'UTF-8', input('post.encoding'));
switch(input('post.text')){
case 'links':
preg_match_all("'<\s*a\s.*?href\s*=\s* # find <a href=
([\"\'])? # find single or double quote
(?(1) (.*?)\\1 | ([^\s\>]+)) # if quote found, match up to next matching
# quote, otherwise match up to next space
'isx",$data,$links);
$data = '';
foreach($links[2] as $val){
if(!empty($val)) $data .= $val."\n";
}
foreach($links[3] as $val){
if(!empty($val)) $data .= $val."\n";
}
break;
case 'form':
preg_match_all("'<\/?(FORM|INPUT|SELECT|TEXTAREA|(OPTION))[^<>]*>(?(2)(.*(?=<\/?(option|select)[^<>]*>[\r\n]*)|(?=[\r\n]*))|(?=[\r\n]*))'Usi",$data,$elements);
$data = implode("\r\n",$elements[0]);
break;
case 'text':
$data = strip_tags($data);
break;
}
return msg('ok','success',$data);
}
}
+264
View File
@@ -0,0 +1,264 @@
{extend name="common/plugin_layout" /}
{block name="title"}{$plugin.title} - {:config_get('title')}{/block}
{block name="main"}
<link href="/assets/viewhtml/prism.css" rel="stylesheet"/>
<style>
textarea.form-control{min-height: auto;}
#viewhtml{
word-break: break-all;
white-space: break-spaces;
}
</style>
<div class="container-xl" id="app">
<div class="col-md-12 col-xl-10 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 id="showform">
<div class="form-group">
<label class="form-label">URL</label>
<div class="form-control-wrap">
<textarea class="form-control" v-model="set.url" rows="3" placeholder="输入网址,带http://或https://" ref="input"></textarea>
</div>
</div>
<div class="form-group">
<label class="form-label">UserAgent</label>
<div class="form-control-wrap">
<select class="form-control" v-model="set.ua">
<option v-for="item in ualist" :value="item.key">{{item.title}}</option>
<option value="diy">自定义</option>
</select>
</div>
</div>
<div class="form-group" v-show="set.ua=='diy'" style="display:none">
<div class="form-control-wrap">
<input type="text" v-model="set.uastr" placeholder="输入要自定义的UA" class="form-control" ref="input" autocomplete="off">
</div>
</div>
<div class="form-group">
<label class="form-label">Referer:(选填)</label>
<div class="form-control-wrap">
<input type="text" v-model="set.referer" placeholder="输入要模拟的来源地址" class="form-control" ref="input" autocomplete="off">
</div>
</div>
<div class="form-group">
<label class="form-label">POST参数:(选填)</label>
<div class="form-control-wrap">
<input type="text" v-model="set.post" placeholder="user=admin&pass=123456 或json格式" class="form-control" ref="input" autocomplete="off">
</div>
</div>
<div class="form-group">
<label class="form-label">COOKIE:(选填)</label>
<div class="form-control-wrap">
<input type="text" v-model="set.cookie" placeholder="user=admin; pass=123456;" class="form-control" ref="input" autocomplete="off">
</div>
</div>
<div class="row">
<div class="col-3">
<div class="form-group">
<label class="form-label">显示内容:</label>
<div class="form-control-wrap">
<select v-model="set.text" class="form-control">
<option value="all">原始代码</option>
<option value="text">提取文字</option>
<option value="form">提取表单</option>
<option value="links">提取链接</option>
</select>
</div>
</div>
</div>
<div class="col-3">
<div class="form-group">
<label class="form-label">头部信息:</label>
<div class="form-control-wrap">
<select v-model="set.header" class="form-control">
<option value="0">不显示</option>
<option value="1">显示</option>
</select>
</div>
</div>
</div>
<div class="col-3">
<div class="form-group">
<label class="form-label">选择编码:</label>
<div class="form-control-wrap">
<select v-model="set.encoding" class="form-control">
<option>UTF-8</option>
<option>GBK</option>
<option>BIG5</option>
<option>ISO-8859-1</option>
</select>
</div>
</div>
</div>
<div class="col-3">
<div class="form-group">
<label class="form-label">代码高亮:</label>
<div class="form-control-wrap">
<select v-model="set.highlight" class="form-control">
<option value="no">不高亮</option>
<option value="yes">高亮代码</option>
</select>
</div>
</div>
</div>
</div>
<button class="btn btn-dim btn-outline-primary btn-block card-link mt-4" @click="viewhtml" :disabled="query_disabled">
查看源代码
</button>
</div>
<div id="showresult" style="display:none">
<div class="row">
<div class="col-4">
<button class="btn btn-dim btn-outline-info btn-block card-link" @click="backhome" :disabled="query_disabled">
<em class="icon ni ni-back-ios"></em>返回
</button>
</div>
<div class="col-4">
<button class="btn btn-dim btn-outline-warning btn-block card-link" @click="copyhtml" :disabled="query_disabled">
<em class="icon ni ni-copy"></em>复制
</button>
</div>
<div class="col-4">
<button class="btn btn-dim btn-outline-success btn-block card-link" @click="downhtml" :disabled="query_disabled">
<em class="icon ni ni-download"></em>下载
</button>
</div>
</div>
<div class="mt-3" v-html="output"></div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="script"}
<script src="{$cdn_cdnjs}vue/2.6.14/vue.min.js"></script>
<script src="{$cdn_cdnjs}FileSaver.js/2014-11-29/FileSaver.min.js"></script>
<script src="https://static.geetest.com/v4/gt4.js"></script>
<script src="/assets/viewhtml/prism.js"></script>
<script>
new Vue({
el: '#app',
data: {
query_disabled: true,
set: {
url: '',
ua: 'pc',
uastr: '',
referer: '',
post: '',
cookie: '',
text: 'all',
header: '0',
encoding: 'UTF-8',
highlight: 'yes',
proxy: '0',
},
ualist: [
{key: 'pc', title:'PC-Chrome'},
{key: 'android', title:'Android-Chrome'},
{key: 'ios', title:'iOS-Safari'},
{key: 'harmonyos', title:'HarmonyOS-Browser'},
{key: 'wechat', title:'WeChat'},
{key: 'qq', title:'QQ'},
{key: 'alipay', title:'AlipayClient'},
{key: 'baidu', title:'Baiduspider'},
{key: 'mbaidu', title:'Baiduspider-Mobile'},
{key: 'google', title:'Googlebot'},
{key: 'qqmgr', title:'QQ-URL-Manager'},
],
showresult: false,
html: '',
output: '',
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 = that.set;
$.ajax({
url: '/api/{$plugin.alias}/getdata',
type: 'post',
dataType: 'json',
data: Object.assign(data, result),
cache: false,
success: function (data) {
layer.closeAll();
if(data.status=='ok'){
that.showresult = true;
that.html = data.data;
that.output = '<pre><code class="language-markup" id="viewhtml">'+that.htmlEncode(data.data)+'</code></pre>';
that.$nextTick(() => {
Prism.highlightAll()
})
$("#showform").slideUp();
$("#showresult").slideDown();
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: {
viewhtml() {
if(this.set.url.trim() == ''){
layer.alert('URL不能为空');return;
}
layer.load(0, {shade:0.1});
this.captcha.showCaptcha();
},
copyhtml() {
if(this.html == '')return;
copy(this.html)
layer.msg('复制成功', {icon:1, time:600})
},
downhtml() {
if(this.html == '')return;
var fileName = (new Date()).toISOString().substr(0, 10) + ".txt";
var blob = new Blob([this.html], {type: "text/plain;charset=utf-8"});
saveAs(blob, fileName);
},
backhome() {
$("#showresult").slideUp();
$("#showform").slideDown();
},
htmlEncode(html){
var tempDiv = document.createElement('div');
(tempDiv.textContent != undefined) ? (tempDiv.textContent = html) : (tempDiv.innerText = html);
var output = tempDiv.innerHTML;
tempDiv = null;
return output;
}
},
})
</script>
{/block}
+50
View File
@@ -0,0 +1,50 @@
<?php
/**
* 域名Whois查询
*/
namespace plugin\web\whois;
use app\Plugin;
use Exception;
class App extends Plugin
{
// https://help.aliyun.com/document_detail/35793.html
const status_name = ['ok'=>'正常状态', 'addPeriod'=>'域名新注册期', 'clientDeleteProhibited'=>'注册商设置禁止删除', 'serverDeleteProhibited'=>'注册局设置禁止删除', 'clientUpdateProhibited'=>'注册商设置禁止更新', 'serverUpdateProhibited'=>'注册局设置禁止更新', 'clientTransferProhibited'=>'注册商设置禁止转移', 'serverTransferProhibited'=>'注册局设置禁止转移', 'pendingVerification'=>'注册信息审核期', 'clientHold'=>'注册商设置暂停解析', 'serverHold'=>'注册局设置暂停解析', 'inactive'=>'非激活状态', 'clientRenewProhibited'=>'注册商设置禁止续费', 'serverRenewProhibited'=>'注册局设置禁止续费', 'pendingTransfer'=>'转移过程中', 'redemptionPeriod'=>'赎回期', 'pendingDelete'=>'待删除'];
public function index()
{
return $this->view();
}
public function query(){
$domain = input('post.domain', null, 'trim');
if(!$domain) return msg('error','no domain');
if(filter_var($domain, FILTER_VALIDATE_IP)){
$type = 'ip';
}elseif(checkdomain($domain)){
$type = 'domain';
}else{
return msg('error', '域名或IP格式不正确!');
}
$captcha_result = verify_captcha4();
if($captcha_result !== true){
return msg('error', '验证失败,请重新验证');
}
$url = 'https://whois.aite.xyz/?ajax&domain='.urlencode($domain);
$data = get_curl($url,0,'https://whois.aite.xyz/');
if(!$data) return msg('error', '查询失败,接口返回内容错误');
if(strpos($data,'For more information on')){
$data = substr($data, 0, strpos($data,'For more information on'));
}
return msg('ok','success',$data);
}
}
+136
View File
@@ -0,0 +1,136 @@
{extend name="common/plugin_layout" /}
{block name="title"}{$plugin.title} - {:config_get('title')}{/block}
{block name="main"}
<style>
.query-title {
text-align: right;
}
</style>
<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 mb-3">
<div class="nya-title nk-ibx-action-item progress-rating">
<span class="nk-menu-text font-weight-bold">域名Whois查询</span>
</div>
<div class="form-group">
<label class="form-label">域名或IP</label>
<div class="form-control-wrap">
<div class="input-group">
<input type="text" v-model="input" placeholder="请输入域名或IP地址" class="form-control form-control-lg" @keyup.enter="query" ref="input" autocomplete="off">
<div class="input-group-append"><button class="btn btn-lg btn-dim btn-outline-primary text-large" @click="query" :disabled="query_disabled">查询</button></div>
</div>
</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>
<div class="border p-2" v-html="result_info" style="white-space: nowrap;overflow-x: scroll;word-break: break-all;">
</div>
</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: '',
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;
var searchdomain = getQueryString('domain');
if(searchdomain!=null){
that.input = searchdomain;
that.query()
}
}).onSuccess(function(){
var result = captcha.getValidate();
if (!result) {
layer.closeAll();
return alert('请先完成验证');
}
var data = {domain: that.input};
$.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{
alert(data.message);
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 = url.slice(7);
}
if (url.toLowerCase().indexOf("https://")==0){
url = url.slice(8);
}
if (url.slice(url.length-1)=="/"){
url = url.slice(0,url.length-1);
}
if (url.toLowerCase().indexOf("www.")==0){
url = url.slice(4);
}
this.input = url;
},
query() {
this.checkURL();
if(this.input == ''){
alert('查询内容不能为空');return;
}
layer.load(0, {shade:0.1});
this.captcha.showCaptcha();
}
},
})
</script>
{/block}