Page 1 of 1

Delphi 7 - Encrypt String Constants in Variables

Posted: Wed Apr 01, 2015 11:08 pm
by Primadonal
Howdy All,

When I try to mark blocks of the code containing string constants that is stored in variables, I got some errors.

I want to knwo how to use the VMProtect's Markers to do that.

My code :

Code: Select all

procedure TForm1.IdMappedPortTCP1Execute(AThread: TIdMappedPortThread);
var Payload, Host, Header, Krypt1, Krypt2:String;
begin
VMProtectBegin
('Krypt1 := EncryptString('website.com', 'pwd');'+sLineBreak+
 'Krypt2 := EncryptString('website.net', 'pwd');');
VMProtectEnd;
  if (pos('CONNECT',athread.NetData)<>0) or (pos('HTTP',athread.NetData)<>0) then begin
      if host.Text = 'Host' then begin
          Payload := 'GET http://'+Krypt1+'/ HTTP/1.1'+#13#10;
          Host := AddHeader(AThread.NetData,'Host: '+Krypt2+''#13#10);
          AThread.NetData := Payload+Host;
          end;
      end;
  end;

Re: Delphi 7 - Encrypt String Constants in Variables

Posted: Thu Apr 02, 2015 3:07 pm
by Admin

Code: Select all

uses VMProtectSDK;

procedure TForm1.IdMappedPortTCP1Execute(AThread: TIdMappedPortThread);
var Payload, Host, Header, Krypt1, Krypt2:String;
begin
  if (pos('CONNECT',athread.NetData)<>0) or (pos('HTTP',athread.NetData)<>0) then begin
      if host.Text = 'Host' then begin
          Payload := 'GET http://'+VMProtectDecryptStringA('website.com')+'/ HTTP/1.1'+#13#10;
          Host := AddHeader(AThread.NetData,'Host: '+VMProtectDecryptStringA('website.net')+''#13#10);
          AThread.NetData := Payload+Host;
          end;
      end;
  end;

Re: Delphi 7 - Encrypt String Constants in Variables

Posted: Fri Apr 03, 2015 8:53 am
by Primadonal
Howdy,

It's worked, but the URLs still can be sniffed using SmartSniff, view result here.

So, to protect from sniffing I use a password-based AES encryption: Jorlen Young's AES Encryption Code v1.3, and it successfully encrypting URLs, see here and my code implementation is below:

Code: Select all

...Jorlen Young's AES Encryption v1.3 code here...

procedure TForm1.IdMappedPortTCP1Execute(AThread: TIdMappedPortThread);
var Payload, Host, Header:String;
begin
AEScrypt1 := EncryptString('website.com', 'password');
AEScrypt2 := EncryptString('website.net', 'password');
  if (pos('CONNECT',athread.NetData)<>0) or (pos('HTTP',athread.NetData)<>0) then begin
      if host.Text = 'Host' then begin
          Payload := 'GET http://'+AEScrypt1+'/ HTTP/1.1'+#13#10;
          Host := AddHeader(AThread.NetData,'Host: '+AEScrypt2+''#13#10);
          AThread.NetData := Payload+Host;
          end;
      end;
  end;
My questions:

1. How to combine and synchronize VMProtectDecryptStringA with Jorlen Young's EncryptString function ? When i try to use:

Code: Select all

Payload := 'GET http://'+AEScrypt+VMProtectDecryptStringA('website.com')+'/ HTTP/1.1'+#13#10;
It results just became:

Code: Select all

GET http://0800000000000000D36CDC9153B71B4550442DBBC0959E30website.com/ HTTP/1.1
2. Or can you tell me how to encrypt URLs from SmartSniff also through VMProtect, like Jorlen Young's code v1.3 did ?

I would appreciate any help. Thank you so much.

Cheers,
Primadonal

Re: Delphi 7 - Encrypt String Constants in Variables

Posted: Fri Apr 03, 2015 9:28 am
by Admin
VMProtect can not protect your URLs from sniffing.

Re: Delphi 7 - Encrypt String Constants in Variables

Posted: Fri Apr 03, 2015 9:57 am
by Primadonal
Admin wrote:VMProtect can not protect your URLs from sniffing.
Can you add such feature in next update ?

Thank you.