more changes to meet new naming schema
This commit is contained in:
parent
cc387609ad
commit
4453309fd0
5 changed files with 16 additions and 256 deletions
|
@ -28,7 +28,7 @@
|
|||
require_once('getdate.whois');
|
||||
require_once('genutil.whois');
|
||||
|
||||
function generic_whois ( $rawdata, $items, $dateformat='mdy' )
|
||||
function generic_whois ( $rawdata, $items, $dateformat='mdy', $hasreg=true )
|
||||
|
||||
{
|
||||
$r='';
|
||||
|
@ -62,12 +62,13 @@ while (list($key,$val)=each($rawdata))
|
|||
}
|
||||
|
||||
if (empty($r))
|
||||
$r['registered'] = 'no';
|
||||
{
|
||||
if ($hasreg) $r['registered'] = 'no';
|
||||
}
|
||||
else
|
||||
{
|
||||
$r['registered'] = 'yes';
|
||||
format_dates($r,$dateformat);
|
||||
|
||||
if ($hasreg) $r['registered'] = 'yes';
|
||||
$r=format_dates($r,$dateformat);
|
||||
}
|
||||
|
||||
return $r;
|
||||
|
|
|
@ -9,7 +9,7 @@ reset($res);
|
|||
while (list($key, $val) = each($res))
|
||||
{
|
||||
if (is_array($val))
|
||||
$res[$key]=format_dates(&$val,$format);
|
||||
$res[$key]=format_dates($val,$format);
|
||||
else
|
||||
{
|
||||
if (is_numeric($key)) continue;
|
||||
|
@ -29,6 +29,14 @@ function get_date($date,$format)
|
|||
$months=array( 'jan'=>1, 'feb'=>2, 'mar'=>3, 'apr'=>4, 'may'=>5, 'jun'=>6,
|
||||
'jul'=>7, 'aug'=>8, 'sep'=>9, 'oct'=>10, 'nov'=>11, 'dec'=>12 );
|
||||
|
||||
$parts=explode(' ',$date);
|
||||
|
||||
if (strpos($parts[0],'@')!==false)
|
||||
{
|
||||
unset($parts[0]);
|
||||
$date=implode(' ',$parts);
|
||||
}
|
||||
|
||||
$date=str_replace(',',' ',trim($date));
|
||||
$date=str_replace('.',' ',$date);
|
||||
$date=str_replace('-',' ',$date);
|
||||
|
|
172
ipw.whois
172
ipw.whois
|
@ -1,172 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
Whois2.php PHP classes to conduct whois queries
|
||||
|
||||
Copyright (C)1999,2000 easyDNS Technologies Inc. & Mark Jeftovic
|
||||
|
||||
Maintained by Mark Jeftovic <markjr@easydns.com>
|
||||
|
||||
For the most recent version of this package:
|
||||
|
||||
http://www.easydns.com/~markjr/whois2/
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* ipw.whois 1.00 David Saez 12/07/2001 */
|
||||
/* 1.01 David Saez 06/07/2002 Added support for */
|
||||
/* BRNIC, KRNIC, TWNIC and LACNIC */
|
||||
|
||||
/* Check with 218.165.121.114 (apnic) */
|
||||
/* 62.97.102.115 (ripe) */
|
||||
/* 207.217.120.54 (arin) */
|
||||
/* 200.165.206.74 (brnic) */
|
||||
/* 210.178.148.129 (krnic) */
|
||||
/* 200.44.33.31 (lacnic) */
|
||||
|
||||
if (!defined("__IPW_HANDLER__")) define("__IPW_HANDLER__",1);
|
||||
|
||||
class ipw extends Whois {
|
||||
|
||||
var $HANDLER_VERSION = "1.0";
|
||||
|
||||
var $REGISTRARS = array(
|
||||
"European Regional Internet Registry/RIPE NCC" => "whois.ripe.net",
|
||||
"RIPE Network Coordination Centre" => "whois.ripe.net",
|
||||
"Asia Pacific Network Information Center" => "whois.apnic.net",
|
||||
"Asia Pacific Network Information Centre" => "whois.apnic.net",
|
||||
"Latin American and Caribbean IP address Regional Registry" => "whois.lacnic.net"
|
||||
);
|
||||
|
||||
var $HANDLERS = array( "whois.krnic.net"=>"krnic",
|
||||
"whois.apnic.net"=>"apnic",
|
||||
"whois.ripe.net" =>"ripe",
|
||||
"whois.arin.net" =>"arin",
|
||||
"whois.registro.br" =>"bripw",
|
||||
"whois.lacnic.net"=>"lacnic"
|
||||
);
|
||||
|
||||
function ipw ($data,$query) {
|
||||
|
||||
$this->Query=$query;
|
||||
|
||||
unset($this->Query["handler"]);
|
||||
|
||||
if (!isset($this->result["rawdata"])) { $this->result["rawdata"] = array(); }
|
||||
|
||||
$this->result["regyinfo"]=array();
|
||||
$this->result["regyinfo"]["registrar"]="American Registry for Internet Numbers (ARIN)";
|
||||
|
||||
reset($this->REGISTRARS);
|
||||
|
||||
$rawdata=$data["rawdata"];
|
||||
$orgname=trim($rawdata[0]);
|
||||
if ($orgname=="") $orgname=trim($rawdata[1]);
|
||||
|
||||
while (list($string, $whois)=each($this->REGISTRARS))
|
||||
if (strstr($orgname,$string)!="")
|
||||
{ $this->Query["server"]=$whois;
|
||||
$this->result["regyinfo"]["registrar"]=$string;
|
||||
break;
|
||||
}
|
||||
|
||||
switch ($this->Query["server"])
|
||||
{ case "whois.apnic.net":
|
||||
$rawdata=$this->Lookup($this->Query["string"]);
|
||||
$rawdata=$rawdata["rawdata"];
|
||||
|
||||
while (list($ln,$line)=each($rawdata))
|
||||
{ if (strstr($line,"KRNIC whois server at whois.krnic.net"))
|
||||
{ $this->Query["server"]="whois.krnic.net";
|
||||
$this->result["regyinfo"]["registrar"]="Korea Network Information Center (KRNIC)";
|
||||
$rawdata=$this->Lookup($this->Query["string"]);
|
||||
$rawdata=$rawdata["rawdata"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "whois.arin.net":
|
||||
$newquery="";
|
||||
|
||||
while (list($ln,$line)=each($rawdata))
|
||||
{ $s=strstr($line,"(NETBLK-");
|
||||
if ($s!="")
|
||||
{ $newquery=substr(strtok($s,") "),1);
|
||||
break;
|
||||
}
|
||||
|
||||
$s=strstr($line,"(NET-");
|
||||
if ($s!="")
|
||||
{ $newquery=substr(strtok($s,") "),1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($newquery!="") $this->result["regyinfo"]["netname"]=$newquery;
|
||||
|
||||
if (strstr($newquery,"BRAZIL-BLK"))
|
||||
{ $this->Query["server"]="whois.registro.br";
|
||||
$this->result["regyinfo"]["registrar"]="Comite Gestor da Internet no Brasil";
|
||||
$rawdata=$this->Lookup($this->Query["string"]);
|
||||
$rawdata=$rawdata["rawdata"];
|
||||
$newquery="";
|
||||
}
|
||||
|
||||
if ($newquery!="")
|
||||
{ $rawdata=$this->Lookup("!".$newquery);
|
||||
$rawdata=$rawdata["rawdata"];
|
||||
}
|
||||
break;
|
||||
|
||||
case "whois.lacnic.net":
|
||||
$rawdata=$this->Lookup($this->Query["string"]);
|
||||
$rawdata=$rawdata["rawdata"];
|
||||
|
||||
while (list($ln,$line)=each($rawdata))
|
||||
{ $s=strstr($line,"at whois.registro.br and at");
|
||||
if ($s!="")
|
||||
{ $this->Query["server"]="whois.registro.br";
|
||||
$this->result["regyinfo"]["registrar"]="Comite Gestor da Internet do Brazil";
|
||||
$rawdata=$this->Lookup($this->Query["string"]);
|
||||
$rawdata=$rawdata["rawdata"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$rawdata=$this->Lookup($this->Query["string"]);
|
||||
$rawdata=$rawdata["rawdata"];
|
||||
}
|
||||
|
||||
$this->result["rawdata"]=$rawdata;
|
||||
$this->result["regyinfo"]["whois"]=$this->Query["server"];
|
||||
|
||||
if ($this->HANDLERS[$this->Query["server"]]!="")
|
||||
$this->Query["handler"] = $this->HANDLERS[$this->Query["server"]];
|
||||
|
||||
if (!empty($this->Query["handler"]))
|
||||
{ $this->Query["file"]=sprintf("whois.ip.%s.php", $this->Query["handler"]);
|
||||
$this->result["regrinfo"]=$this->Process($this->result["rawdata"]);
|
||||
}
|
||||
|
||||
$this->result["regrinfo"]["network"]["host_ip"]=$this->Query["host_ip"];
|
||||
$this->result["regrinfo"]["network"]["host_name"]=$this->Query["host_name"];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
2
test.txt
2
test.txt
|
@ -60,7 +60,7 @@ biz neulevel.biz
|
|||
|
||||
apnic 218.165.121.114
|
||||
arin 207.217.120.54
|
||||
bripw 200.165.206.74
|
||||
bripw
|
||||
krnic 210.178.148.129
|
||||
lacnic 200.44.33.31
|
||||
ripe 62.97.102.115
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
<?php
|
||||
/*
|
||||
Whois2.php PHP classes to conduct whois queries
|
||||
|
||||
Copyright (C)1999,2000 easyDNS Technologies Inc. & Mark Jeftovic
|
||||
|
||||
Maintained by Mark Jeftovic <markjr@easydns.com>
|
||||
|
||||
For the most recent version of this package:
|
||||
|
||||
http://www.easydns.com/~markjr/whois2/
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* bripw.whois 1.0 David Saez 04/04/2003 */
|
||||
|
||||
require_once("generic.whois");
|
||||
|
||||
if(!defined("__BRIPW_HANDLER__")) define("__BRIPW_HANDLER__",1);
|
||||
|
||||
class bripw extends ipw {
|
||||
|
||||
function bripw($data)
|
||||
{
|
||||
$this->result=$this->parse($data);
|
||||
}
|
||||
|
||||
function parse ($data_str)
|
||||
{
|
||||
$translate = array (
|
||||
"fax-no" => "fax",
|
||||
"e-mail" => "email",
|
||||
"nic-hdl-br" => "handle",
|
||||
"person" => "name",
|
||||
"netname" => "name"
|
||||
);
|
||||
|
||||
$contacts = array (
|
||||
"owner-c" => "owner",
|
||||
"tech-c" => "tech",
|
||||
"abuse-c" => "abuse"
|
||||
);
|
||||
|
||||
$r = generic_whois($data_str,$translate,$contacts,"network");
|
||||
|
||||
unset($r["network"]["owner"]);
|
||||
unset($r["network"]["ownerid"]);
|
||||
unset($r["network"]["responsible"]);
|
||||
unset($r["network"]["address"]);
|
||||
unset($r["network"]["phone"]);
|
||||
$r["network"]["handle"]=$r["network"]["aut-num"];
|
||||
unset($r["network"]["aut-num"]);
|
||||
unset($r["network"]["nsstat"]);
|
||||
unset($r["network"]["nslastaa"]);
|
||||
unset($r["network"]["inetrev"]);
|
||||
|
||||
if (isset($r["network"]["nserver"]))
|
||||
$r["network"]["nserver"]=array_unique($r["network"]["nserver"]);
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
Loading…
Reference in a new issue