#!/usr/bin/perl # # lock - a tool to lock a terminal. # # Copyright (C) 1999 Satoru Takabayashi # All rights reserved. # This is free software with ABSOLUTELY NO WARRANTY. # # You can redistribute it and/or modify it under the terms of # the GNU General Public License version 2. # #$passwd = (getpwuid ($<))[1]; #$salt = substr($pwd, 0, 2); system("stty -echo"); do { print "Key: "; $key = ; chop($key); print "\n"; print "Again: "; $again = ; chop($again); print "\n"; } while ($key ne $again); print "$ENV{'USER'}'s terminal has been locked!\n"; system("stty intr '' kill '' eof '' susp '' start '' stop ''"); while () { chop; # last if (crypt($_, $salt) eq $passwd); last if ($key eq $_); } system("stty intr ^C kill ^U eof ^D susp ^Z start ^Q stop ^S echo");