Dec-04-2017, 10:28 PM
(This post was last modified: Dec-04-2017, 10:32 PM by bradnealip.)
I have about 10K lines of JunOS (srx1500) FW output, from which I need to create individual dictionaries for each "Policy". I only care about source & destination addresses, not ports & protocols. Is there an easy way to do this?
Here's an example of the(massaged) firewall output:
I need to turn a bunch of ^^that into something like this:
Here's an example of the(massaged) firewall output:
Quote:Policy: RULE_12345, action-type: permit, State: enabled, Index: 153, Scope Policy: 0
Source addresses:
SUBNET_1: 10.1.1.0/24
SUBNET_2: 10.2.2.0/24
Destination addresses:
SUBNET_3: 10.3.3.0/24
SUBNET_4: 10.4.4.0/24
Policy: RULE_23456, action-type: permit, State: enabled, Index: 153, Scope Policy: 0
Source addresses:
SUBNET_1: 10.1.1.0/24
Destination addresses:
SUBNET_3: 10.3.3.0/24
SUBNET_5: 10.5.5.0/24
I need to turn a bunch of ^^that into something like this:
Quote:RULE_12345 = {"sources": ['10.1.1.0/24', '10.2.2.0/24'], "destinations":['10.3.3.0','10.4.4.0']}
RULE_23456 = {"sources": ['10.1.1.0/24'], "destinations":['10.3.3.0','10.5.5.0']}