🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

asn-from-ip

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asn-from-ip

Find rich ASN information for each IP address. The output includes IP suffixes, AS type, AS country, AS organisation and so on...

1.0.0
npm
Version published
Weekly downloads
7
133.33%
Maintainers
1
Weekly downloads
 
Created
Source

IP to ASN

This tiny package allows you to obtain ASN meta information for any IP address. Some IP addresses are of course not assigned to an ASN.

Installation

npm install ip_to_asn

If you want to clone the repository directly from GitHub instead:

git clone git@github.com:ipapi-is/ip_to_asn.git

Usage

Lookup the IP address 144.168.164.55:

const { ipToASN } = require('ip_to_asn');

(async () => {
  console.log(await ipToASN('144.168.164.55'));
})();

which outputs (at the time of writing):

{
  asn: 55286,
  route: '144.168.160.0/21',
  descr: 'SERVER-MANIA, CA',
  country: 'ca',
  active: true,
  org: 'B2 Net Solutions Inc.',
  domain: 'www.servermania.com',
  abuse: 'support@servermania.com',
  type: 'hosting',
  created: '2013-05-16',
  updated: '2013-05-16',
  rir: 'arin',
  whois: 'https://ipapi.is/json/?whois=AS55286'
}

Most IP addresses can be associated with an Autonomeous System (AS). The return value of ipToASN() is an object with the following attributes:

  • asn - int - The AS number
  • route - string - The IP route as CIDR in this AS
  • descr - string - An informational description of the AS
  • country - string - The country where the AS is situated in (administratively)
  • active - string - Whether the AS is active (active = at least one route administred by the AS)
  • domain - string - The domain of the organization to which this AS belongs
  • org - string - The organization responisible for this AS
  • type - string - The type for this ASN, this is either hosting, education, goverment, banking, business or isp
  • created - string - When the ASN was established
  • updated - string - The last time the ASN was updated
  • rir - string - To which Regional Internet Registry the ASN belongs
  • whois - string - An url to the whois information for this ASN

For inactive autonomeous systems, most of the above information is not available.

Keywords

ASN

FAQs

Package last updated on 09 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts