{"id":13843374,"url":"https://github.com/leolovenet/qqwry2mmdb","last_synced_at":"2025-04-05T03:09:47.627Z","repository":{"id":47077560,"uuid":"265484208","full_name":"leolovenet/qqwry2mmdb","owner":"leolovenet","description":"为 Wireshark 能使用纯真网络 IP 数据库(QQwry)而提供的格式转换工具","archived":false,"fork":false,"pushed_at":"2024-10-01T14:29:31.000Z","size":43335,"stargazers_count":166,"open_issues_count":1,"forks_count":17,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-29T02:06:09.235Z","etag":null,"topics":["geoip2","maxmind-db","mmdb","perl5","qqwry","wireshark"],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leolovenet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-20T07:23:40.000Z","updated_at":"2025-03-07T07:57:09.000Z","dependencies_parsed_at":"2024-01-31T03:55:58.231Z","dependency_job_id":"58ed7ebd-c9eb-4aae-8274-9ee8617b4cf2","html_url":"https://github.com/leolovenet/qqwry2mmdb","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leolovenet%2Fqqwry2mmdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leolovenet%2Fqqwry2mmdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leolovenet%2Fqqwry2mmdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leolovenet%2Fqqwry2mmdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leolovenet","download_url":"https://codeload.github.com/leolovenet/qqwry2mmdb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247280272,"owners_count":20912967,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geoip2","maxmind-db","mmdb","perl5","qqwry","wireshark"],"created_at":"2024-08-04T17:02:03.185Z","updated_at":"2025-04-05T03:09:47.596Z","avatar_url":"https://github.com/leolovenet.png","language":"Perl","funding_links":[],"categories":["Perl","Perl (22)"],"sub_categories":[],"readme":"# qqwry2mmdb\n 为抓包软件 Wireshark 能使用纯真网络 IP 数据库而提供的格式转换工具\n\n![WireShark 集成纯真网络IP数据库](./wireshark-with-qqwry-ip-data.jpg)\n\n## 特性\n\n* 支持自定义 IP 数据库记录，例如向库中增加私网 IP 的归属信息。编辑 `qqwry2mmdb.pl`，打开 `remove_reserved_networks` 开关，新增自己的私人记录。\n\n```perl\n$tree-\u003einsert_range(\"192.168.1.1\", \"192.168.1.1\", {\n        city    =\u003e {\n            names =\u003e {\n                en =\u003e \"众里寻她千百度，蓦然回首阑珊处\"\n            }\n        },\n        country =\u003e {\n            names =\u003e {\n                en =\u003e \"就是您\"\n            }\n        }\n    });\n```\n\n* 支持根据 IP 属地的数据包过滤， 例如 `ip.geoip.dst_city contains \"辽宁\"`\n\n![根据IP地址属地过滤](./wireshark-filter.jpg)\n\n## 描述\n\n[Wireshark](https://www.wireshark.org/) 是网络抓包、协议分析、网络问题定位的\"瑞士军刀\"，功能非常强大，我本人非常喜欢的开源网络工具。在网络分析行为中 IP 地址归属地信息查询也是一个很重要的方面。在国内非常出名的，以及维护时间最久的IP归属地数据库应该非 [纯真网络IP数据库](http://www.cz88.net/ip/) 莫属了。至少对于我而言，我希望在 Wireshark 的程序界面里能同时看到捕获到的IP数据包的归属地信息，因此我研究了一下 Wireshark 的源代码，发现它本身已经基于 [libmaxminddb](https://github.com/maxmind/libmaxminddb) 库实现了这个功能（再次为它的强大点赞👍），只不过默认不携带具体的 IP 归属地数据库，需要自行安装。另外 [MaxMind DB](https://github.com/maxmind/MaxMind-DB/blob/master/MaxMind-DB-spec.md) 为开源格式的数据库，因此剩下的工作就简单了，只需要把纯真IP数据库的格式转换到 mmdb 格式，并配置 Wireshark 读取就大功告成了。\n\n\n## 安装 qqwry.mmdb 数据库, 配置 Wireshark\n\n配置 Wireshark 指定包含 qqwry.mmdb 的目录(⚠️此处是需要指明包含数据库文件的目录，不是数据库文件的绝对路径⚠️)\n\n![WireShark 配置使用纯真网络IP数据库](./wireshark-config.jpg)\n\n点击OK以后，重启 wireshark 抓包，你会发现在 “Packet List” 面版，看不到我上面截图中的那些中文IP信息，还需要进行下面的操作\n\n![WireShark apply GeoIP As column](./wireshark-config-as-column.jpg)\n## 安装 qqwry2mmdb.pl，自己生成特定数据库文件\n\nMaxMind DB 自家的 [数据库生成工具](https://github.com/maxmind/MaxMind-DB-Writer-perl) 是基于 Perl 语言编写，因此本项目也是用 Perl 来实现(本想为了便携性用Go重写，但是看了看工作量又懒的再造轮子了)，使用并扩展了 [IP::QQWry](https://metacpan.org/pod/IP::QQWry) 库来读取纯真IP库的所有记录。\n\n首先安装 [Perl](https://www.perl.org/get.html) ，然后安装 [cpanm](https://cpanmin.us/), 以及依赖库，`MaxMind::DB::Writer` 与 `IP::QQWry::Decoded`\n\n### Linux (CentOS7)\n\n```shell\nyum -y install perl perl-CPAN\n\n#使用 cpan 安装 cpanm 命令\ncpan App::cpanminus\n#或者, 使用 curl 安装 cpanm 命令\n#curl -L https://cpanmin.us | perl - App::cpanminus\n\n#使用 cpanm 命令安装所需模块\ncpanm --notest --force MaxMind::DB::Writer IP::QQWry::Decoded\n\n#请自行下载最新版本的 qqwry.dat (例如这里: https://github.com/FW27623/qqwry)\n#下载安装 qqwry2mmdb\nwget https://github.com/leolovenet/qqwry2mmdb/archive/refs/heads/master.zip\nunzip master.zip\ncd qqwry2mmdb-master\n\n#请自行下载最新版本的 qqwry.dat\n#请注意，qqwry2mmdb.pl 脚本依赖本项目中的 lib/IP/QQWry/Dumper.pm 库文件\nperl qqwry2mmdb.pl /your/save/path/of/qqwry.dat\n```\n\n### macOS\n\n```shell\nbrew install cpanm\ncpanm --notest MaxMind::DB::Writer IP::QQWry::Decoded\n\n#请自行下载最新版本的 qqwry.dat (例如这里: https://github.com/FW27623/qqwry)\n#下载安装 qqwry2mmdb\nwget https://github.com/leolovenet/qqwry2mmdb/archive/refs/heads/master.zip\nunzip master.zip\ncd qqwry2mmdb-master\n\n#请自行下载最新版本的 qqwry.dat\n#请注意，qqwry2mmdb.pl 脚本依赖本项目中的 lib/IP/QQWry/Dumper.pm 库文件\nperl qqwry2mmdb.pl /your/save/path/of/qqwry.dat\n```\n\n### windows\n\n`MaxMind::DB::Writer` 不支持该平台\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleolovenet%2Fqqwry2mmdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleolovenet%2Fqqwry2mmdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleolovenet%2Fqqwry2mmdb/lists"}