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