
Product
A New Overview in our Dashboard
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
asn-from-ip
Advanced tools
This tiny module allows you to get ASN information for each IP address. The output includes IP suffixes, AS type, AS country, AS organisation and so on...
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.
npm install asn-from-ip
If you want to clone the repository directly from GitHub instead:
git clone git@github.com:ipapi-is/ip_to_asn.git
Lookup the IP address 95.91.211.148
:
const { ipToASN } = require('asn-from-ip');
(async () => {
console.log(await ipToASN('95.91.211.148'));
})();
which outputs (at the time of writing):
{
asn: 3209,
route: '95.88.0.0/14',
descr: 'VODANET International IP-Backbone of Vodafone, DE',
country: 'de',
active: true,
org: 'Vodafone GmbH',
domain: 'vodafone.com',
abuse: 'abuse.de@vodafone.com',
type: 'isp',
created: '2002-09-11',
updated: '2023-10-12',
rir: 'ripe',
whois: 'https://api.ipapi.is/?whois=AS3209'
}
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 numberroute
- string
- The IP route as CIDR in this ASdescr
- string
- An informational description of the AScountry
- 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 belongsorg
- string
- The organization responisible for this AStype
- string
- The type for this ASN, this is either hosting
, education
, goverment
, banking
, business
or isp
created
- string
- When the ASN was establishedupdated
- string
- The last time the ASN was updatedrir
- string
- To which Regional Internet Registry the ASN belongswhois
- string
- An url to the whois information for this ASNFor inactive autonomeous systems, most of the above information is not available.
Copy the browser JavaScript bundle to your preferred location. After installing the module with
npm install asn-from-ip
you can find the minified JavaScript here: node_modules/asn-from-ip/dist/ipToASN.min.js
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>IP to ASN Example Browser</title>
<meta name="description" content="IP to ASN Example">
<meta name="author" content="ipapi.is">
</head>
<body>
<pre id="asn"></pre>
<script type="text/javascript" src="dist/ipToASN.min.js"></script>
<script type="text/javascript">
ipToASN('95.91.211.148').then((res) => {
document.getElementById('asn').innerText = JSON.stringify(res, null, 2);
});
</script>
</body>
</html>
This package uses the ipapi.is API in order to avoid shipping a huge database in the npm module. If you have a large volume of IP addresses to lookup, you can download the full & free ASN Database.
GitHub mirror of the database: ASN Database Mirror
FAQs
This tiny module allows you to get ASN information for each IP address. The output includes IP suffixes, AS type, AS country, AS organisation and so on...
The npm package asn-from-ip receives a total of 18 weekly downloads. As such, asn-from-ip popularity was classified as not popular.
We found that asn-from-ip demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.