====== PFSense - pfBlockerNG - IP - Get IPs from JSON files ======
pfBlockerNG-devel includes the jq json parsing application.
You can use that tool to slice and dice JSON files into a list of IPs.
----
See: [[Blocklists:Microsoft:Get Microsoft URLs, IP addresses and Ports|Get Microsoft URLs, IP addresses and Ports]]
See: [[Blocklists:Microsoft:Microsoft Teams|Microsoft Teams]]
----
For Example
Download the file:
fetch -o /tmp/o365 "https://endpoints.office.com/endpoints/worldwide?noipv6&ClientRequestId=b10c5ed1-bad1-445f-b386-b919946339a7"
----
List all O365 ServiceAreas:
jq -r '.[].serviceArea' /tmp/o365 | sort | uniq
returns:
Common
Exchange
SharePoint
Skype
----
Collect all IPs for the Exchange Service Area and aggregate the IPs using iprange:
jq -r '.[] | select(.serviceArea=="Exchange") | select(.ips) .ips[]' /tmp/o365 | iprange
----
**NOTE:** These are just examples... you can modify the commands to suit your needs.
----
Similar approach is available for Amazon AWS:
https://www.reddit.com/r/pfBlockerNG/comments/9vwkmm/ip_ranges_for_amazon_aws/