diff --git a/app/controller/DnsController.php b/app/controller/DnsController.php new file mode 100644 index 0000000..ae853b5 --- /dev/null +++ b/app/controller/DnsController.php @@ -0,0 +1,47 @@ +ip2bin($ip); + */ + +class DnsController +{ + public function DNS($type,$name,$rip,$id,$query) + { + #输出信息 + #echo "\n Type:$type \n Domain: $name\n Client IP: $rip \n"; + + + #此处请根据业务需要,通过判断$name和$rip返回正确的数据 + #详情请参见 https://github.com/ywnsya/workerman-dns 尤其是 https://github.com/ywnsya/Workerman-DNS/blob/master/start.php 中的用法 + + if($type=='PTR'){ + $send['detail']='dns.laysense.com'; + $send['ttl']=30; + $send['type']='PTR'; + } + if($type=='A'){ + $send['type']='A'; + $send['detail'][1]='119.29.29.29'; + $send['detail'][2]='8.8.8.8'; + $send['ttl']=30; + }; + if($type=='AAAA'){ + $ipv6=new IPv6; + $send['type']='AAAA'; + $send['detail'][1]=bin2hex($ipv6->ip2bin("fe80::2c5f")); #此操作可以还原被简化的IPv6地址 协议内不再对IPv6地址进行处理,请按照本方式传递16进制无":"的完整16位IPv6 + $send['detail'][2]=bin2hex($ipv6->ip2bin("2001:0:2851:b9d0:2c5f:f0d9:21be:4b96")); + $send['ttl']=600; + } + + #此处无需修改 + $send['id']=$id; + $send['query']=$query; + $return=json_encode($send); + return $return; + } +} \ No newline at end of file diff --git a/app/controller/api.php b/app/controller/api.php index 37998ef..505999a 100644 --- a/app/controller/api.php +++ b/app/controller/api.php @@ -11,12 +11,11 @@ use yzh52521\EasyHttp\Http; use yzh52521\EasyHttp\Response; use yzh52521\EasyHttp\RequestException; - class api { public function search(Request $request) { - $content=$request->input('content','0'); + $content=trim($request->input('content','0')); $contenttype=v::ip()->validate($content); if(!$contenttype){ $contenttype=v::domain(false)->validate($content); @@ -25,20 +24,23 @@ class api }else{ $contenttype='domain'; $msg['DNS']=dns_get_record("$content",DNS_ANY); + $msg['IP']=gethostbyname("$content"); + exec("whois $content",$msg['WHOIS']); + /** $whois = Http::get('https://api.devopsclub.cn/api/whoisquery?type=json&standard=true', ['domain' => "$content"])->body(); $whois=json_decode($whois); - if($whois->code !=0){ - $msg['Whois']='Whois查询失败'; - }; - if($whois->data->status !=0){ - $msg['Whois']='Whois查询出错,请稍后重试'; - }; - if($whois->data->status ==2 || $whois->data->status ==3 ){ - $msg['Whois']='该域名未注册或该后缀暂不支持查询'; - }; - if($whois->code == 0 && $whois->data->status == 0){ - $msg['Whois']=$whois->data->data; - } + if($whois->code !=0){ + $msg['Whois']='Whois查询失败'; + }; + if($whois->data->status !=0){ + $msg['Whois']='Whois查询出错,请稍后重试'; + }; + if($whois->data->status ==2 || $whois->data->status ==3 ){ + $msg['Whois']='该域名未注册或该后缀暂不支持查询'; + }; + if($whois->code == 0 && $whois->data->status == 0){ + $msg['Whois']=$whois->data->data; + } $safe = Http::get('https://api.devopsclub.cn/api/dcheck', ['url' => "$content"])->body(); $safe=json_decode($safe); if($safe->code == 0){ @@ -46,6 +48,7 @@ class api $msg['Wx-Safe']=$safe->data->wx; $msg['QQ-Safe']=$safe->data->qq; } + **/ } }else{ $contenttype='ip'; diff --git a/app/view/common_head.html b/app/view/common_head.html index 55021fe..dccaf06 100644 --- a/app/view/common_head.html +++ b/app/view/common_head.html @@ -269,7 +269,7 @@ data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> name);?> + src="email ))));?>">