monger has asked for the wisdom of the Perl Monks concerning the following question:
OK - that's roughly it. I'll have to work on the regex to carefully get just what I want. I'll also write in output files to mate with the arrays at the beginning. Now, questions:my $regex = "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"; my @win_ports = (135, 137, 139, 445, 1025, 1433, 1434); my @trojan_ports = (113, 15118, 4899); my $file = "C:\\fw.log"; open LOG, "$file" || die "Can't open fwlog: $!"\n; while (<LOG>) { foreach $port(@win_ports) { if (/$regex\/$port/g) { print }
1) What would be the fastest way to chunk through a file, looking for say, 10-20 ports? I could be dealing with files over 100MB, so I want to make sure it's optimized as much as possible.
2) I would like to print them to the file grouped by port, and from there, I can do some more analysis. Suggestions for capturing, for instance, all the matches for port 445 and then writing them to the $win_ports.txt file, then concatenating the matches for 135, etc?
Thanks, monger
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Firewall Log Analysis - port matrices
by kvale (Monsignor) on Mar 17, 2005 at 19:43 UTC | |
|
Re: Firewall Log Analysis - port matrices
by jhourcle (Prior) on Mar 17, 2005 at 19:36 UTC | |
|
Re: Firewall Log Analysis - port matrices
by cazz (Pilgrim) on Mar 18, 2005 at 02:31 UTC |