commit 9cba0ea16f98d831cda66bf6f306e03b194ba9dd Author: Sean Corrigan Date: Tue Feb 1 16:30:26 2022 -0500 Quick program to do things 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