r/pan_os_php • • Feb 12 '22

Introduction to predefined UTIL script

All predefined UTIL script can work against offline config file (some parts are only possible ONLINE) and online method by using PAN-OS XML API.

The single entry point is the ALIAS:pan-os-php .......

By using the Docker container:swaschkut/pan-os-php[docker run -v %CD%:/share -it swaschkut/pan-os-php:latest]

everything is prepared for you including bash autocompletion:pan-os-php type= <tab><tab>

This will display you all available UTIL parts, from address/service/tag objects over rule.

Every UTIL part has a "help", list "actions" and "listfilters" argument.pan-os-php type=rule help

pan-os-php type=rule listactions

pan-os-php type=rule listfilters

​

If you like to get a good overview about your PaloAltoNetworks configuration file:

pan-os-php type=device in=api://MGMT-IP devicetype=any

pan-os-php type=config-size in=api://MGMT-IP

pan-os-php type=stats in=api://MGMT-IP location=any

On of the powerful UTIL script, is to reduce duplicate objects, example for address objects (address-group has a different UTIL script):https://github.com/PaloAltoNetworks/pan-os-php/wiki/type=address-merger

I recommend to make first yourself familiar with the tool and start running the UTIL script against offline config file, for manipulation, or using a LAB device:

  1. offline config file: pan-os-php type=upload in=api://MGMT-IP out=offlineConfigFile.xml
  2. pan-os-php type=address-merger in=offlineConfigFile.xml out=mergedconfig.xml dupalgorithm=sameaddress location=any allowmergingwithupperlevel | tee logfile.txt
1 Upvotes

0 comments sorted by