|
5 | 5 |
|
6 | 6 | use Term::ANSIColor;
|
7 | 7 |
|
| 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 | + |
8 | 14 | #Attempt to prevent screen blanking
|
9 | 15 | printf ("\033[9;%ld]", 0);
|
10 | 16 |
|
|
16 | 22 |
|
17 | 23 | while(my $line = <>){
|
18 | 24 | #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: (.*)/){ |
20 | 26 | my $protocol = $1;
|
21 | 27 | my $ip = "$2.$3.$4.$5";
|
22 | 28 | my $port = $6;
|
23 | 29 | my $user = $7;
|
24 | 30 | my $pass = $8;
|
25 | 31 | my $ip_addr = pack("C4", $2,$3,$4,$5);
|
26 | 32 | my ($hostname) = (gethostbyaddr($ip_addr, 2))[0];
|
| 33 | + $idiots{$ip}++; |
27 | 34 |
|
28 | 35 | my $scrubbed_pass = "";
|
29 | 36 | if(length($pass) > 1){
|
30 |
| - $scrubbed_pass=substr($pass,0,1)."*****"; |
| 37 | + $scrubbed_pass=substr($pass,0,($idiots{$ip} / REVEAL_DIVISOR) + 1).PASS_SUFFIX; |
31 | 38 | }
|
32 | 39 | else{
|
33 |
| - $scrubbed_pass="*******"; |
| 40 | + $scrubbed_pass=PASS_SUFFIX; |
34 | 41 | }
|
35 | 42 |
|
36 | 43 | pick_color($protocol);
|
|
43 | 50 | $hostname = "";
|
44 | 51 | }
|
45 | 52 | $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); |
48 | 55 | print "\n";
|
49 | 56 | print color("reset");
|
50 | 57 | }
|
|
0 commit comments