bad-ip-blocklist

5.1.2 • Public • Published

Bad IPs blocklist

IP blocklists containing IPs of known bad actors and ranges likely belonging to data centers. The files are located in dist/ directory.

Building

To generate your own fresh blocklist run:

$ TOKEN={IP2LOCATION_DOWNLOAD_TOKEN} ./bin/build.sh

You can get your free token on https://lite.ip2location.com/.

Usage in node

Install dependencies and generate a DB

npm install
npm run buildDb

Run the example file:

node ./src/example.js`
// ./src/example.js
 
const IpInfo = require('./index');
 
console.time('init');
const ipInfo = new IpInfo('../dist/ipinfo.db');
console.timeEnd('init');
 
const ip = '93.201.96.204';
 
console.time('queries');
console.log('Datacenter:', ipInfo.isDatacenter(ip));
console.log('Blacklisted:', ipInfo.isBlacklisted(ip));
console.log('Country:', ipInfo.getCountry(ip));
console.timeEnd('queries');
 

Output:

init: 1.059ms
Datacenter: false
Blacklisted: true
Country: de
queries: 2.131ms

Used projects

Acknowledgments

Dependencies (1)

Dev Dependencies (18)

Package Sidebar

Install

npm i bad-ip-blocklist

Weekly Downloads

3

Version

5.1.2

License

UNLICENCED

Unpacked Size

32.4 MB

Total Files

23

Last publish

Collaborators

  • umkus