Skip to content

Convert CIDR ranges into the ranges allowed by AWS WAF IP Sets

License

Notifications You must be signed in to change notification settings

tomelliff/aws-waf-cidr-converter

Repository files navigation

AWS WAF CIDR converter

Build Status Coverage Status Codacy Badge

Conversion between typical CIDR ranges and the ranges allowed by AWS WAF:

AWS WAF supports /8, /16, /24, and /32 IPv4 address ranges and /16, /24, /32, /56, /64, and /128 IPv6 address ranges

Usage

$ ./converter.py -h
usage: converter.py [-h] cidr_range

Converts CIDR ranges into AWS WAF IP Set allowed ranges

positional arguments:
  cidr_range  eg. 192.168.0.0/23

optional arguments:
  -h, --help  show this help message and exit

$ ./converter.py 192.168.0.0/23
192.168.0.0/24
192.168.1.0/24

Requirements

Supports both Python 2.7 and 3.6 (others may run but no tests are ran against them).

For Python2 you will need to install some dependencies:

pip install -r requirements.txt

These are backported modules from Python3's Standard Library so Python3 has no such dependencies.

Contributing

Running the tests

To run all the tests for both Python2.7 and 3.6 just run:

tox

Obviously you will need tox available but this will install all dependencies for each environment in a virtual environment.

There is a pre-commit hook available that will automatically run the tests for you. Simply copy it into your .git/hooks folder to install it:

cp pre-commit .git/hooks/

About

Convert CIDR ranges into the ranges allowed by AWS WAF IP Sets

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published