All Projects → cnwhy → Lib Qqwry

cnwhy / Lib Qqwry

用NodeJS解析纯真IP库(QQwry.dat) 支持IP段查询

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Lib Qqwry

findip
🔧 Python Script For Finding All Available Local IP Addresses
Stars: ✭ 38 (-87.62%)
Mutual labels:  ip
gravityforms-phone-extension
Extension for GravityForms (WordPress) which applies the International Phone Input (http://intl-tel-input.com) to all Phone Fields.
Stars: ✭ 24 (-92.18%)
Mutual labels:  ip
MicroDNSSrv
A micro DNS server for MicroPython to simply respond to A queries on multi-domains with or without wildcards (used on Pycom modules & ESP32)
Stars: ✭ 43 (-85.99%)
Mutual labels:  ip
swift-ipify
Swift library for checking your IP address from ipify.org
Stars: ✭ 37 (-87.95%)
Mutual labels:  ip
ebook
Third edition of the Computer Networking: Principles, Protocols and Practice ebook
Stars: ✭ 64 (-79.15%)
Mutual labels:  ip
ip-logger
📇 When someone clicks the link, you will receive their IP and other information via telegram.
Stars: ✭ 0 (-100%)
Mutual labels:  ip
ip scan
Scan a list of IPs quickly using multithreading
Stars: ✭ 13 (-95.77%)
Mutual labels:  ip
Checkiptools
CheckIPTools 扫描谷歌IP以及实用IP转换小工具
Stars: ✭ 253 (-17.59%)
Mutual labels:  ip
omegleip
Shows the IP and Geolocation of the stranger. Written in Javascript as a Extension
Stars: ✭ 33 (-89.25%)
Mutual labels:  ip
express-ip
An Express Middleware for getting IP information
Stars: ✭ 28 (-90.88%)
Mutual labels:  ip
IpProxyPool
Golang 实现的 IP 代理池, 涉及到的技术点: go gorm proxy proxypool ip crawler 爬虫 mysql viper cobra
Stars: ✭ 36 (-88.27%)
Mutual labels:  ip
jqIpLocation
jqIpLocation – jQuery Plugin that returns the location of an IP address in JSON format
Stars: ✭ 18 (-94.14%)
Mutual labels:  ip
cidr
get more IP details from CIDR range
Stars: ✭ 25 (-91.86%)
Mutual labels:  ip
vue-ip
IP Address input for VueJS 2.x
Stars: ✭ 25 (-91.86%)
Mutual labels:  ip
geoip-exporter
GeoIP exporter for Prometheus
Stars: ✭ 27 (-91.21%)
Mutual labels:  ip
UserDeviceTracker
快速定位一个IP或MAC在你的网络中的位置,是网络工程师提高工作效率的利器,也可以为CMDB提供基础网络数据。
Stars: ✭ 36 (-88.27%)
Mutual labels:  ip
network-pipeline
Network traffic data pipeline for real-time predictions and building datasets for deep neural networks
Stars: ✭ 36 (-88.27%)
Mutual labels:  ip
Cidr.xyz
Web-based CIDR / netmask / IP address visualizer
Stars: ✭ 293 (-4.56%)
Mutual labels:  ip
TorIpChanger
Python powered way to get a unique Tor IP
Stars: ✭ 42 (-86.32%)
Mutual labels:  ip
ItroublveTSC
Official Source of ItroublveTSC, totally open source. No virus or anything. Feel free to have a look :)
Stars: ✭ 82 (-73.29%)
Mutual labels:  ip

lib-qqwry

lib-qqwry是一个高效纯真IP库(qqwry.dat)引擎;

安装

npm i lib-qqwry

使用

cli (v1.3.0+)

从1.3版本开始支持命令模式, 你可以用把lib-qqwry安装到全局来使用; search

  • qqwry search <ip> [ips...] 查询IP/IP段
  • qqwry find <keyword> [keyword...] 反查IP段
  • qqwry update [dataPath] 从纯真官网更新IP库文件

node

var libqqwry = require('lib-qqwry');
var qqwry = libqqwry() //初始化IP库解析器
qqwry.speed(); //启用急速模式;

