Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

output without any outputfile option gets weird #4

Closed
AWCOG opened this issue Jan 30, 2023 · 5 comments · Fixed by #6
Closed

output without any outputfile option gets weird #4

AWCOG opened this issue Jan 30, 2023 · 5 comments · Fixed by #6
Assignees

Comments

@AWCOG
Copy link

AWCOG commented Jan 30, 2023

The output was tabled list but the new version didn't do that anymore.

python3 format-egress-ips.py --allEgressIPs
Are you sure this is the right JSON object?
{'status': 'success', 'result': [{'address_details': [{'address': 000.000.000.000', 'serviceType': 'remote_network', 'addressType': 'active', 'node_name': ['Prisma-Network-Remote']}, {'address': '000.000.000.000', 'serviceType': 'gp_gateway', 'addressType': 'active', 'create_time': 11111111, 'allow_listed': False}, {'address': '000.000.000.000, 'serviceType': 'gp_gateway',
...

Something like this.

@TheScriptGuy
Copy link
Owner

Have you sanitized the output? If you can paste the full output here (sanitize the IP addresses), I can take a look and see what's happening.

@AWCOG
Copy link
Author

AWCOG commented Jan 30, 2023

~/PrismaAccess-EgressIPs$ python3 format-egress-ips.py --allEgressIPs
Are you sure this is the right JSON object?
{'status': 'success', 'result': [{'address_details': [{'address': '111.222.333.12', 'serviceType': 'network', 'addressType': 'active', 'node_name': ['Remote']}, {'address': '111.1.254.142', 'serviceType': 'gp_gateway', 'addressType': 'active', 'create_time': 1211156780, 'allow_listed': False}, {'address': '111.222.333.125', 'serviceType': 'gp_gateway', 'addressType': 'active', 'create_time': 1608188293, 'allow_listed': False}, {'address': '111.1.254.88', 'serviceType': 'gp_gateway', 'addressType': 'active', 'create_time': 1211156780, 'allow_listed': False}, {'address': '111.222.333.70', 'serviceType': 'gp_gateway', 'addressType': 'active', 'create_time': 1234567890, 'allow_listed': False}, {'address': '111.222.333.175', 'serviceType': 'network', 'addressType': 'service_ip', 'node_name': ['Remote']}], 'zone': 'US Central', 'addresses': ['111.222.333.12', '111.1.254.142', '111.222.333.125', '111.1.254.88', '111.222.333.70', '111.222.333.175'], 'zone_subnet': ['111.222.0.0/16', '111.103.0.0/16', '111.99.0.0/16', '111.1.128.0/17', '111.222.122.0/18', '111.188.122.0/19', '111.222.0.0/16', '123.41.0.0/16'], 'addresses_v6': [], 'address_details_v6': []}, {'address_details': [{'address': '111.222.333.175', 'serviceType': 'network', 'addressType': 'active', 'node_name': ['ABBB-1']}, {'address': '111.1.252.150', 'serviceType': 'gp_gateway', 'addressType': 'active', 'create_time': 1642517055, 'allow_listed': False}, {'address': '111.222.333.250', 'serviceType': 'gp_gateway', 'addressType': 'active', 'create_time': 1211156780, 'allow_listed': False}, {'address': '111.1.253.126', 'serviceType': 'gp_gateway', 'addressType': 'active', 'create_time': 1642517055, 'allow_listed': False}, {'address': '111.222.145.51', 'serviceType': 'gp_gateway', 'addressType': 'active', 'create_time': 1608163297, 'allow_listed': False}, {'address': '111.222.333.175', 'serviceType': 'network', 'addressType': 'service_ip', 'node_name': ['ABBB-1']}], 'zone': 'US East', 'addresses': ['111.222.333.175', '111.1.252.150', '111.222.333.250', '111.1.253.126', '111.222.145.51'], 'zone_subnet': ['111.222.0.0/16', '111.103.0.0/16', '111.99.0.0/16', '111.1.128.0/17', '111.222.122.0/18', '111.188.122.0/19', '111.222.0.0/16', '123.41.0.0/16'], 'addresses_v6': [], 'address_details_v6': []}, {'address_details': [{'address': '111.222.70.221', 'serviceType': 'network', 'addressType': 'active', 'node_name': ['AAAAtest', 'DDDDDDNewVPN', 'TTTTTTT.VPN', 'SSSSSSSSSSSSiteVPN', 'LLLLLLSiteVPN', 'PPPPPPPPPSiteVPN', 'DDDDDDVPN', 'MMMMMMSiteVPN', 'PPPPPPPPPVPN', 'ARARARAR', 'GGGGGGGGGVPN', 'NNNNNNNNNEMSVPN']}, {'address': '111.222.220.45', 'serviceType': 'gp_gateway', 'addressType': 'active', 'create_time': 1642906796, 'allow_listed': False}, {'address': '111.222.220.123', 'serviceType': 'gp_gateway', 'addressType': 'active', 'create_time': 1642906795, 'allow_listed': False}, {'address': '111.222.225.136', 'serviceType': 'network', 'addressType': 'service_ip', 'node_name': ['AAAAtest', 'DDDDDDNewVPN', 'TTTTTTT.VPN', 'SSSSSSSSSSSSiteVPN', 'LLLLLLSiteVPN', 'PPPPPPPPPSiteVPN', 'DDDDDDVPN', 'MMMMMMSiteVPN', 'PPPPPPPPPVPN', 'ARARARAR', 'GGGGGGGGGVPN', 'NNNNNNNNNEMSVPN']}], 'zone': 'US West', 'addresses': ['111.222.70.221', '111.222.220.45', '111.222.220.123', '111.222.225.136'], 'zone_subnet': ['111.222.122.0/18', '111.1.128.0/17', '111.222.0.0/16', '111.25.90.0/19', '111.124.64.0/19', '111.188.122.0/19', '111.222.0.0/16', '123.41.0.0/16'], 'addresses_v6': [], 'address_details_v6': []}, {'address_details': [{'address': '111.222.225.126', 'serviceType': 'gp_gateway', 'addressType': 'active', 'create_time': 164711122229, 'allow_listed': False}, {'address': '111.222.65.47', 'serviceType': 'gp_gateway', 'addressType': 'active', 'create_time': 1642906794, 'allow_listed': False}, {'address': '111.1.201.230', 'serviceType': 'gp_portal', 'addressType': 'active', 'create_time': 1608163289}, {'address': '111.1.201.23', 'serviceType': 'gp_portal', 'addressType': 'active', 'create_time': 1608188297}], 'zone': 'US East', 'addresses': ['111.222.225.126', '111.222.65.47', '111.1.201.230', '111.1.201.23'], 'zone_subnet': ['111.222.122.0/18', '111.1.128.0/17', '111.222.0.0/16', '111.25.90.0/19', '111.124.64.0/19', '111.188.122.0/19', '111.222.0.0/16', '123.41.0.0/16'], 'addresses_v6': [], 'address_details_v6': []}, {'address_details': [{'address': '111.1.248.109', 'serviceType': 'gp_gateway', 'addressType': 'active', 'create_time': 1608163300, 'allow_listed': False}, {'address': '111.1.248.110', 'serviceType': 'gp_gateway', 'addressType': 'active', 'create_time': 1608188301, 'allow_listed': False}], 'zone': 'US South', 'addresses': ['111.1.248.109', '111.1.248.110'], 'zone_subnet': ['111.222.0.0/16', '111.25.90.0/19', '111.1.128.0/17', '111.222.122.0/18', '111.188.122.0/19', '111.222.0.0/16', '123.41.0.0/16'], 'addresses_v6': [], 'address_details_v6': []}, {'address_details': [{'address': '111.1.250.110', 'serviceType': 'gp_gateway', 'addressType': 'active', 'create_time': 1608188301, 'allow_listed': False}, {'address': '111.1.250.111', 'serviceType': 'gp_gateway', 'addressType': 'active', 'create_time': 1608163301, 'allow_listed': False}], 'zone': 'US West', 'addresses': ['111.1.250.110', '111.1.250.111'], 'zone_subnet': ['111.222.0.0/16', '111.25.90.0/19', '111.1.128.0/17', '111.222.122.0/18', '111.188.122.0/19', '111.222.0.0/16', '123.41.0.0/16'], 'addresses_v6': [], 'address_details_v6': []}, {'address_details': [{'address': '111.222.185.3', 'serviceType': 'gp_portal', 'addressType': 'active', 'create_time': 1608163291}, {'address': '111.222.92.4', 'serviceType': 'gp_portal', 'addressType': 'active', 'create_time': 1608188305}], 'zone': 'US Southwest', 'addresses': ['111.222.185.3', '111.222.92.4'], 'zone_subnet': ['111.222.122.0/18', '111.222.0.0/16', '111.25.90.0/19', '111.104.6.0/23', '111.1.128.0/17', '111.188.122.0/19', '111.222.0.0/16', '123.41.0.0/16'], 'addresses_v6': [], 'address_details_v6': []}, {'address_details': [{'address': '111.120.72.104', 'serviceType': 'swg_proxy', 'addressType': 'auth_cache_service'}, {'address': '111.96.70.57', 'serviceType': 'swg_proxy', 'addressType': 'auth_cache_service'}, {'address': '35.190.22.129', 'serviceType': 'swg_proxy', 'addressType': 'auth_cache_service'}, {'address': '123.211.39.43', 'serviceType': 'swg_proxy', 'addressType': 'auth_cache_service'}, {'address': '111.117.222.171', 'serviceType': 'swg_proxy', 'addressType': 'auth_cache_service'}], 'zone': 'Global', 'addresses': ['111.120.72.104', '111.96.70.57', '35.190.22.129', '123.211.39.43', '111.117.222.171'], 'zone_subnet': [], 'addresses_v6': [], 'address_details_v6': []}]}

if I do use "python3 format-egress-ips.py --allEgressIPs --outputCsvFile output.csv"
The csv file or json file looks good.

"US Central","remote_network","111.222.255.12","active"
"US Central","gp_gateway","123.1.211.142","active"
"US Central","gp_gateway","111.222.255.125","active"
"US Central","gp_gateway","123.1.211.88","active"
"US Central","gp_gateway","111.222.144.70","active"
"US Central","remote_network","111.222.255.175","service_ip"
"US East","remote_network","111.222.255.175","active"
"US East","gp_gateway","123.1.252.150","active"
"US East","gp_gateway","111.222.255.184","active"
"US East","gp_gateway","123.1.253.126","active"
"US East","gp_gateway","111.222.145.51","active"
"US East","remote_network","111.222.255.175","service_ip"
"US South","remote_network","111.222.70.221","active"
"US South","gp_gateway","137.83.220.45","active"
"US South","gp_gateway","137.83.220.130","active"
"US South","remote_network","111.222.225.136","service_ip"
"US West","gp_gateway","111.222.225.126","active"
"US West","gp_gateway","111.222.65.47","active"
"US West","gp_portal","123.1.201.230","active"
"US West","gp_portal","123.1.201.23","active"
"US South","gp_gateway","123.1.248.109","active"
"US South","gp_gateway","123.1.248.34","active"
"US West","gp_gateway","123.1.250.34","active"
"US West","gp_gateway","123.1.250.111","active"
"US East","gp_portal","111.222.185.3","active"
"US East","gp_portal","111.222.92.4","active"
"Global","swg_proxy","20.190.22.129","auth_cache_service"
"Global","swg_proxy","48.96.70.57","auth_cache_service"
"Global","swg_proxy","130.211.39.43","auth_cache_service"
"Global","swg_proxy","48.117.238.171","auth_cache_service"
"Global","swg_proxy","48.120.72.104","auth_cache_service"

@MrLightBulb
Copy link

Same here for LAB env

@TheScriptGuy TheScriptGuy self-assigned this Jan 30, 2023
@TheScriptGuy TheScriptGuy linked a pull request Jan 30, 2023 that will close this issue
@TheScriptGuy
Copy link
Owner

I believe I've fixed this issue. Please download latest script and test.

@AWCOG
Copy link
Author

AWCOG commented Jan 30, 2023

Confirm it has been fixed. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants