You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

dbip

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dbip

This simple module will return information about an IP address. Yay!

1.0.0
latest
npm
Version published
Weekly downloads
2
-75%
Maintainers
1
Weekly downloads
 
Created
Source

Get information about an IP address such as country, ISP, and timezone. First have a look at the following example and then continue to read how it works.

Example

Module dbip promises a Javascript object.

var dbip = require('dbip')

dbip('143.176.113.73').then(info => {
	console.log(info)
})

Output

Variable info looks like this:

{
    "IP Address": "143.176.113.73",
    "Address type": "IPv4",
    "ISP": "Svianned",
    "Connection type": "Dsl",
    "Organization": "Tele2 Nederland B.V.",
    "Timezone": "Europe/Amsterdam (UTC+2)",
    "Local time": "",
    "Country": "Netherlands",
    "State / Region": "Drenthe",
    "District / County": "Assen",
    "City": "Assen (Tele2)",
    "Coordinates": "52.997, 6.56675"
}

How does it work?

Module dbip sends a HTTP request to https://db-ip.com using module request (simplified http request client) and then uses Cheerio (server side jQuery implementation) to find the DOM elements we need.

Disclaimer

As a developer you understand that IP geolocation lookups like this are not always accurate. Because the info object is extracted from a page DOM, the module may no longer work if the website changes its page structure. If that happens, send me an email and I will fix it. (jochemstoel(@)gmail.com)

Jochem Stoel

Involuntary public figure.

  • https://www.npmjs.com/~jochemstoel
  • http://jochemstoel.github.io/
  • https://jochemstoel.tumblr.com/
  • https://jochemstoel.nl/
  • https://www.facebook.com/Jochem-Stoel-271292656217087/

Keywords

dbip

FAQs

Package last updated on 13 Jul 2016

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