-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df36555
commit 169c4b8
Showing
12 changed files
with
924 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
bin | ||
|
||
# Created by https://www.toptal.com/developers/gitignore/api/macos,go,jetbrains+all,visualstudiocode | ||
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,go,jetbrains+all,visualstudiocode | ||
|
||
### Go ### | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
### Go Patch ### | ||
/vendor/ | ||
/Godeps/ | ||
|
||
### JetBrains+all ### | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# User-specific stuff | ||
.idea/**/workspace.xml | ||
.idea/**/tasks.xml | ||
.idea/**/usage.statistics.xml | ||
.idea/**/dictionaries | ||
.idea/**/shelf | ||
|
||
# Generated files | ||
.idea/**/contentModel.xml | ||
|
||
# Sensitive or high-churn files | ||
.idea/**/dataSources/ | ||
.idea/**/dataSources.ids | ||
.idea/**/dataSources.local.xml | ||
.idea/**/sqlDataSources.xml | ||
.idea/**/dynamic.xml | ||
.idea/**/uiDesigner.xml | ||
.idea/**/dbnavigator.xml | ||
|
||
# Gradle | ||
.idea/**/gradle.xml | ||
.idea/**/libraries | ||
|
||
# Gradle and Maven with auto-import | ||
# When using Gradle or Maven with auto-import, you should exclude module files, | ||
# since they will be recreated, and may cause churn. Uncomment if using | ||
# auto-import. | ||
# .idea/artifacts | ||
# .idea/compiler.xml | ||
# .idea/jarRepositories.xml | ||
# .idea/modules.xml | ||
# .idea/*.iml | ||
# .idea/modules | ||
# *.iml | ||
# *.ipr | ||
|
||
# CMake | ||
cmake-build-*/ | ||
|
||
# Mongo Explorer plugin | ||
.idea/**/mongoSettings.xml | ||
|
||
# File-based project format | ||
*.iws | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Cursive Clojure plugin | ||
.idea/replstate.xml | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
fabric.properties | ||
|
||
# Editor-based Rest Client | ||
.idea/httpRequests | ||
|
||
# Android studio 3.1+ serialized cache file | ||
.idea/caches/build_file_checksums.ser | ||
|
||
### JetBrains+all Patch ### | ||
# Ignores the whole .idea folder and all .iml files | ||
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 | ||
|
||
.idea/ | ||
|
||
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 | ||
|
||
*.iml | ||
modules.xml | ||
.idea/misc.xml | ||
*.ipr | ||
|
||
# Sonarlint plugin | ||
.idea/sonarlint | ||
|
||
### macOS ### | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
### VisualStudioCode ### | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
*.code-workspace | ||
|
||
### VisualStudioCode Patch ### | ||
# Ignore all local history of files | ||
.history | ||
.ionide | ||
|
||
# End of https://www.toptal.com/developers/gitignore/api/macos,go,jetbrains+all,visualstudiocode | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
<h1 align="center"> | ||
<br>ipqqwry<br> | ||
</h1> | ||
|
||
<h4 align="center">一个(包含)纯真IP库的单一可执行文件</h4> | ||
|
||
|
||
## 来源 | ||
|
||
该工具出自自身需求,写完后,发现已经存在一个同类型的工具 [Nali](https://github.com/zu1k/nali), 本着"重新造轮子"的精神,发布了出来。 | ||
|
||
与 Nali 最大的不同,估计就是只支持纯真IP库,并且为了部署,分发便利,将纯正库直接编译进了可执行文件内,下载相应版本的可执行文件,就可以直接运行使用。 | ||
|
||
同时,整日面对黑漆漆的终端框,我喜欢丰富的颜色,所以还给工具增加了IPv4、IPv6、MAC 地址颜色高亮的功能。 | ||
|
||
## 功能 | ||
|
||
- 单一可执行文件(纯真库已经编译进可执行文件内,也可通过环境变量`IPDB_QQWRY_PATH`指定使用外部纯正库) | ||
- 纯真 IPv4 离线数据库 | ||
- 支持域名、URL 、IPv4 的直接查询 | ||
- 支持管道处理(管道模式下,支持IPv4、IPv6、MAC 地址字符的颜色高亮) | ||
- 查询完全离线 | ||
- 全平台支持(go语言的功劳) | ||
|
||
![pipeline with tcpdump command](./images/with-tcpdump.jpg) | ||
|
||
## 安装 | ||
|
||
### 从源码安装 | ||
|
||
ipqqwry 需要预先安装 Go. 安装后可以从源码安装软件: | ||
|
||
```sh | ||
$ go get -u -v github.com/leolovenet/ipqqwry | ||
``` | ||
|
||
### 下载预编译的可执行程序 | ||
|
||
可以从Release页面下载预编译好的可执行程序: [Release](https://github.com/leolovenet/ipqqwry/releases) | ||
|
||
你需要选择适合你系统和硬件架构的版本下载,解压后可直接运行 | ||
|
||
## 使用说明 | ||
|
||
### 直接查询 IP、域名、URL 中 HostName 的归属地信息 | ||
|
||
``` | ||
$ ipqqwry ipqqwry 1.1.1.1 2.2.2.2 weibo.com https://google.com/ncr | ||
[ | ||
{ | ||
"ip ": "1.1.1.1", | ||
"country": "美国", | ||
"area ": "APNIC\u0026CloudFlare公共DNS服务器" | ||
}, | ||
{ | ||
"ip ": "2.2.2.2", | ||
"country": "法国", | ||
"area ": "Orange" | ||
}, | ||
{ | ||
"domain ": "weibo.com", | ||
"ip ": "123.125.23.27", | ||
"country": "北京市", | ||
"area ": "亦庄联通数据中心" | ||
}, | ||
{ | ||
"domain ": "weibo.com", | ||
"ip ": "123.125.22.241", | ||
"country": "北京市", | ||
"area ": "亦庄联通数据中心" | ||
}, | ||
{ | ||
"domain ": "weibo.com", | ||
"ip ": "123.125.106.66", | ||
"country": "北京市", | ||
"area ": "新浪互联信息服务联通节点" | ||
}, | ||
{ | ||
"domain ": "weibo.com", | ||
"ip ": "123.125.106.67", | ||
"country": "北京市", | ||
"area ": "新浪互联信息服务联通节点" | ||
}, | ||
{ | ||
"domain ": "google.com", | ||
"ip ": "59.24.3.174", | ||
"country": "韩国", | ||
"area ": "KT电信" | ||
} | ||
] | ||
``` | ||
|
||
### 或者 使用 `管道模式` | ||
|
||
该模式的工作原理,就是对标准输入进行"逐行扫描",然后对发现的IPv4进行归属地查询,并将查询结果附加到IP的后面,再输出到标准输出。如果发现标准输出为终端,则附加上颜色信息(可强制关闭)。 | ||
|
||
``` | ||
$ echo IP 6.6.6.6 | ipqqwry | ||
IP 6.6.6.6(美国,亚利桑那州华楚卡堡市美国国防部网络中心) | ||
#或者 | ||
$ ifconfig | ipqqwry | ||
#或者 | ||
$ ip addr show | ipqqwry | ||
#或者 | ||
$ tcpdump -nni any icmp | ipqqwry | ||
``` | ||
|
||
![pipeline with echo command](./images/with-echo.jpg) | ||
|
||
|
||
![pipeline with ifconfig command](./images/with-ifconfig.jpg) | ||
|
||
### 更换数据库 | ||
|
||
|
||
```shell | ||
export IPDB_QQWRY_PATH=/some/other/qqwry.dat | ||
|
||
ipqqwry -v | ||
``` | ||
|
||
![with other qqwry](./images/with-other-qqwry.jpg) | ||
|
||
## 查看帮助 | ||
|
||
直接运行 ipqqwry 命令 | ||
|
||
```shell | ||
$ ipqqwry | ||
Usage: | ||
ipqqwry [ip | domain] ... | ||
ifconfig | ipqqwry [-p | -C] Using pipeline, translate the included ip address information. | ||
The -p option also translates(default not) non-public IP information. | ||
The -C option suppress color output. | ||
ipqqwry [-v | version] show qqwry version. | ||
``` | ||
|
||
|
||
## 测试效果 | ||
```shell | ||
cat test.log | ipqqwry | ||
``` | ||
|
||
## 感谢列表 | ||
- [纯真QQIP离线数据库](http://www.cz88.net/fox/ipdat.shtml) | ||
- [qqwry mirror](https://qqwry.mirror.noc.one/) | ||
- [qqwry纯真数据库解析](https://metacpan.org/pod/IP::QQWry) | ||
- [nali](https://github.com/zu1k/nali) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module github.com/leolovenet/ipqqwry | ||
|
||
go 1.16 | ||
|
||
require golang.org/x/text v0.3.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= | ||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= | ||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.