Is it possible to read firewall rules in Windows from Python?

467 Views Asked by At

I am making an auditing type tool and I want to pull the firewall rules of the computer. I am using Python and I can only find sources on how to add rules to the firewall, but not read them. Is this possible?

1

There are 1 best solutions below

2
On

i'm not using python that's why i can't help you with coding, but as everything in windows, firewall rules are storing in registry too, firewall rules are storing under;

HKLM\System\CurrentlControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules.

I believe if you can read windows registry with python,then you can read the rules.

Detailed source : https://schatzforensic.com/insideout/2014/12/was-the-firewall-blocking-traffic-identifying-active-firewall-rules-using-registry-analysis/#:~:text=The%20firewall%20rules%20are%20stored,%5CParameters%5CFirewallPolicy%5CFirewallRules.