I have been playing
with ipblocker from ipblocker.org and modified it to take a list of attackers
from an IDS. I wanted to do some error checking to pull out the "already blocked
ip's" before sending it to the original script. I can't figure out why the
delete $hash{'$x'} won't work in my script. Can someone tell
why?
'query.outsidescanners.result': file
contains
(2 row
affected)
1.1.1.1
3.3.3.3
#!/usr/bin/perl
-w
use diagnostics;
use strict;
our $dir='/usr/local/apache/ipblocker';
our $file='query.outsidescanners.result';
our @nodes=();
our ($line)=0;
our %hash=();
open (BLK, "$dir/$file") or die "Cannot open file: $!";
foreach $line(<BLK>){
if ($line =~/.*row.*/i){
}else{
$hash{$line}="new";
}}
close(BLK);
our $a='3.3.3.3';
delete ($hash{$a});
print keys %hash;
use diagnostics;
use strict;
our $dir='/usr/local/apache/ipblocker';
our $file='query.outsidescanners.result';
our @nodes=();
our ($line)=0;
our %hash=();
open (BLK, "$dir/$file") or die "Cannot open file: $!";
foreach $line(<BLK>){
if ($line =~/.*row.*/i){
}else{
$hash{$line}="new";
}}
close(BLK);
our $a='3.3.3.3';
delete ($hash{$a});
print keys %hash;
*******The results
of print keys %hash
1.1.1.1
3.3.3.3
Thanks,
Rich
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>