parse whois improvements
This commit is contained in:
parent
afe573c97a
commit
bc895b23e8
|
@ -27,12 +27,24 @@ function cIDRofWhois(ip, whoisData) {
|
|||
*/
|
||||
function orgFromWhois(whoisData) {
|
||||
return (whoisData.organisation && whoisData.organisation['org-name'])
|
||||
|| (whoisData.organisation && whoisData.organisation.OrgName)
|
||||
|| (whoisData['Contact Master']
|
||||
&& whoisData['Contact Master'].address.split('\n')[0])
|
||||
|| whoisData.netname
|
||||
|| 'N/A';
|
||||
}
|
||||
|
||||
/*
|
||||
* get counry from whois return
|
||||
* @param whois whois return
|
||||
* @return organisation string
|
||||
*/
|
||||
function countryFromWhois(whoisData) {
|
||||
return whoisData.country
|
||||
|| (whoisData.organisation && whoisData.organisation.Country)
|
||||
|| 'xx';
|
||||
}
|
||||
|
||||
/*
|
||||
* parse whois return
|
||||
* @param ip ip string
|
||||
|
@ -42,7 +54,7 @@ function orgFromWhois(whoisData) {
|
|||
function parseWhois(ip, whoisData) {
|
||||
return {
|
||||
ip,
|
||||
country: whoisData.country || 'xx',
|
||||
country: countryFromWhois(whoisData),
|
||||
cidr: cIDRofWhois(ip, whoisData),
|
||||
org: orgFromWhois(whoisData),
|
||||
descr: whoisData.descr || 'N/A',
|
||||
|
|
Loading…
Reference in New Issue
Block a user