#!/usr/bin/perl -T ## User setup # # Make the password hash using the command: # # perl -e 'print crypt("", ""),"\n";' # # where is the human readable code on the UPC label, # and is the password's salt. See crypt(3) for more info. # Example: # # perl -e 'print crypt("074851082416", "ff"),"\n";' # # You may want to cut the last part of you UPC label off. # $ENV{PATH} = "/bin:/usr/local/bin:/sbin:/usr/bin"; $pass = "ff4OW4qGgOZKo"; $error = 0; @arg1 = ("/bin/stty", "-echo"); @arg2 = ("/bin/stty", "echo"); @arg3 = ("/bin/bash", "-login"); # ## End user setup system (@arg1) == 0 || die "system @arg1 failed; $?"; print "\33[H\33[J". "\t\tGreen Bay Professional Packet Radio Advanced Login\n\n". "\n\nPlease swipe your card now: "; $seq = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-'; sub decode { ($encoded) = @_; @s = map { index($seq,$_); } split(//,$encoded); $l = ($#s+1) % 4; if ($l) { if ($l == 1) { print " Error!"; return; } $l = 4-$l; $#s += $l; } $r = ''; while ($#s >= 0) { $n = (($s[0] << 6 | $s[1]) << 6 | $s[2]) << 6 | $s[3]; $r .=chr(($n >> 16) ^ 67) . chr(($n >> 8 & 255) ^ 67) . chr(($n & 255) ^ 67); @s = @s[4..$#s]; } $r = substr($r,0,length($r)-$l); return $r; } while (1) { $s = ; chomp($s); @fields = split(/\./,$s); @results = map(decode($_), @fields[1..$#fields]); if ($#results == 2) { #print "Serial: $results[0]\n"; #print "Type: $results[1]\n"; #print "Code: $results[2]\n"; print " Processing ...\n"; } else { #print join("\n",@results); } if (crypt($results[2], $pass) eq $pass) { print "\nYour login has been accepted.\nRock on.\n\n"; system (@arg2) == 0 || die "system @arg2 failed; $?"; system (@arg3) == 0 || die "system @arg3 failed; $?"; exit 0; } else { $error = $error + 1; if ($error == "3") { print "\nLogin error #3. Try again later.\n\n"; system (@arg2) == 0 || die "system @arg2 failed; $?"; exit 1; } print "\nLogin error #$error. Please try again.\n\n"; print "Please swipe your card now: "; } }