[Delphi Source] Decrypt *.ATT

Results 1 to 4 of 4
  1. #1
    NN - Nord & Noob mauka is offline
    MemberRank
    Jul 2004 Join Date
    1,735Posts

    [Delphi Source] Decrypt *.ATT

    Credits Me and Paulo


    Decrypt *.att files - Encryption is same only vice verse!

    Code:
    {*******************************************************}
    {                                                       }
    {       Decrypt ATT file                                }
    {                                                       }
    {       Copyright (C) 2010 Gunz                         }
    {                                                       }
    {       www.Cheats.lv                                   }
    {                                                       }
    {*******************************************************}
    
    unit Unit3;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, ExtCtrls, StdCtrls;
    
    const
      LoginKeys : array [0..2] of Byte = ($FC, $CF, $AB);
      XorKeys : Array[0..15]of Byte = ($D1, $73, $52, $F6, $D2, $9A, $CB, $27,
                                       $3E, $AF, $59, $31, $37, $B3, $E7, $A2);
    type
      TForm3 = class(TForm)
        Browse: TOpenDialog;
        Button1: TButton;
        Panel1: TPanel;
        Map: TImage;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form3: TForm3;
    
    implementation
    
    {$R *.dfm}
    
    
    procedure Decrypt3Bytes(Data: TStream);
    var
     CIn,COut: Byte;
     i: Integer;
    begin
     for i := 0 to Data.Size - 1 do
      begin
       Data.Position := i;
       Data.Read(CIn,1);
       COut := CIn xor LoginKeys[i mod 3];
       Data.Position := i;
       Data.Write(COut,1)
      end;
    end;
    
    procedure DecryptAtt(Data: TStream);
    var
     CIn,COut,Key: Byte;
     i: Integer;
    begin
     Key := $5E;
     for i := 0 to Data.Size - 1 do
      begin
       Data.Position := i;
       Data.Read(CIn,1);
       COut := CIn xor XorKeys[i mod 16] - Key;
       key := CIn + $3D;
       Data.Position := i;
       Data.Write(COut,1)
      end;
    end;
    
    function GetColor(Get:Byte):TColor;
    begin
     case Get of
      $00:Result := clGreen;
      $01:Result := clOlive;
      $04:Result := clNavy;
     else
      Result     := clBlack;
    end;
    end;
    
    procedure TForm3.Button1Click(Sender: TObject);
    var
     Fs,Ms: TStream;
     i,j: Integer;
     Tmp,x,y: Byte;
    begin
     if Browse.Execute then
      begin
       try
        Fs := TFileStream.Create(Browse.FileName,fmOpenRead);
       except
        on e: Exception do
         begin
          MessageDlg('Failed to open file with error: '+E.Message, mtError, [mbOK], 0);
          Exit;
         end;
       end;
       x := 0;
       y := 0;
       Ms := TMemoryStream.Create;
        try
         Ms.CopyFrom(Fs,Fs.Size);
         Ms.Position := 0;
         DecryptAtt(Ms);
         Ms.Position := 0;
         Decrypt3Bytes(Ms);
         Ms.Position := 0;
          for i := 4 to Ms.Size - 1 do
            begin
             Ms.Position := i;
             Ms.Read(Tmp,1);
             Map.Canvas.Pixels[x,y] := GetColor(Tmp);
             Inc(y);
              if y = 0 then
               Inc(x)
            end;
        finally
         Ms.Free;
         Fs.Free;
        end;
      end
    end;
    
    end.
    in Atachament project source and binary
    Attached Files Attached Files


  2. #2

    Re: [Release] [Delphi Source] Decrypt *.ATT


  3. #3
    NN - Nord & Noob mauka is offline
    MemberRank
    Jul 2004 Join Date
    1,735Posts

    Re: [Release] [Delphi Source] Decrypt *.ATT

    Btw here for newbies example how save decrypted *.att file..
    Code:
    var
     Fs,Ms,FsOut: TStream;
    begin
     if Browse.Execute then
      begin
       try
        Fs := TFileStream.Create(Browse.FileName,fmOpenRead);
       except
        on e: Exception do
         begin
          MessageDlg('Failed to open file with error: '+E.Message, mtError, [mbOK], 0);
          Exit;
         end;
       end;
      FsOut := TFileStream.Create('Decrypted.att', fmCreate or fmShareExclusive);
       try
       Ms := TMemoryStream.Create;
        try
         Ms.CopyFrom(Fs,Fs.Size);
         Ms.Position := 0;
         DecryptAtt(Ms);
         Ms.Position := 0;
         Decrypt3Bytes(Ms);
         Ms.Position := 0;
         Fs.CopyFrom(Ms,Ms.Size);
        finally
         Ms.Free;
         Fs.Free;
        end;
       finally
        FsOut.free;
       end;
      end
    end;
    not tested wroted it here in forum

  4. #4
    Novice Mosh is offline
    MemberRank
    Jan 2010 Join Date
    3Posts

    Re: [Delphi Source] Decrypt *.ATT

    Hiya, where did you get that array of bytes named XorKeys?



Advertisement