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

@dkvz/iplookup-cli

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dkvz/iplookup-cli - npm Package Compare versions

Comparing version 2.0.2 to 3.0.0

lib/dns.js

23

iplookup.js

@@ -8,2 +8,3 @@ #!/usr/bin/env node

const geoip = require('./lib/geoip')
const { reverseLookup } = require('./lib/dns')

@@ -19,3 +20,3 @@ const geoAsnPath = path.join(process.env.DB_DIR, process.env.ASN_DB_NAME)

async function showIpInfo(ips, short = false) {
async function showIpInfo(ips, short = false, disableDnsLookups = false) {
await geoip.openReaders(geoCityPath, geoAsnPath)

@@ -25,5 +26,6 @@ for (ip of ips) {

const asn = geoip.getASN(ip)
let asTable
let asTable = { 'IP Address': ip }
if (city && city.country) {
asTable = {
...asTable,
'Country': city.country.names.en,

@@ -34,5 +36,3 @@ 'ISO': city.country.isoCode,

} else {
asTable = {
'Country': 'No data'
}
asTable['Country'] = 'No data'
}

@@ -51,3 +51,6 @@ if (asn) {

} else {
console.log(`IP Address: ${ip}`)
//console.log(`IP Address: ${ip}`)
if (!disableDnsLookups) {
asTable['Reverse DNS'] = await reverseLookup(ip)
}
console.table(asTable)

@@ -69,2 +72,8 @@ console.log('---')

})
.option('nodns', {
alias: 'n',
describe: 'Disable DNS lookups',
boolean: true,
default: false
})
.help()

@@ -76,2 +85,2 @@ .parse()

//const ipArgs = process.argv.splice(2)
showIpInfo(argv._, argv.short)
showIpInfo(argv._, argv.short, argv.nodns)

@@ -27,2 +27,7 @@ const Reader = require('@maxmind/geoip2-node').Reader

} catch (ex) {
if (ex && ex.name === 'AddressNotFoundError') {
// The IP isn't in the database, return null.
// This isn't an error and happens sometimes.
return null;
}
console.error('Error reading GeoIP city info', ex.toString())

@@ -29,0 +34,0 @@ }

{
"name": "@dkvz/iplookup-cli",
"version": "2.0.2",
"version": "3.0.0",
"description": "Queries IP location databases and shows info on the owner and their IP ranges",

@@ -5,0 +5,0 @@ "main": "iplookup.js",

@@ -12,6 +12,8 @@ # iplookup-cli

```
node index.js 8.8.8.8 1.1.1.1
node iplookup.js 8.8.8.8 1.1.1.1
```
The `-s` option makes it so only the country code is printed.
Options:
* `-s` makes it so only the country code is printed.
* `-n` disables reverse DNS lookup.

@@ -18,0 +20,0 @@ ## NPM package

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc