User Tools

Site Tools


pfsense:pfblockerng:ip:get_ips_from_json_files

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: Get Microsoft URLs, IP addresses and Ports

See: 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/

pfsense/pfblockerng/ip/get_ips_from_json_files.txt · Last modified: 2021/02/08 00:19 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki