Skip to content

Instantly share code, notes, and snippets.

@tatdatpham
Last active August 31, 2023 06:17
Show Gist options
  • Save tatdatpham/5162538c3b6c653a0d50d9db97d2799d to your computer and use it in GitHub Desktop.
Save tatdatpham/5162538c3b6c653a0d50d9db97d2799d to your computer and use it in GitHub Desktop.
The script to get list of Zscaler Egress IP ranges and Future Data Centers from https://config.zscaler.com/zscaler.net/cenr
import requests
response = requests.get('https://config.zscaler.com/api/getdata/zscaler.net/all/cenr?site=config.zscaler.com')
regions = response.json()['data'][6]['body']['json']['rows'][1:]
for region in regions:
region_name = region['region']
cols = region['cols']
for col in cols:
data = col['data']
for entry in data:
if entry.get('multivip'):
sub_data = entry['data']
for sub_entry in sub_data:
not_ready_for_use = False
for note in sub_entry['notes']:
if note['id'] == 3:
not_ready_for_use = True
break
if not not_ready_for_use:
print(f"{sub_entry['ip_address']}, Zscaler-{sub_entry['region']}-{sub_entry['location']}, {False}, {False}")
else:
not_ready_for_use = False
for note in entry['notes']:
if note['id'] == 3:
not_ready_for_use = True
break
if not not_ready_for_use:
print(f"{entry['ip_address']}, Zscaler-{entry['region']}-{entry['location']}, {False}, {False}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment