Скачать American Megatrends CMOS password detector

22.04.1994
Скачать файл (1,24 Кб)




uses Dos, Crt;
 
var
  code: byte;
  password: array[0..5] of byte;
 
function DeCode (symbol: byte): byte; assembler;
asm
  xor  bl,bl
  mov  al,symbol
@@cont:
  test    al,$80
  jz  @@c1
  test al,$61
  jnp  @@c2
  stc
@@c2:
  rcl      al,1
  jmp  @@check
@@c1:
  test al,$61
  jp  @@c3
  stc
@@c3:
  rcl  al,1
@@check:
  inc  bl
  cmp  al,code
  jne  @@cont
  xor  ax,ax
  mov  al,bl
end;
 
function ReadByte(address: byte): byte; assembler;
asm
  xor ax,ax
  mov al,address
  out 70H,al
  in al,71H
end;
 
procedure GetPassword;
var
  i: byte;
  b: byte;
begin
  code:=(ReadByte($37) and $F0);
  for i:=0 to 5 do
    begin
      b:=ReadByte($38+i);
      if b=0 then exit;
      password[i]:=DeCode(b);
      code:=b
    end
end;
 
var i: byte;
    ch: char;
 
BEGIN
for i:=0 to 5 do
 password[i]:=0;
writeln('American Megatrends CMOS password detector. ',
        '(C) BocoSoft 1993.');
writeln;
writeln('WARNING: This program will take effect only on the AMI ',
        'BIOSes !');
repeat
  write('Have You got the AMI BIOS (Y/N) ? ');
  repeat until keypressed;
  ch:=UpCase(ReadKey);
  writeln(ch);
  if ch = 'N' then Halt(1);
until ch = 'Y';
writeln;
writeln('Sorry, but some machines can be halted by this program !');
repeat
  write('Would You like to continue (Y/N) ? ');
  repeat until keypressed;
  ch:=UpCase(ReadKey);
  writeln(ch);
  if ch = 'N' then Halt(1);
until ch = 'Y';
GetPassword;
i:=0;
writeln;
if password[i] = 0
  then begin
    writeln('Can''t detect CMOS password !');
    writeln;
    writeln('Maybe :');
    writeln(' - Your BIOS is non-AMI');
    writeln(' - Your CMOS hasn''t got any passwords :-)');
    writeln(' - Password is empty.');
  end
  else begin
    write('CMOS password: ');
    for i:=0 to 5 do
    if password[i] <> 0 then write(char(password[i]));
    writeln;
  end;
writeln;
writeln('Press any key...');
repeat until keypressed;
ch:=readkey;
END.