What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » WLM Plus! Help » A tool to decrypt .ple files

A tool to decrypt .ple files
Author: Message:
leoshiang
New Member
*


Posts: 1
Joined: May 2012
O.P. A tool to decrypt .ple files
hi All,

This is a tool I wrote to decrypt .ple files. The usage is

PLEDecryptor filename password
where
   filename --> the ple file name
   password --> your password

PLEDecryptor will decrypt to ple file and create a .txt file.

Below is part of my sour code.

code:
procedure DecryptFile(const FileName, Password: string);
var
  BlockSize: Cardinal;
  Buffer: TBytes;
  DataLen: Cardinal;
  DataLength: Cardinal;
  DataSize: Int32;
  FileHeader: TPLE2Header;
  IsEndOfFile: Boolean;
  Mark: Int16;
  OutputStream: TFileStream;
  PasswordKey: HCRYPTKEY;
  PrivateKey: HCRYPTKEY;
  PublicKey: HCRYPTKEY;
  SourceStream: TFileStream;
  UnicodePassword: WideString;
  hProv: HCRYPTPROV;
  hash: HCRYPTHASH;
begin
  UnicodePassword := Password;
  SourceStream := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite);

  try
    SetLength(Buffer, 8192);
    SourceStream.Read(FileHeader, SizeOf(FileHeader));
    if (not CompareMem(@FileHeader, @MPLE2, SizeOf(FileHeader))) then
      Halt(GetLastError);

    SourceStream.Position := SourceStream.Position + $E0;

    if not CryptAcquireContextW(hProv, 'Messenger Plus! Crypto', MS_ENH_RSA_AES_PROV, PROV_RSA_AES, 0) then
      Halt(GetLastError);

    SourceStream.Read(DataLength, SizeOf(DataLength));
    SourceStream.Read(Buffer[0], DataLength);

    if not CryptImportKey(hProv, @Buffer[0], DataLength, 0, 0, PublicKey) then
      Halt(GetLastError);

    if not CryptCreateHash(hProv, CALG_SHA, 0, 0, hash) then
      Halt(GetLastError);

    if not CryptHashData(hash, @UnicodePassword[1], Length(UnicodePassword) * SizeOf(UnicodePassword[1]), 0) then
      Halt(GetLastError);

    if not CryptDeriveKey(hProv, CALG_AES_256, hash, 16777216, PasswordKey) then
      Halt(GetLastError);

    SourceStream.Read(DataLength, SizeOf(DataLength));
    SourceStream.Read(Buffer[0], DataLength);

    if not CryptImportKey(hProv, @Buffer[0], DataLength, PasswordKey, 0, PrivateKey) then
      Halt(GetLastError);

    SourceStream.Read(Buffer[0], 1);

    SourceStream.Read(BlockSize, 4);
    SourceStream.Read(Buffer[0], BlockSize);

    DataLen := BlockSize;
    if not CryptDecrypt(PrivateKey, 0, False, 0, @Buffer[0], DataLen) then
      Halt(GetLastError);

    OutputStream := TFileStream.Create(ChangeFileExt(FileName, '.txt'), fmCreate);
    try
      OutputStream.Write(Buffer[0], DataLen);

      repeat
        SourceStream.Read(Mark, 2);

        SourceStream.Read(DataSize, 4);
        while (DataSize > 0) do
        begin
          SourceStream.Read(Buffer[0], BlockSize);

          Dec(DataSize, BlockSize);
          IsEndOfFile := (DataSize = 0);

          DataLen := BlockSize;
          if not CryptDecrypt(PrivateKey, 0, IsEndOfFile, 0, @Buffer[0], DataLen) then
            Halt(GetLastError);

          OutputStream.Write(Buffer[0], DataLen);
        end;

      until (SourceStream.Position >= SourceStream.Size);

    finally
      OutputStream.Free;
    end;

  finally
    SourceStream.Free;
  end;
end;

.rar File Attachment: PLEDecrypter.rar (121.22 KB)
This file has been downloaded 1024 time(s).
05-16-2012 07:06 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
A tool to decrypt .ple files - by leoshiang on 05-16-2012 at 07:06 PM
RE: A tool to decrypt .ple files - by matty on 05-16-2012 at 07:39 PM
RE: A tool to decrypt .ple files - by CookieRevised on 05-18-2012 at 11:08 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On