From 9cba0ea16f98d831cda66bf6f306e03b194ba9dd Mon Sep 17 00:00:00 2001 From: Sean Corrigan Date: Tue, 1 Feb 2022 16:30:26 -0500 Subject: [PATCH] Quick program to do things --- pullIPs.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 pullIPs.py diff --git a/pullIPs.py b/pullIPs.py new file mode 100644 index 0000000..158b55c --- /dev/null +++ b/pullIPs.py @@ -0,0 +1,25 @@ +from select import select +import requests, json + + + + +data = requests.get('https://ip-ranges.amazonaws.com/ip-ranges.json') +datain = json.loads(data.content) + +outdict = dict() + +for prefix in datain['prefixes']: + try: + outdict[prefix['region']].append(prefix['ip_prefix']) + except: + outdict[prefix['region']] = [prefix['ip_prefix']] + +for region in outdict: + print(f'{region}') +select = input('Enter name of location to recieve associated IPs: ') + +print('\n'*100) +print(f'Displaying IP ranges for {select}') +for IP in outdict[select]: + print(IP) \ No newline at end of file