#! perl -w
use Term::ReadKey;
print "password: ";
ReadMode('noecho');
$password=ReadLine(0);
#keep it weakly encrypted while in memory
$password =~ y[A-Za-z][N-ZA-Mn-za-m];

ReadMode(0);

for(;;){
    if (open FO,"|kinit"){
        $password =~ y[A-Za-z][N-ZA-Mn-za-m];
        print FO $password;
        $password =~ y[A-Za-z][N-ZA-Mn-za-m];
        close FO;
        $code=system('aklog');
        if($code){
            print "",scalar(localtime),": aklog failed code=$code\n";
        }
    } else {
        print "",scalar(localtime),": failed to kinit\n";
    }
    sleep 3600;
}
