elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Introducción a la Factorización De Semiprimos (RSA)


  Mostrar Temas
Páginas: [1]
1  Programación / Programación General / Descifrar/cifrar archivos crypt5 de Whatsapp en: 23 Marzo 2014, 19:43 pm
Hola,

por aquí os dejo un programa hecho en delphi para descifrar los ficheros crypt5 de whatsapp.

Código:
program Crypt5;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  Classes,
  SeAES256 in 'SeCrypt\SeAES256.pas',
  SeBase64 in 'SeCrypt\SeBase64.pas',
  SeSHA256 in 'SeCrypt\SeSHA256.pas',
  SeStreams in 'SeCrypt\SeStreams.pas',
  SeMD5 in 'SeCrypt\SeMD5.pas';

var
  {
   Las claves las conseguí aquí:
   h t t p://w w w . securitybydefault.com/2014/03/descifrando-msgstoredbcrypt5-la-nueva.html
  }
  Key: array[0..23] of Byte = (141, 75, 21, 92, 201, 255, 129, 229, 203, 246, 250,
    120, 25, 54, 106, 62, 198, 33, 166, 86, 65, 108, 215, 147);
  IV:  array[0..15] of Byte = ($1E,$39,$F3,$69,$E9,$D,$B3,$3A,$A7,$3B,$44,$2B,
    $BB,$B6,$B0,$B9);

  i: Integer;
  md5: AnsiString;
  AESKey: TAESKey;
  AESExpandedKey: TAESExpandedKey;
  AESIV: TAESState;
  Src, Dst: TFileStream;
begin
  Writeln('===================================================');
  Writeln('Crypt5 decryptor/encryptor. http://delphi.jmrds.com');
  Writeln('===================================================');
  Writeln;
  if ParamCount < 3 then
  begin
    Writeln('Crypt5 <encrypted.db.crypt5> <accountname> <decrypted.db> [/e]');
    Writeln('  /e: Encrypt database');
    Writeln;
    Halt;
  end;
  try
    // Abrimos el archivo cifrado
    Src:= TFileStream.Create(ParamStr(1),fmOpenRead or fmShareDenyWrite);
    try
      // Calculamos el hash md5 de la cuenta de usuario
      md5:= MD5ToStr(CalcMD5(ParamStr(2)));
      for i:= 0 to 23 do
        // Mezcalmos el hash con la clave usand XOR
        Key[i]:= Key[i] xor Byte(StrToInt('$'+Copy(md5,(2*(i and $0F))+1,2)));
      // ACreamos el archivo de salida
      Dst:= TFileStream.Create(ParamStr(3),fmCreate);
      try
        FillChar(AESKey,Sizeof(AESKey),0);
        // Inicializamos la clave con el valor calculado
        AESCopyKey(AESKey,@Key,192);
        // Expandimos la clave, indicando que es de 192 bits
        AESExpandKey(AESExpandedKey,AESKey,192);
        // Cargamos el vector de inicializacion en un bloque
        move(IV,AESIV,Sizeof(IV));
        if FindCmdLineSwitch('e',TRUE) then
          with TAESEnc.Create(Dst,AESExpandedKey,AESIV) do
          try
            // Ciframos el fichero
            CopyFrom(Src,0);
          finally
            Free;
          end else
          with TAESDec.Create(Dst,AESExpandedKey,AESIV) do
          try
            // Desciframos el fichero
            CopyFrom(Src,0);
          finally
            Free;
          end;
      finally
        Dst.Free;
      end;
    finally
      Src.Free
    end;
  except
    // Si ocurre algun error lo mostramos
    On E: Exception do
    begin
      Writeln(E.Message);
    end;
  end;
end.

El uso no puede ser mas sencillo:
Código:
Crypt5 msgstore.db.crypt5 tucuenta@gmail.com msgstore.db

O si por el contrario queremos cifrar:
Código:
Crypt5  msgstore.db tucuenta@gmail.com msgstore.db.crypt5 /e

El archivo ya compilado:
http://www.multiupload.nl/725VZDJKSF

Saludos
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines