zhanhb / cidr-merger Goto Github PK
View Code? Open in Web Editor NEWA simple command line tool to merge ip/ip cidr/ip range, supports IPv4/IPv6
License: MIT License
A simple command line tool to merge ip/ip cidr/ip range, supports IPv4/IPv6
License: MIT License
Over some time I have accumulated blacklists of /24 ip ranges. What I have noticed is that these blacklisted /24 are often part of bigger ranges maybe /16[1]
To keep latency down I want to have of course as less as possible entries in the blacklist. It would be nice if your tool could assist in this matter. I have been searching a bit on the internet but cannot find something useful, or the usage is not clear to me.
If you look at the list below, I could decide to keep 200 entries with 156.202 or exchange that for one 156/202.
How would I use your tool to accumulate these 200 entries[2] to only a few ranges?
[2]
35.161.1.0
35.161.10.0
35.161.100.0
35.161.101.0
35.161.102.0
35.161.103.0
35.161.105.0
35.161.106.0
35.161.107.0
35.161.108.0
35.161.109.0
35.161.11.0
35.161.110.0
35.161.111.0
35.161.112.0
35.161.113.0
35.161.114.0
35.161.115.0
35.161.117.0
35.161.118.0
35.161.119.0
35.161.12.0
35.161.120.0
35.161.121.0
35.161.122.0
35.161.123.0
35.161.124.0
35.161.125.0
35.161.126.0
35.161.127.0
35.161.128.0
35.161.129.0
35.161.13.0
35.161.131.0
35.161.132.0
35.161.133.0
35.161.135.0
35.161.137.0
35.161.139.0
35.161.14.0
35.161.140.0
..
..
35.161.76.0
35.161.77.0
35.161.80.0
35.161.81.0
35.161.82.0
35.161.83.0
35.161.84.0
35.161.85.0
35.161.86.0
35.161.87.0
35.161.88.0
35.161.89.0
35.161.9.0
35.161.90.0
35.161.91.0
35.161.92.0
35.161.93.0
35.161.95.0
35.161.96.0
35.161.97.0
35.161.98.0
[1]
[@]# grep blacklistweb ipset | cut -d' ' -f3|sort | cut -d'.' -f1,2| uniq -c | sort -n | tail -n 10
196 34.241
196 35.160
197 54.70
198 34.227
200 156.197
200 156.202
203 34.242
204 52.36
206 34.240
208 35.161
echo 0.0.0.0/0 | cidr-merger
expect 0.0.0.0/0
, but got 0.0.0.0/00000000
Could you please create a release and upload binary files, such as: cidr-merger_linux_amd64
.
Then we can get it with Nami
$ nami install github.com/zhanhb/cidr-merger
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.