var ip1 = qqwry.searchIP("202.103.102.10"); //查询IP信息
var ips = qqwry.searchIPScope("0.0.0.0","1.0.0.0");  //查询IP段信息
//异步查询IP段信息
qqwry.searchIPScope("0.0.0.0","1.0.0.0",function(err,iparr){
  console.log(iparr);
});
//查询IP段信息,结果以可读流返回
var ipStream = qqwry.searchIPScopeStream('0.0.0.0','1.0.0.0',{format:'json'});
// s.pipe(fs.readFileSync(outFile))
ipStream.pipe(process.stdout)

API

libqqwry.ipToInt(IP) IP地址转数值

> libqqwry.ipToInt("255.255.255.255")
4294967295

libqqwry.intToIP(INT) 数值转IP地址

> libqqwry.intToIP(4294967295)
'255.255.255.255'

libqqwry.ipEndianChange(INT) 字节序转换

按32位转换参数的字节序
一些云平台的环境变量中IP信息可能是Little-Endian形式的数值;

> libqqwry.ipEndianChange(0x010000FF)
4278190081 //0xFF000001

new libqqwry(speed,dataPath) 实例化一个IP库解析器对像(Qqwry)

speed : 是否开启急速模式,可选; //默认false;
dataPath : IP库路径,可选; //默认路径为data文件夹中(__dirname + "/data/qqwry.dat"); // 可以简写为 libqqwry(speed,dataPath)

var libqqwry = require('lib-qqwry');
var qqwry = libqqwry(true);

libqqwry(), libqqwry.init() 功能相同

解析器对像 Qqwry

qqwry.searchIP(IP) 单个IP查询

IP : IP地址/IP数值

便捷调用: qqwry(IP) v1.2.0+

> qqwry("255.255.255.255");
{ int: 4294967295,
  ip: '255.255.255.255',
  Country: '纯真网络',
  Area: '2017年1月5日IP数据' }

qqwry.searchIPScope(beginIP,endIP,[callback]) IP段查询

beginIP : 启始IP
endIP : 结束IP
callback: function(err,arrdata){} 没有回调则使用同步查询;

便捷调用: qqwry(beginIP,endIP,callback) v1.2.0+

> qqwry("8.8.8.0","8.8.8.8");
[ { begInt: 134744064,
    endInt: 134744071,
    begIP: '8.8.8.0',
    endIP: '8.8.8.7',
    Country: '美国',
    Area: '加利福尼亚州圣克拉拉县山景市谷歌公司' },
  { begInt: 134744072,
    endInt: 134744072,
    begIP: '8.8.8.8',
    endIP: '8.8.8.8',
    Country: '美国',
    Area: '加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器' } ]

qqwry.searchIPScopeStream(beginIP,endIP,options) 流形式反回IP段结果 v1.3.0+

beginIP : <string|int> // 启始IP
endIP : <string|int> // 结束IP
options:

  • format : //输出格式, 支持 'text' , 'csv', 'json', 'object'
  • outHeader: //为true时 'csv' 会输出表头 , 'json' 会以对像数组形式输出(参考searchIPScope方法); 默认 false

流模式适合查询结果数据量较大的情况使用
format说明: 'csv' , 'json' 格式适合直接输出到文件, 'object' 将返回对像流, 适合程序二次处理数据

> qqwry.searchIPScopeStream("8.8.8.0","8.8.8.8").pipe(process.stdout);
8.8.8.0 - 8.8.8.7                   美国 加利福尼亚州圣克拉拉县山景市谷歌公司
8.8.8.8 - 8.8.8.8                   美国 加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器

> qqwry.searchIPScopeStream("8.8.8.0","8.8.8.8",{format:'csv'}).pipe(process.stdout);
134744064,134744071,8.8.8.0,8.8.8.7,美国,加利福尼亚州圣克拉拉县山景市谷歌公司
134744072,134744072,8.8.8.8,8.8.8.8,美国,加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器

> qqwry.searchIPScopeStream("8.8.8.0","8.8.8.8",{format:'json'}).pipe(process.stdout);
[[134744064,134744071,"8.8.8.0","8.8.8.7","美国","加利福尼亚州圣克拉拉县山景市谷歌公司"],[134744072,134744072,"8.8.8.8","8.8.8.8","美国","加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器"]]

qqwry.speed() 启用急速模式

急速模式实质为将IP库文件读入内存中以提升效率.

qqwry.unSpeed() 停用急速模式

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].