IP-List-Compressor

module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2023 License: MIT

README

IP List Compressor

This is a simple tool to compress a list of IP addresses in a plain text file into a compact compressed file.

Install

Compressor
go install github.com/WangYihang/IP-List-Compressor/cmd/ip-list-compressor@latest
Decompressor
go install github.com/WangYihang/IP-List-Compressor/cmd/ip-list-decompressor@latest

Usage

Scan the internet using zmap
$ sudo zmap -p 80 -o zmap.txt

$ sort -n zmap.txt -o input.txt

$ ls -al input.txt
-rw-rw-r-- 1 ubuntu ubuntu 126 Aug 25 18:21 input.txt

$ cat input.txt
1.0.0.0
1.0.0.1
1.0.0.10
1.0.0.100
1.0.0.101
1.0.0.102
1.0.0.103
1.0.0.104
1.0.0.106
1.0.0.107
1.0.0.108
1.0.0.110
1.0.0.111
Compress the IP list
$ go run cmd/compressor/main.go -i input.txt -o output.gz                

$ ls -al output.gz                                       
-rw-r--r-- 1 ubuntu ubuntu 53 Aug 25 18:23 output.gz
Decompress the IP list
$ go run cmd/decompressor/main.go -i output.gz -o output.txt 

$ ls -al output.txt
-rw-r--r-- 1 ubuntu ubuntu 125 Aug 25 18:24 output.txt
Compare the original and decompressed IP lists
$ diff input.txt output.txt

$ # the files are identical

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL