Quick program to do things
This commit is contained in:
commit
9cba0ea16f
25
pullIPs.py
Normal file
25
pullIPs.py
Normal file
@ -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)
|
||||||
Loading…
Reference in New Issue
Block a user