Skip to content

Latest commit

 

History

History
47 lines (31 loc) · 1.01 KB

README.md

File metadata and controls

47 lines (31 loc) · 1.01 KB

ziscript

Code style: black

Pure python 3.6+, no packages required

Usage example

  1. Obtain archive
$ ./get_archive.py --loglevel=DEBUG
DEBUG:get_archive:Using '/home/wcm/.cache/ziscript' for cache
/home/wcm/.cache/ziscript/master.zip
  1. Extract IPs from archive
$ ./archive_to_ips.py /home/wcm/.cache/ziscript/master.zip
  1. Group IPs into subnets
$ ./ips_to_subnets.py -i /tmp/blocked.txt --filter-special -p 0.2 -o /tmp/blocked_subnets.txt
  1. (Optional) Save your existing ipset into file
$ sudo ipset save rkn-blocked-subnets -output plain > /tmp/old_subnets.txt
  1. Generate diff between current state and new subnets
$ ./ipset_build_delta.py rkn-blocked-subnets --new=/tmp/blocked_subnets.txt --old=/tmp/old_subnets.txt -o /tmp/subnet_delta.txt
  1. Apply changes to ipset
$ cat /tmp/subnet_delta.txt | sudo ipset restore
  1. Wrap it in script, add to cron, enjoy using internet