real newbie help needed

From: cAry (dsfgdf_at_afsd.com)
Date: 04/29/04


Date: Thu, 29 Apr 2004 10:31:57 -0600

I am trying to add an exception list ie whitelist.txt to this script but so
far I have had no luck. I have tried exists with the whitelist as a hash.
I have tried an if statement next nothing is working. I know nothing about
perl and am currently on chapter 3 of learning perl but if anyone could help
out.

#!/usr/bin/perl
$limit = 50;
 open (wl, "whitelist.txt");
 @whitelist = <wl>;
 open(P,"pfctl -ss|") || die "can't read state table - $!\n";
   while(<P>){
    $ip = (split(/:/, (split)[1]))[0];
    $table{$ip}++;
   }
  foreach $ip (keys %table){
             push(@block, $ip) if ($table{$ip} > $limit)
   }
#$cmd = "echo @block | xargs pfctl -tDENY -Ta";
#system($cmd);



Relevant Pages

  • Re: How to store multiple value in a Hash for cookies
    ... > I have just started learning PERL and I have written a simple CGI script. ... > user click more than 1 value in each group of checkboxes, ... you will wind up storing a reference to the hash in the cookie. ...
    (comp.lang.perl.misc)
  • How to store multiple value in a Hash for cookies
    ... I have just started learning PERL and I have written a simple CGI script. ... I have a group of checkboxes: ... BUT I'm having problem storing multiple values into a hash. ...
    (comp.lang.perl.misc)
  • Re: Constant not working in hash...
    ... The above prints, "P/N", as I would expect. ... Later in the script I ... because the hash think "PART_NUMBER" is a key name instead of a constant. ... Good luck! ...
    (perl.beginners)
  • Re: Search & replace, but increment with every replace
    ... I gave it a whirl though and have not had any luck yet. ... I simplified my script to contain just this line now: ... Field one of the file is strictly integers however, ... This will save some folks many hours of work and they will be ...
    (comp.unix.shell)
  • Re: function function question from a newbie
    ... I'm trying to script a web survey and I'm not having any luck. ... form elements with IDs that contain non-valid identifier characters. ... Strings are strings when quoted, ...
    (comp.lang.javascript)