WEB开发网
开发学院软件开发Delphi AccesS密码的打击 阅读

AccesS密码的打击

 2006-02-04 13:26:06 来源:WEB开发网   
核心提示:type TForm1 = class(TForm) Button1: TButton; Chk2000: TCheckBox; Edit1: TEdit; Button2: TButton; Edit2: TEdit; OpenDialog1: TOpenDialog; Button3: TButto

type
  TForm1 = class(TForm)
   Button1: TButton;
   Chk2000: TCheckBox;
   Edit1: TEdit;
   Button2: TButton;
   Edit2: TEdit;
   OpenDialog1: TOpenDialog;
   Button3: TButton;
   Label1: TLabel;
   PRocedure Button1Click(Sender: TObject);
   procedure Button2Click(Sender: TObject);
   procedure Button3Click(Sender: TObject);
   procedure Edit2KeyPress(Sender: TObject; var Key: Char);
  private
  procedure WMDropFiles(var Msssage: TMessage); message WM_DROPFILES ;
   { Private declarations }
  public
   { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

CONST
  xorString:array[0..12]of byte=
   ( $86, $FB, $EC, $37,
    $5D, $44, $9C, $FA,
    $C6, $5E, $28, $E6,$13 );
  xorString2:array[0..20]of byte=
   ( $D3, $EC, $08, $9C,
    $93, $28, $46, $8A,
    $01, $7B, $A0, $DF,
    $22, $13, $9A, $B1,
    $61, $79, $C7, $7C,$5B);

procedure TForm1.WMDropFiles(var Msssage: TMessage);
begin
  ShowMessage('Hello Boy');
end;
procedure TForm1.Button1Click(Sender: TObject);


VAR
passBuff: array[0..14]of byte;
pass: array[0..14]of char;
passBuff2: array[0..40]of byte;
pass2: array[0..20]of char;
B: Byte;
F:TFileStream;
I,j:integer;

begin
  file://ShowMessage(Char($86)+ Char($F8)+Char($EC))
  if not FileExists(Edit1.Text) then
  begin
   MessageBox(Handle,'你是MM呀','我好种意你呀',MB_OK + MB_ICONINFORMATION);
   exit;
  END;
  F :=  TFileStream.Create(Edit1.text,fmOpenRead);
  if not Chk2000.Checked then
  begin
   Try
    F.Seek($42,soFromBeginning);
    F.Read(PassBuff,14);
    for i := 0 to 13 do
    begin
     B := PassBuff[i] XOR xorString[i];
     Pass[i] := Char(B);
    end;
    pass[Sizeof(Pass)-1] := #0;
    Edit2.Text := StrPas(Pass);
    finally
   f.Free;
   end;
  end
  else
  begin
   try
   F.Seek($42,soFromBeginning);
   F.Read(passBuff2,40);
   I:=0;j:=0;
   while I<40 do
   begin
     B := passBuff2[i] xor xorString2[j];
     pass2[j]:=char(B);
     inc(i,2);inc(j);
   end;
   pass2[sizeof(pass2) - 1] := #0;
   Edit2.Text:=StrPas(Pass2);
  finally
   f.Free;
  end;
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
   Edit1.text := OpenDialog1.FileName;
end;


procedure TForm1.Button3Click(Sender: TObject);
VAR
passBuff: array[0..14]of byte;
pass: array[0..14]of char;
passBuff2: array[0..40]of byte;
pass2: array[0..20]of char;
B: Byte;
F:TFileStream;
I,j:integer;
s: string;
begin
  file://ShowMessage(Char($86)+ Char($F8)+Char($EC))
  if not FileExists(Edit1.Text) then
  begin
   MessageBox(Handle,'你是MM呀','我好种意你呀',MB_OK + MB_ICONINFORMATION);
   exit;
  END;
  F :=  TFileStream.Create(Edit1.text,fmOpenWrite);
  if not Chk2000.Checked then
  begin
   Try
    FillChar(Pass,14,#0);
    s := EdIt2.Text;
    StrCopy(@Pass,Pchar(Trim(s)));
    for i := 0 to 13 do
    begin
     B := Byte(Pass[i]);
     PassBuff[i] := xorString[i] xor B;
    end;
    PassBuff[13] := $B6;
    F.Seek($42,soFromBeginning);
    F.Write(PassBuff,14);
    finally
   f.Free;
   end;
  end
  else
  begin
   try
   F.Seek($42,soFromBeginning);
   F.Read(passBuff2,40);
   I:=0;j:=0;
   while I<40 do
   begin
     B := passBuff2[i] xor xorString2[j];
     pass2[j]:=char(B);
     inc(i,2);inc(j);
   end;
   pass2[sizeof(pass2) - 1] := #0;
   Edit2.Text:=StrPas(Pass2);
  finally
   f.Free;
  end;
  end;


end;

procedure TForm1.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
  file://if length(Edit1.text) >= 13 then Key := #0;
end;

end.

Tags:AccesS 密码 打击

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接