Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!batcomputer!cornell!uw-beaver!milton!ogicse!intelhf!ichips!iWarp.intel.com!pdxgate!jove.cs.pdx.edu!caster From: caster@jove.cs.pdx.edu (Brad J. Caster) Newsgroups: comp.lang.pascal Subject: Password Program (Long!) Message-ID: <2767@pdxgate.UUCP> Date: 30 May 91 04:09:43 GMT Article-I.D.: pdxgate.2767 Sender: news@pdxgate.UUCP Reply-To: caster@jove.cs.pdx.edu (Brad J. Caster) Distribution: usa Organization: Portland State University, Portland, OR Lines: 253 Well, if a password program is executed from config.sys, then Ctrl-Break & Ctrl-C cannot break out of it. So it was futile to write a complicated program for that purpose. There may be something of use here anyway. The following is the Turbo Pascal (v5.0) source code I ended up with. It's a memory resident password program. It is armed when you first run it. BTW, does anyone know how to keep someone from just booting up from a floppy? Use: Run program with password as argument. With no argument, the default password is 'hello'. It starts out in Locked mode. To alternate between Locked and Unlocked modes, press both shift keys simultaneously, then type in password. The beep lets you know if you type it in correctly. You can "Lock" your computer any time you want, but no guarantees are made as to whether it will "Unlock" safely when you want. Be sure to save your data first. It will Lock permanently if someone tries typing on it. It can be run from config.sys, but beware that your password will be changed to upper-case by DOS. (ie. INSTALL=PASSWORD.EXE knockknock) Following the source code, is the UUencoded executable. ------- Cut Here ------- {$M 1024,0,0} program Password; uses crt,dos; var PW : string; C,P,L : byte; K : char; Pntr : pointer; Locked,InUse,Stop : boolean; Regs : registers; procedure Bleep; begin sound(128); delay(128); sound(512); delay(128); nosound; end; procedure Bleep2; begin sound(512); delay(128); sound(128); delay(128); nosound; end; procedure GetKey; interrupt; begin Intr($64,Regs); if not InUse then begin InUse := true; if Locked then begin C := C + 1; if C > 20 then repeat Bleep; until false; end; if (Mem[$0040:$0017] and $03 = $03) then begin P := 1; Stop := false; repeat Regs.AH := $00; intr($16,Regs); K := chr(Regs.AL); if K = PW[P] then P := P + 1 else Stop := true; until Stop or (P > L); if not Stop then if Locked then begin Bleep2; Locked := false; end else begin Bleep; C := 0; Locked := true; end; end; end; InUse := false; end; begin InUse := true; getintvec($64,Pntr); writeln; if Pntr = nil then begin C := 0; Locked := true; if ParamCount > 0 then PW := ParamStr(1) else PW := 'hello'; L := length(PW); writeln('Armed and Dangerous'); Bleep; getintvec($09,Pntr); setintvec($64,Pntr); setintvec($09,@GetKey); keep(0); end else writeln('Password Cannot be Loaded'); InUse := false; end. ------- Cut Here ------- begin 644 password.exe M35J 0H *@ - '@ > !C 0 $ "$ 0 ' @ 1 &@ ", L M ,0 #\ !( 40 %H !C : 'H ") X0 (7 %6)Y3' FD0"EP"X@ !0FL8" M-0"X@ !0FIX"-0"X )0FL8"-0"X@ !0FIX"-0":\P(U (GL7<-5B>4QP)I$ M I< N "4)K& C4 N( 4)J> C4 N( 4)K& C4 N( 4)J> C4 FO,"-0") M[%W#4%-14E97'@95B>6X)P&.V+!D4+]* 1Y7F@L *0" /DA,_^O[N$ 4+\7 5YH+ "D H$H!HD$!H#\!,.2+^(J% M/@ Z!D$!=0N@/P$PY$"B/P'K!<8&2 $!@#Y( 0!U": _ 3H&0 %VMX ^2 $ M=1Z /D8! '0*Z S_Q@9& 0#K#>C+_L8&/@$ Q@9& 0'&!DP <8&1P$!L&10OT(!'E>:; I M +]R AY7FK 'EP":#@*7 *%" 0L&1 %T ^FA ,8&/@$ Q@9& 0&:N@B7 G M?A^-O@#_%E>X 0!0FFL(EP"_/@ >5[C_ %":=P*7 .L3OU !#E>_/@ >5[C_ M %":=P*7 * ^ *) ;]R AY7OU8!#E5YIL "D L&10_S9$ ?\V0@&:A I + )4+AN +H %)0FH0 *0 Q MP%":EP I .L_:@$.5S' 4)HM")< FK 'EP":#@*7 ,8&1P$ B>Q= M,<":V "7 7EI96[ A4%-14E95'HOLG+M% Y3,]N.VXI>#-'CT>/%'QY3 MQ78(_*U0K8O8K8O(K8O0K8OHK5"MB_BM4*V.P!]>6/K+G 9758OLQ'X0_*N+ MPZN+P:N+PJM8JXO&JUBKC-BK6*M8JQ]=R@8 58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