in reply to Re^3: Create a ipset for blocking networks based on internet sources
in thread Create a ipset for blocking networks based on internet sources
Thanks jwkrahn, I really appreciate the corrections! I have included them in the script and read the section on error variables in perlvar.
Also, my first version used Moose (influenced by the book "Modern Perl"). After looking at the script, and comparing it with the bash scripts, it took more time and resources. I guess that Moose is for larger and more complex projects, so I have rewritten in what I assume is "procedural programming". It has been trivial to have Moose out, transforming the package into a subroutine.
One thing is puzzeling me is the regex. In a file in this format:
Start End Netblock Attacks Name Country email 116.45.99.0 116.45.99.255 24 1799 46.21.150.0 46.21.150.255 24 1708 121.243.146.0 121.243.146.255 24 1446
Applying this regex:
qr/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/mGives me:
116.45.99.0 46.21.150.0 121.243.146.0
And this regex:
qr/^((\d{1,3}\.){3}\d{1,3})/mGimes me:
116.45.99.0 99. 46.21.150.0 150. 121.243.146.0 146.
I would expect the same result.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Create a ipset for blocking networks based on internet sources
by jwkrahn (Abbot) on Apr 25, 2012 at 19:10 UTC | |
by mimosinnet (Beadle) on Apr 27, 2012 at 17:23 UTC |