- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
09-29-2022 12:37 PM
We have several firewall managed via Panorama. I want to pull the rulebase from each firewall to get the Hit Count and Last Hit date. I've got partial script, but I'm lost on accessing dict.
Here are the two links that I've been using:
https://pan-os-python.readthedocs.io/en/latest/module-policies.html#panos.policies.RulebaseHitCount
https://pan-os-python.readthedocs.io/en/latest/_modules/panos/policies.html#RulebaseHitCount
#!/usr/bin/env python
import sys
import panos
from panos.firewall import Firewall
from panos.policies import Rulebase, SecurityRule, RulebaseHitCount
HOSTNAME = ""
USERNAME = " "
PASSWORD = " "
fw = panos.firewall.Firewall(HOSTNAME, USERNAME, PASSWORD)
rulebase = RulebaseHitCount('security', rules=None, all_rules=False)
10-12-2022 01:15 PM
Hi,
have you resolved this issue?
10-12-2022 03:15 PM
Use the opstate
namespace hanging off of the panos.policies.SecurityRule
instance. There's a whole section of the documentation devoted to opstate stuff, you can see it here:
https://pan-os-python.readthedocs.io/en/latest/getting-started.html#the-opstate-namespace
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!