A tool to decrypt .ple files - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: WLM Plus! Help (/forumdisplay.php?fid=12)
+----- Thread: A tool to decrypt .ple files (/showthread.php?tid=99291)
A tool to decrypt .ple files by leoshiang on 05-16-2012 at 07:06 PM
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;
RE: A tool to decrypt .ple files by matty on 05-16-2012 at 07:39 PM
Before this gets out of hand you still need the password. There is no magical way to do so without the password.
RE: A tool to decrypt .ple files by CookieRevised on 05-18-2012 at 11:08 PM
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
|