search
Homephp教程PHP源码IPwhois查询,域名whois查询

<script>ec(2);</script>


IP/域名WHOIS查询





IP/域名:




require_once $_SERVER['DOCUMENT_ROOT'].'/ad/mid.php';
if($q2''){
 if($isdomain){
  echo '
';
  echo '
查询结果
';
  echo '
';
  // Server List File
  $config['server_list'] = "./whois/servers.lst";
  whois($domain);
  echo '
';
  echo '
';
 }elseif($isip){
  echo '
';
  echo '
查询结果
';
  echo '
';
  $sourcecode=getsourcecode("http://wq.apnic.net/apnic-bin/whois.pl?searchtext=".$q);
  //echo $sourcecode;
  preg_match('/(
<b><u>.*?)<div class="highlight" id="key">/s', $sourcecode, $ipwhois);<br>
  $result=$ipwhois[1];<br>
  $result=nl2br($result);<br>
  echo $result;<br>
  echo '</div>';<br>
  echo '</u></b>
';
 }else{
  echo '
';
  echo '
Error!
';
  echo '

Error!请确保你输入的不是域名(中文域名暂不支持)就是IP,你要是输入的是电话号码之类那我们真查不了!

';
  echo '
';
  echo '
';
 }
}else{
  echo '
';
  echo '
工具说明
';
  echo '

请输入IP或域名,如chaxun.la或xxx.xxx.xxx.xxx

';
  echo '
';
  echo '
';
}
function whois() {
 global $domain;
 if(!$server = get_server()) {
  die("无法查询此类型的域名");
 }
  $result = whois_request($server['server'], $domain);
  if(!$result) {
   echo "无法连接服务器";
   die();
  }
  $server['info']=trim($server['info']);
  if($server['info']){
   $he = strpos($result,$server['info']) + strlen($server['info']);
   $le = strpos($result, " ", $he);
   $whois_server = trim(substr($result, $he, $le-$he));
   $result2 = whois_request($whois_server, $domain);
   if($result2){
    echo nl2br($result." 以下信息来自:".$whois_server." ".$result2);
   }else {
    echo nl2br($result);
   }
  }else {
   echo nl2br($result);
  }
}
/*function whois() {
 global $domain;
 if(!$server = get_server()) {
  echo "无法查询此类型的域名";
 }else{
  $result = whois_request($server['server'], $domain);
  if(!$result) {
   echo "无法连接服务器";
  } else {
   echo $result;
  }
 }
}
*/
function whois_request($server, $query)
{
    $data = "";
 if(!$fp = @fsockopen($server, 43)) {
  Return false;
 } else {
  fputs($fp, $query . " ");
        while (!feof($fp)) {
            $data .= fread($fp, 1000);
        }
        fclose($fp);
 }
    //return nl2br($data);
 return $data;
}

function get_server() {
 global $config,$domain;
 $serverarray = file($config['server_list']);
 $i = 0;
 foreach($serverarray as $key=>$val) {
  if(substr($val,0,1) != "#") {
   $server_p = explode("|",$val);
   $server[$i]['tld'] = $server_p[0];
   $server[$i]['server'] = $server_p[1];
   $server[$i]['avail'] = $server_p[2];
   $server[$i]['infoserver'] = $server_p[3];
   $server[$i]['backserver'] = $server_p[4];
   $server[$i]['info'] = $server_p[5];
  }
  $i++;
 }

 $domain_c = explode(".",$domain);
 $partnum = count($domain_c);
 $last_part_1 = $domain_c[$partnum-1];
 $last_part_2 = $domain_c[$partnum-2];
 
 foreach($server as $key=>$val) {
  if($val['tld'] == $last_part_2.".".$last_part_1) {
   Return $val;
  } elseif($val['tld'] == $last_part_1) {
   Return $val;
  }
 }
 Return false;
}

$q=trim($_GET['q']);
$q2=$q;
if($q''){
if($q=matchip($q2)){
  $isip=1;
 }elseif($q=matchdomain($q2)){
  $domain=topdomain($q2);
  $isdomain=1;
 }
}IPwhois查询,域名whois查询

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.