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 983 time(s).
05-16-2012 07:06 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: A tool to decrypt .ple files
Before this gets out of hand you still need the password. There is no magical way to do so without the password.
05-16-2012 07:39 PM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: A tool to decrypt .ple files
Such a tool already exists btw (which can do a lot more than above code):
Log Viewer.exe which is installed in your Messenger Plus! installation directory.

Encrypting, decrypting etc. of Plus! chatlogs
.-= A 'frrrrrrrituurrr' for Wacky =-.
05-18-2012 11:08 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


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