added extra abuse email address detection

This commit is contained in:
sparc 2005-08-29 12:06:59 +00:00
parent adcee12873
commit 6f34e8987f
3 changed files with 25 additions and 1 deletions

View file

@ -7,6 +7,8 @@
- added nice HTML output capabilities to
whois.utils.php
- fixed whois.ip.php
- added extra abuse email address detection
for whois.ip.php
2005/08/26 David Saez <david@ols.es>
- code cleanup and formatting

View file

@ -185,6 +185,8 @@ class ip_handler extends WhoisClient
$result['regrinfo'] = $this->Process($result['rawdata']);
}
// Arrange inetnum/cdir
if (isset($result['regrinfo']['network']['inetnum']) && strpos($result['regrinfo']['network']['inetnum'], '/') != false)
{
//Convert CDIR to inetnum
@ -198,6 +200,24 @@ class ip_handler extends WhoisClient
$result['regrinfo']['network']['inetnum'] = $this->cidr_conv($result['regrinfo']['network']['cdir']);
}
// Try to find abuse email address
if (!isset($result['regrinfo']['abuse']['email']))
{
reset($result['rawdata']);
while (list($key, $line) = each($result['rawdata']))
{
$email_regex = "/([-_\w\.]+)(@)([-_\w\.]+)\b/i";
if (strpos($line,'abuse') !== false && preg_match($email_regex,$line,$matches)>0)
{
$result['regrinfo']['abuse']['email'] = $matches[0];
break;
}
}
}
//Check if Referral rwhois server has been reported
if (isset($result['regrinfo']['rwhois']))

View file

@ -135,9 +135,11 @@ class utils extends Whois {
function showHTML($result) {
$email_regex = "/([-_\w\.]+)(@)([-_\w\.]+)\b/i";
$out = implode($result['rawdata'],"\n");
$out = preg_replace ("/([\w\.]+)(@)([\w\.-]+)\b/i", '<a href="mailto:$0">$0</a>', $out);
$out = preg_replace ($email_regex, '<a href="mailto:$0">$0</a>', $out);
if (isset($result['regrinfo']['domain']['nserver']))
{