You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

device-ip-location

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

device-ip-location

Get device information from your systems users including device, operating system and version, and an abundance of location information from their ip.

1.0.28
latest
Source
npmnpm
Version published
Weekly downloads
11
-94.53%
Maintainers
1
Weekly downloads
 
Created
Source

device-ip-location

Get device information from your systems users: Device model and version, operating system and version, and an abundance of location information from their ip address

Use for security management i.e password resetting & detecting new sign in devices etc.

See https://www.npmjs.com/package/device-ip-location

Install

npm i device-ip-location

Usage

const device = require('device-ip-location');

//Make sure to bypass the reverse proxy by allowing for IP visibility by enabling proxy trust if you're using express:
app.enable('trust proxy');

// Use the request data to access the required parameters (ip and header)
// Example agent - 'Mozilla/5.0 (Linux; Android 5.0; NX505J Build/KVT49L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.78 Mobile Safari/537.36';
var agent = req.headers['user-agent'];
// Example requestIp - 105.4.4.147
var requestIp = req.ip

device.getInfo(agent,requestIp,function(err,res){
    if(err){
        console.log(err);
        return
    } 
    console.log(res);
})

Result parse

{ "device":
   { "os":
      { "short_name": "WIN",
        "name": "Windows",
        "version": "10",
        "platform": "x64",
        "family": "Windows" },
     "device": { "id": "", "type": "desktop", "brand": "", "model": "" },
     "client":
      { "engine": "Blink",
        "engine_version": "",
        "short_name": "CH",
        "name": "Chrome",
        "version": "69.0.3497.100",
        "type": "browser" } },
  "locale":
   { "ip": "105.4.4.147",
     "type": "ipv4",
     "continent_code": "AF",
     "continent_name": "Africa",
     "country_code": "ZA",
     "country_name": "South Africa",
     "region_code": "GT",
     "region_name": "Gauteng",
     "city": "Johannesburg",
     "zip": "2000",
     "latitude": -26.2309,
     "longitude": 28.0583,
     "location":
      { "geoname_id": 993800,
        "capital": "Pretoria",
        "languages": [],
        "country_flag": "http://assets.ipstack.com/flags/za.svg",
        "country_flag_emoji": "🇿🇦",
        "country_flag_emoji_unicode": "U+1F1FF U+1F1E6",
        "calling_code": "27",
        "is_eu": false } } }

Keywords

ip

FAQs

Package last updated on 19 May 2021

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.