some improvments on AS queries
This commit is contained in:
parent
74c9f72ecd
commit
7103134fa1
5 changed files with 25 additions and 23 deletions
|
@ -5,6 +5,7 @@
|
|||
- added handler.template.php
|
||||
- disclaimer updated
|
||||
- updated README file
|
||||
- some improvments for AS queries
|
||||
|
||||
2005/07/26 David Saez <david@ols.es>
|
||||
- added handler for za.org & za.net, thanx to
|
||||
|
|
|
@ -57,15 +57,12 @@ the following subkeys:
|
|||
|
||||
network
|
||||
-------
|
||||
Only when dealing with ip addresses. Could contain the
|
||||
Only when dealing with ip addresses or AS. Could contain the
|
||||
following subkeys:
|
||||
|
||||
name -> network name
|
||||
name -> network/AS name
|
||||
inetnum -> network ip address range
|
||||
desc -> network description
|
||||
host_ip -> ip address that was tested
|
||||
host_name> host name obtained doing reverse dns
|
||||
lookup on host_ip
|
||||
mnt-by -> who provided that network
|
||||
mnt-lower> who provided that network
|
||||
nserver -> name servers in listed order that
|
||||
|
@ -74,7 +71,7 @@ the following subkeys:
|
|||
remarks -> remarks provided by the registry
|
||||
changed -> date of last change
|
||||
created -> creation date
|
||||
handle -> domain handle
|
||||
handle -> network/AS handle
|
||||
source -> who gives this information
|
||||
|
||||
owner,admin,tech,zone,billing,abuse
|
||||
|
|
|
@ -50,6 +50,10 @@ function parse ($data_str)
|
|||
"network.desc." => "Comment:",
|
||||
"network.created" => "RegDate:",
|
||||
"network.changed" => "Updated:",
|
||||
'network.handle' => 'ASHandle:',
|
||||
'network.name' => 'ASName:',
|
||||
'network.handle' => 'NetHandle:',
|
||||
'network.name' => 'NetName:',
|
||||
"tech.handle" => "TechHandle:",
|
||||
"tech.name" => "TechName:",
|
||||
"tech.phone" => "TechPhone:",
|
||||
|
@ -60,7 +64,7 @@ function parse ($data_str)
|
|||
"abuse.email" => "OrgAbuseEmail:"
|
||||
);
|
||||
|
||||
return generic_parser_b($data_str,$items);
|
||||
return generic_parser_b($data_str,$items,'ymd',false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -193,38 +193,35 @@ if (!isset($result['regrinfo']['network']['inetnum']) &&
|
|||
$result['regrinfo']['network']['inetnum']=$this->cidr_conv($result['regrinfo']['network']['cdir']);
|
||||
}
|
||||
|
||||
$result["regrinfo"]["network"]["host_ip"]=$this->Query["host_ip"];
|
||||
$result["regrinfo"]["network"]["host_name"]=$this->Query["host_name"];
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
function cidr_conv($net)
|
||||
{
|
||||
$start=strtok($net,'/');
|
||||
$n=3-substr_count($net, '.');
|
||||
{
|
||||
$start=strtok($net,'/');
|
||||
$n=3-substr_count($net, '.');
|
||||
|
||||
if ($n>0)
|
||||
{
|
||||
for ($i=$n;$i>0;$i--)
|
||||
$start.='.0';
|
||||
}
|
||||
|
||||
$bits1=str_pad(decbin(ip2long($start)),32,'0','STR_PAD_LEFT');
|
||||
$net=pow(2,(32-substr(strstr($net,'/'),1)))-1;
|
||||
|
||||
$bits1=str_pad(decbin(ip2long($start)),32,'0','STR_PAD_LEFT');
|
||||
$net=pow(2,(32-substr(strstr($net,'/'),1)))-1;
|
||||
$bits2=str_pad(decbin($net),32,'0','STR_PAD_LEFT');
|
||||
$final='';
|
||||
|
||||
|
||||
for ($i=0;$i<32;$i++)
|
||||
{
|
||||
if ($bits1[$i]==$bits2[$i]) $final.=$bits1[$i];
|
||||
if ($bits1[$i]==1 and $bits2[$i]==0) $final.=$bits1[$i];
|
||||
if ($bits1[$i]==0 and $bits2[$i]==1) $final.=$bits2[$i];
|
||||
{
|
||||
if ($bits1[$i]==$bits2[$i]) $final.=$bits1[$i];
|
||||
if ($bits1[$i]==1 and $bits2[$i]==0) $final.=$bits1[$i];
|
||||
if ($bits1[$i]==0 and $bits2[$i]==1) $final.=$bits2[$i];
|
||||
}
|
||||
|
||||
return $start." - ".long2ip(bindec($final));
|
||||
|
||||
return $start." - ".long2ip(bindec($final));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
3
test.txt
3
test.txt
|
@ -65,3 +65,6 @@ krnic 210.178.148.129
|
|||
lacnic 200.44.33.31
|
||||
ripe 62.97.102.115
|
||||
|
||||
// ASN
|
||||
|
||||
arin AS220
|
||||
|
|
Loading…
Reference in a new issue