New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

geoipasn

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geoipasn

GeoIP query tool with AS number


Version published
Weekly downloads
1
decreased by-80%
Maintainers
1
Weekly downloads
 
Created

GeoIPASN

GeoIP query tool with AS Number

GeoIP data from geoip-lite using MaxMind's GeoLite2 database

ASN data from APNIC (data-raw-table) (data-used-autnums)

Update GeoLite2 database to better results

cd node_modules/geoip-lite
npm run-script updatedb license_key=[KEY]

You can get free license key in MaxMind

Table of Content

Installation

npm i geoipasn

Usage

GeoIP Info

ESM

import geoip from 'geoipasn';

const data = geoip('12.34.56.78');
console.log(data);

CJS

const geoip = require('geoipasn').default;

const data = geoip('12.34.56.78');
console.log(data);
Result
{
  ip: '12.34.56.78',
  country: { code: 'US', name: 'United States of America' },
  region: 'Ohio',
  city: 'Dayton',
  coordinate: { latitude: 39.6438, longtitude: -84.1743, range: 5 },
  timezone: 'America/New_York',
  time: 2022-09-24T02:47:59.000Z,
  as: { number: 7018, name: 'ATT-INTERNET4' },
  service: ''
}

AS Number

// Get AS number of IP
const data = geoip.asn('12.34.56.78');
console.log(data);
Result
{ ip: '12.34.56.78', number: 7018, name: 'ATT-INTERNET4' }

Command Line

cd node_modules/geoipasn
npm run query [ip]

Example

npm run query 12.34.56.78
Result
Running geoipasn at 2022-09-24T13:15:21.226Z

query   : 12.34.56.78
dns     : 8.8.8.8
ip      : 93.184.216.34

scan    : 1024 ports
open    : [80,443]
reset   : []
close   : [1119,1935]
filtered: 1020 ports

80      open    http
443     open    https
1119    close   bnetgame
1935    close   macromedia-fcs

API

geoip

geoip(ip);

target: string [host]:<port|ports>

target ports:
:80: target port 80
:80,90,100: target port 80, 90 and 100
:80-100: target port in range 80 to 100
:22,80-100,443: target port 22, port in range 80 to 100 and port 443
:@: target most used 1024 ports
:*: target all ports (same as :1-65535)

options: Object
  options.protocol: string <tcp|udp>
  options.filterBogon: boolean
  options.dnsServer: string <server>

ping

ping.tcp(target, options);
ping.udp(host, port, options);

host: string [host]
port: number <port>
options: Object
  options.timeout: number <miliseconds>
  options.filterBogon: boolean
  options.dnsServer: string <server>

scan

ping.scan(host, ports, options);

host: string [host]
ports: Array <ports>
options: Object
  options.timeout: number <miliseconds>
  options.chunk: number <chunk>
  options.protocol: string <tcp|udp>
  options.filterBogon: boolean
  options.dnsServer: string <server>

FAQs

Package last updated on 25 Sep 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