Hello monks
Back again for some advice. I wrote a script to automate batch-banning of IPs on our netscaler load balancer. This is a _really_ simple script but for some reason this outputs nothing.
#!/usr/bin/perl
use strict;
my $workdir=~/txt;
open BAD-IPS, "< $workdir/bad-ips" or die " Couldn't open file: $!";
my $i = 1;
while (my $line = <BAD-IPS>) {
chomp $line;
print "add ns simpleacl bp-search-spammer$i DENY -srcIP $line -T
+TL 43200";
print "hello thar!\n"; # debug line also prints nothing
}
close BAD-IPS;
[bluethundr@lcent5-1:~/perl] $:./bad_ips.pl
[bluethundr@lcent5-1:~/perl] $:
All the ip list is, is a list of suscpected spammers one per line.
something kinda like this... totally fake of course, just in case I'm mistaken in identifying some of the IPs as those of dirty dirty spammers
123.45.67.2
123.45.67.3
123.45.67.4
123.45.67.5
123.45.67.6
Srsly.. nothing fancy at all. I'm hoping I'm missing something obvious as to why this script has no output at all.
I've tried this out on a few hosts including the one I developed it on, and 2 cloud instances. No love. I've had folks in IRC tell me "works for me", but I'm hoping I can get to the bottom of the issue here.
thanks monks!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.