Skip to content

Commit fa14dee

Browse files
committed
Merge branch 'worr-master'
2 parents 1fa80ae + fdef3e7 commit fa14dee

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

wall_of_sheep.pl

+17-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,17 @@
88
use constant REVEAL_DIVISOR => 30;
99
use constant PASS_LENGTH => 20;
1010
use constant PASS_SUFFIX => '*' x PASS_LENGTH;
11+
use constant WHITELIST_FILE => '.whitelist';
1112

12-
my %idiots;
13+
my (%idiots, @whitelist);
14+
15+
# Newline delimited list of hostnames
16+
if ( -f WHITELIST_FILE) {
17+
open (my $fh, WHITELIST_FILE);
18+
@whitelist = <$fh>;
19+
map { chomp } @whitelist;
20+
close $fh;
21+
}
1322

1423
#Attempt to prevent screen blanking
1524
printf ("\033[9;%ld]", 0);
@@ -30,14 +39,20 @@
3039
my $pass = $8;
3140
my $ip_addr = pack("C4", $2,$3,$4,$5);
3241
my ($hostname) = (gethostbyaddr($ip_addr, 2))[0];
42+
43+
next if ($hostname ~~ @whitelist);
44+
next if ($ip ~~ @whitelist);
45+
3346
$idiots{$ip}++;
3447

3548
my $scrubbed_pass = "";
3649
if(length($pass) > 1){
3750
$scrubbed_pass=substr($pass,0,($idiots{$ip} / REVEAL_DIVISOR) + 1).PASS_SUFFIX;
51+
$scrubbed_pass = $pass if ($scrubbed_pass =~ /$pass/);
3852
}
3953
else{
40-
$scrubbed_pass=PASS_SUFFIX;
54+
# What the hell, this user is an idiot. Let him suffer.
55+
$scrubbed_pass = $pass;
4156
}
4257

4358
pick_color($protocol);

0 commit comments

Comments
 (0)