Skip to content

Commit 6a6f7f4

Browse files
committed
Reveals more of the password every offense
- Configurable!
1 parent 8a3dc87 commit 6a6f7f4

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

wall_of_sheep.pl

+12-5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55

66
use Term::ANSIColor;
77

8+
use constant REVEAL_DIVISOR => 30;
9+
use constant PASS_LENGTH => 20;
10+
use constant PASS_SUFFIX => '*' x PASS_LENGTH;
11+
12+
my %idiots;
13+
814
#Attempt to prevent screen blanking
915
printf ("\033[9;%ld]", 0);
1016

@@ -16,21 +22,22 @@
1622

1723
while(my $line = <>){
1824
#Hope you like regexp.
19-
if ($line =~ /^(\w+) : (\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3}):(\d{1,10}) -> USER: (.+) PASS: (.+)/){
25+
if ($line =~ /^(\w+) : (\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3}):(\d{1,10}) -> USER: (.+) PASS: (.*)/){
2026
my $protocol = $1;
2127
my $ip = "$2.$3.$4.$5";
2228
my $port = $6;
2329
my $user = $7;
2430
my $pass = $8;
2531
my $ip_addr = pack("C4", $2,$3,$4,$5);
2632
my ($hostname) = (gethostbyaddr($ip_addr, 2))[0];
33+
$idiots{$ip}++;
2734

2835
my $scrubbed_pass = "";
2936
if(length($pass) > 1){
30-
$scrubbed_pass=substr($pass,0,1)."*****";
37+
$scrubbed_pass=substr($pass,0,($idiots{$ip} / REVEAL_DIVISOR) + 1).PASS_SUFFIX;
3138
}
3239
else{
33-
$scrubbed_pass="*******";
40+
$scrubbed_pass=PASS_SUFFIX;
3441
}
3542

3643
pick_color($protocol);
@@ -43,8 +50,8 @@
4350
$hostname = "";
4451
}
4552
$user = sprintf '%.*s', 16, $user;
46-
$pass = sprintf '%.*s', 7, $scrubbed_pass;
47-
print pack("A10 A16 A29 A17 A8", $protocol, $ip, $hostname, $user, $pass);
53+
$pass = sprintf '%.*s', PASS_LENGTH, $scrubbed_pass;
54+
print pack("A10 A16 A29 A17 A".PASS_LENGTH, $protocol, $ip, $hostname, $user, $pass);
4855
print "\n";
4956
print color("reset");
5057
}

0 commit comments

Comments
 (0)