Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^3: Sifting through firewall rules using a script

by networkdude (Initiate)
on Jan 10, 2022 at 01:31 UTC ( [id://11140311]=note: print w/replies, xml ) Need Help??


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

    False alarm - it still doesn't work. Not even with the latest awesome recommendations. See my other replies...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11140311]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-26 07:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found