Coder Social home page Coder Social logo

aws-waf-ipsets's Introduction

Python3 script imports a list of networks in CIDR notation to a new IP set in AWS Web Application Firewall

This script creates a new IPset in AWS WAF based on input from a TXT file. It can be used with long lists of networks like the ones you can download from https://www.countryipblocks.net/country_selection.php

In addition to adding the networks to an IP set in AWS WAF, it also prunes the list of networks to a custom prefix length (i.e. /16) by folding smaller networks into their supernets dividing larger networks into their subnets.

Inputs

sys.argv[0] == IPset name

sys.argv[1] == path to TXT file

Example Output

python3 ipsetimport.py Germany de.txt

Read 47765 lines from de.txt.

Pruned list of networks to 3265 /16 networks.

Added networks 0 to 9 out of 3265.

Added networks 10 to 19 out of 3265.

Added networks 20 to 29 out of 3265.

...

Added networks 3240 to 3249 out of 3265.

Added networks 3250 to 3259 out of 3265.

New IP set Germany with 3265 networks has been created.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.