in reply to Re^2: Sifting through firewall rules using a script
in thread Sifting through firewall rules using a script
I almost got it to work but no dice. It matches everything. Must be the if line. What does the regex m{($RE{net}{IPv4})}g actually do here? I know what the line means from the documentation for that module, but what is the exact purpose in this script?
use strict; use warnings; use Regexp::Common qw( net ); open ( IPS, '<', "TEST_IPS.txt" ) || die "can't open IPS!"; open ( RULES, '<', "test_rules.txt" ) || die "can't open file!"; my %interesting_ips; while( <IPS> ) { chomp; $interesting_ips{ $_ } = 1; } while( my $fw_line = <RULES> ) { if ($fw_line =~ m{($RE{net}{IPv4})}g ) { print ( $fw_line); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Sifting through firewall rules using a script
by networkdude (Initiate) on Jan 11, 2022 at 01:02 UTC |