#!/usr/bin/python # Name: aws_ip_cidr # Created: 2017-02-21 # Last updated: 2017-02-21 # Version: 0.1 # # Purpose: Parse a JSON file downloaded from # https://ip-ranges.amazonaws.com/ip-ranges.json that contains a list of the # IP address ranges used by Amazon Web Services (AWS). Display just the # Classless Inter-Domain Routing (CIDR) address blocks import json data = json.load(open('ip-ranges.json')) for d in data["prefixes"]: print d["ip_prefix"]