This commit is contained in:
net909
2024-04-03 21:29:42 +08:00
parent 9fd3a7d3b7
commit 9e3f934701
40 changed files with 342 additions and 1060 deletions
+76 -1
View File
@@ -28,7 +28,7 @@ class App extends Plugin
try{
if($type == 'wx'){
$msg = $this->query_wx($link);
$msg = $this->query_wx2($link);
}else{
$msg = $this->query_qq($link);
}
@@ -39,6 +39,21 @@ class App extends Plugin
return msg('ok','success',$msg);
}
public function queryqq(){
$link = input('post.url', null, 'trim');
$randstr = input('post.randstr', null, 'trim');
$ticket = input('post.ticket', null, 'trim');
if(!$link) return msg('error','no url');
try{
$msg = $this->query_qq_new($link, $ticket, $randstr);
}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);
@@ -97,7 +112,53 @@ class App extends Plugin
}
}else{
$msg['检测URL'] = $link;
$msg['查询失败'] = $arr['data'];
}
return $msg;
}
private function query_qq_new($link, $ticket, $randstr){
$url='https://cgi.urlsec.qq.com/index.php?m=check&a=gw_check&callback=url_query&url='.urlencode($link).'&ticket='.$ticket.'&randstr='.urlencode($randstr).'&_='.time().'123';
$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'] = $link;
$msg['查询失败'] = $arr['data'];
}
@@ -129,6 +190,20 @@ class App extends Plugin
return $msg;
}
private function query_wx2($link){
$url = 'https://cgi.urlsec.qq.com/index.php?m=url&a=validUrl&url='.urlencode($link);
$data = get_curl($url);
$arr = json_decode($data, true);
if(!$arr) throw new Exception('查询接口返回数据解析失败');
$msg['检测URL'] = $link;
if(isset($arr['data']) && $arr['data']=='ok'){
$msg['微信拦截状态'] = '<font color="red">已拦截</font>';
}else{
$msg['微信拦截状态'] = '<font color="green">未拦截</font>';
}
return $msg;
}
private function guanjia_curl($url)
{
$ch = curl_init();
+41 -2
View File
@@ -16,7 +16,7 @@
</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">
<button class="btn btn-dim btn-outline-info btn-block btn-lg card-link" @click="queryqq()" :disabled="query_disabled">
查询管家&QQ拦截
</button>
</div>
@@ -44,6 +44,7 @@
{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 src="https://ssl.captcha.qq.com/TCaptcha.js"></script>
<script>
new Vue({
el: '#app',
@@ -53,7 +54,8 @@ new Vue({
type: '',
showresult: false,
result_info: [],
captcha: null
captcha: null,
captcha1: null,
},
mounted() {
this.$refs.input.focus();
@@ -101,6 +103,36 @@ new Vue({
alert('验证码加载失败,请刷新页面重试');
})
});
var tcaptchaCallback = function(res){
if (res.ret === 0) {
layer.load(0, {shade:0.1});
var data = { url: that.input, ticket: res.ticket, randstr: res.randstr};
$.ajax({
url: '/api/{$plugin.alias}/queryqq',
type: 'post',
dataType: 'json',
data: data,
cache: false,
success: function (data) {
layer.closeAll();
if(data.status=='ok'){
that.showresult = true;
that.result_info = data.data;
}else{
layer.alert(data.message, {icon: 5});
}
},
error: function () {
layer.closeAll();
layer.msg('服务器错误', {icon: 5});
}
});
}else{
layer.msg('请先完成验证',{time:800,icon:2});
}
}
this.captcha1 = new TencentCaptcha('2046626881', tcaptchaCallback);
},
methods: {
checkURL()
@@ -123,6 +155,13 @@ new Vue({
this.type = type;
this.captcha.showCaptcha();
},
queryqq(){
if(this.input.trim() == ''){
layer.alert('要查询的网址不能为空');return;
}
this.checkURL();
this.captcha1.show();
}
},
})
</script>
+28 -109
View File
@@ -22,7 +22,7 @@ class App extends Plugin
public function query(){
$domain = input('post.domain', null, 'trim');
if(!$domain) return msg('error','no domain');
if(strpos($domain,'.') && !checkdomain($domain)){
if(!checkdomain($domain)){
return msg('error', '域名格式不正确!');
}
@@ -31,129 +31,48 @@ class App extends Plugin
return msg('error', '验证失败,请重新验证');
}
$cache = Db::name('querycache')->where('type', 'icplist')->where('key|subkey', $domain)->find();
$cache = Db::name('querycache')->where('type', 'icp')->where('key', $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]]);
return msg('ok','success',$array);
}
try{
$result = $this->execapi($domain);
$result = $this->queryapi($domain);
if(!$result){
return msg('ok','success',null);
}
}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;
}
Db::name('querycache')->duplicate([
'type' => 'icp',
'key' => $result['Domain'],
'content' => json_encode($result),
'uptime' => date('Y-m-d H:i:s')
])->insert([
'type' => 'icp',
'key' => $result['Domain'],
'content' => json_encode($result),
'uptime' => date('Y-m-d H:i:s')
]);
return msg('ok','success',['total'=>$result['total'], 'list'=>$result['data']]);
return msg('ok','success',$result);
}
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, 1, 0, 0, $headers);
$body = substr($response, strpos($response, '{"'));
$arr = json_decode($body, true);
if(isset($arr['code']) && $arr['code']==200){
$cookie = '';
preg_match_all('/set-cookie: (.*?);/i', $response, $matchs);
foreach ($matchs[1] as $val) {
if(substr($val,-1)=='=')continue;
$cookie.=$val.'; ';
}
$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, $cookie, 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)请求失败');
}
private function queryapi($domain){
$url = config_get('qqapi_url').'api.php?act=icpquery';
$post = 'key='.config_get('qqapi_key').'&domain='.$domain;
$data = get_curl($url, $post);
$arr = json_decode($data, true);
if(isset($arr['code']) && $arr['code']==0){
return $arr['data'];
}elseif(isset($arr['msg'])){
throw new Exception($arr['msg']);
}else{
throw new Exception('查询接口(auth)请求失败');
throw new Exception('接口请求失败');
}
}
}
+23 -71
View File
@@ -2,22 +2,19 @@
{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{text-align: center;}
</style>
<div class="container-xl" id="app">
<div class="col-md-12 col-xl-10 center-block">
<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">ICP备案查询</span>
</div>
<div class="form-group">
<label class="form-label">输入域名/备案号/单位名称</label>
<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">
<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">
@@ -30,48 +27,20 @@
<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="alert alert-warning text-center" v-if="result_code==0"><h6><em class="icon ni ni-info"></em> 没有查询到备案信息</h6></div>
<div class="col-sm-12 col-md-10 col-xl-8 center-block" v-if="result_code==1">
<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>
<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">备案</td><td>{{result_info.DomainIcpNum}}</td></tr>
<tr><td class="query-title">主办单位名称</td><td>{{result_info.CompanyName}}</td></tr>
<tr><td class="query-title">主办单位性质</td><td>{{result_info.CompanyType}}</td></tr>
<tr><td class="query-title">审核日期</td><td>{{result_info.AuditTime}}</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>
@@ -86,21 +55,9 @@ new Vue({
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,
result_info: [],
result_code: 0,
captcha: null
},
mounted() {
@@ -136,13 +93,12 @@ new Vue({
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];
if(data.data == null){
that.result_code = 0;
}else{
that.result_code = 1;
that.result_info = data.data;
}
captcha.reset();
}else{
@@ -184,15 +140,11 @@ new Vue({
},
query() {
this.checkURL();
if(this.input == ''){
if(this.input.trim() == ''){
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;
}
},
})
-12
View File
@@ -1,12 +0,0 @@
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
@@ -1,165 +0,0 @@
# -*- 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
@@ -1,34 +0,0 @@
# -*- 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)