User Tools

Site Tools


pfsense:pfblockerng:ip:get_ips_from_json_files

This is an old revision of the document!


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


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.

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

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki