Find Single Rule - Pan Os Python

cancel
Showing results for 
Search instead for 
Did you mean: 

Find Single Rule - Pan Os Python

L0 Member

We are in the process of renaming all our FW rules.  I'd like to run a python script with Pan OS Python.  The script would look at a CSV file where in column1 is the current name, column2 is the new name, and column3 is an Audit Comment.  I'm able to do the first two tasks but can't for the life of me figure out how to tell python to find the name of a single rule.  Anyone know how to tell python to pull in all Security Rules then tell it what rule name to look for.  Once I have that I'm done with he code and would be happy to share if someone else is trying to do it this way.  

1 REPLY 1

L4 Transporter

There's an example script in the pan-os-python repo that shows how to retrieve all the security rules and checks the names for a particular one.  This should be a good starting point:

 

https://github.com/PaloAltoNetworks/pan-os-python/blob/develop/examples/ensure_security_rule.py

Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!