| verzia 1.2, 2002/06/24 18:18:08 |
verzia 1.3, 2002/06/26 13:35:59 |
|
|
| ############################################################################# |
############################################################################# |
| |
|
| # |
# |
| # string constants |
|
| # |
|
| my $STR1 = 'Zadaj vstupne heslo:'; |
|
| my $STR2 = 'Password:'; |
|
| |
|
| # |
|
| # output (1 or 0) |
# output (1 or 0) |
| # |
# |
| my $OUTPUT = 0; |
my $OUTPUT = 0; |
| Riadok 62 my $CMD_BASE = "stty --file '/dev/$TTY'" |
|
| Riadok 56 my $CMD_BASE = "stty --file '/dev/$TTY'" |
|
| # |
# |
| sub do_stty |
sub do_stty |
| { |
{ |
| my $cmd; |
my $cmd; |
| my $onoff; |
my $onoff; |
| |
|
| if ($SIL) { |
if ($SIL) { |
| $onoff = 'on'; |
$onoff = 'on'; |
| $cmd = "$CMD_BASE echo"; |
$cmd = "$CMD_BASE echo"; |
| } else { |
} else { |
| $onoff = 'off'; |
$onoff = 'off'; |
| $cmd = "$CMD_BASE -echo"; |
$cmd = "$CMD_BASE -echo"; |
| } |
} |
| |
|
| system($cmd); |
system($cmd); |
| print STDERR "$PRG: turning $onoff echo ($cmd)\n" if $VERBOSE; |
print STDERR "$PRG: turning $onoff echo ($cmd)\n" if $VERBOSE; |
| |
|
| $SIL = !$SIL; |
$SIL = !$SIL; |
| } |
} |
| |
|
| # |
# |
|
|
| my $line; |
my $line; |
| |
|
| # |
# |
| |
# command line parameters test (@ARGV doesn't contain program name) |
| |
# |
| |
if (scalar(@ARGV) < 1) { |
| |
print("pwdhide.pl - written and copyrights by Nepto & Wolcano\n"); |
| |
print("Usage: $PRG <regexp-to-hide>\n"); |
| |
exit 1; |
| |
} |
| |
|
| |
# |
| |
# string to hide |
| |
# |
| |
my $STR = $ARGV[0]; |
| |
|
| |
# |
| # System init |
# System init |
| # |
# |
| select(STDIN); $| = 1; # make unbuffered |
select(STDIN); $| = 1; # make unbuffered |
| Riadok 99 print STDERR "$PRG: starting...\n" if $V |
|
| Riadok 107 print STDERR "$PRG: starting...\n" if $V |
|
| # main loop |
# main loop |
| # |
# |
| while ( $input_data = <STDIN> ) { |
while ( $input_data = <STDIN> ) { |
| foreach $raw_line ( split ( /\n/, $input_data ) ) { |
foreach $raw_line ( split ( /\n/, $input_data ) ) { |
| $line = $raw_line; |
$line = $raw_line; |
| $line =~ s/^\s*//g; |
$line =~ s/^\s*//g; |
| $line =~ s/\s*$//g; |
$line =~ s/\s*$//g; |
| next if !length($line); |
next if !length($line); |
| |
|
| if ( ( $SIL == 0 && ( $line =~ /^$STR1.*/ || $line =~ /^$STR2.*/ ) ) |
do_stty() if ($SIL != 0); |
| || ( $SIL != 0 ) ) { |
do_stty() if ( $SIL == 0 && $line =~ /$STR/ ); |
| |
|
| do_stty(); |
# print '*******************'.$_."%%\n" if $OUTPUT; |
| } |
print STDOUT $raw_line if $OUTPUT; |
| |
} |
| #print '*******************'.$_."%%\n" if $OUTPUT; |
|
| print STDOUT $raw_line if $OUTPUT; |
|
| } |
|
| } |
} |
| |
|
| # restore input echo if it is turned off |
# restore input echo if it is turned off |
| do_stty() if ($SIL); |
do_stty() if ($SIL != 0); |
| |
|
| print STDERR "$PRG: terminating...\n" if $VERBOSE; |
print STDERR "$PRG: terminating...\n" if $VERBOSE; |
| |
|