2021-06-10 16:06:37 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import json
|
2021-06-12 12:13:23 +02:00
|
|
|
from generator import download, get_version, write_to_file, consolidate_networks
|
2021-06-10 16:06:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
cloud = download("https://www.gstatic.com/ipranges/cloud.json")
|
|
|
|
parsed = json.loads(cloud.text)
|
|
|
|
|
|
|
|
ranges = [p["ipv4Prefix"] if "ipv4Prefix" in p else p["ipv6Prefix"] for p in parsed["prefixes"]]
|
|
|
|
|
|
|
|
warninglist = {
|
|
|
|
'name': "List of known GCP (Google Cloud Platform) IP address ranges",
|
|
|
|
'version': get_version(),
|
|
|
|
'description': "GCP (Google Cloud Platform) IP address ranges (https://www.gstatic.com/ipranges/cloud.json)",
|
|
|
|
'matching_attributes': ["ip-src", "ip-dst", "domain|ip"],
|
|
|
|
'type': 'cidr',
|
2021-06-12 12:13:23 +02:00
|
|
|
'list': consolidate_networks(ranges),
|
2021-06-10 16:06:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
write_to_file(warninglist, "google-gcp")
|