Тема: L2PacketHack 3.5.x
Показать сообщение отдельно
Старый 28.04.2009, 14:16   #735
Местный
 
Аватар для Sherman
 
Регистрация: 24.04.2008
Сообщений: 364
Сказал Спасибо: 15
Имеет 116 спасибок в 83 сообщенях
Sherman пока неопределено
По умолчанию

Есть какой то готовый пример newxor.dpr? Возможно у меня вариант из очень старого пакетхака.

PHP код:
library newxor;

uses
  windows
,
  
Coding in 'Coding.pas';

type
  TXorCoding 
= class(TCodingClass)
  private
    
keyLenByte;
  public
    
constructor Create;
    
procedure InitKey(const XorKeyInterludeBoolean False);override;
    
procedure DecryptGP(var Data; const SizeWord);override;
    
procedure EncryptGP(var Data; const SizeWord);override;
  
end;

  
TXorCodingOut = class(TCodingClass)
  private
    
keyLenByte;
  public
    
constructor Create;
    
procedure InitKey(const XorKeyInterludeBoolean False);override;
    
procedure DecryptGP(var Data; const SizeWord);override;
    
procedure EncryptGP(var Data; const SizeWord);override;
  
end;

function 
CreateCoding(Value:PCodingClass): HRESULTstdcall;
begin
  Result
:=0;
  try
    
Value^:=TXorCoding.Create;
  
except
    Result
:=-1;
    
Value^:=nil;
  
end;
end;

function 
CreateCodingOut(Value:PCodingClass): HRESULTstdcall;
begin
  Result
:=0;
  try
    
Value^:=TXorCodingOut.Create;
  
except
    Result
:=-1;
    
Value^:=nil;
  
end;
end;

exports CreateCodingCreateCodingOut;

TXorCoding }

constructor TXorCoding.Create();
begin
  FillChar
(GKeyS[0],SizeOf(GKeyS),0);
  
FillChar(GKeyR[0],SizeOf(GKeyR),0);
  
keyLen := 0;
End;

procedure TXorCoding.DecryptGP(var Data; const SizeWord);
var
  
k:integer;
  
pck:array[0..$4FFFof Byte absolute Data;
begin
  
for k:=size-1 downto 1 do
    
pck[k]:=pck[k] xor GKeyR[and keyLen] xor pck[k-1];
  if 
size<>0 then pck[0]:=pck[0] xor GKeyR[0];
  
Inc(PLongWord(@GKeyR[keyLen-7])^,size);
end;

procedure TXorCoding.EncryptGP(var Data; const SizeWord);
var
  
i:integer;
  
pck:array[0..$4FFFof Byte absolute Data;
begin
  
if size<>0 then pck[0]:=pck[0] xor GKeyS[0];
  for 
i:=1 to size-do
    
pck[i]:=pck[i] xor GKeyS[and keyLen] xor pck[i-1];
  
Inc(PLongWord(@GKeyS[keyLen-7])^,size);
end;

procedure TXorCoding.InitKey(const XorKeyInterludeBoolean False);
const
  
KeyConst: array[0..3of Byte = ($A1,$6C,$54,$87);
  
KeyIntrl: array[0..7of Byte = ($C8,$27,$93,$01,$A1,$6C,$31,$97);
var 
key2:array[0..15of Byte;
begin
  
if Interlude then begin
    keyLen
:=15;
    
Move(XorKey,key2,8);
    
Move(KeyIntrl,key2[8],8);
  
end else begin
    keyLen
:=7;
    
Move(XorKey,key2,4);
    
Move(KeyConst,key2[4],4);
  
end;
  
Move(key2,GKeyS,16);
  
Move(key2,GKeyR,16);
end;

TXorCodingOut }

constructor TXorCodingOut.Create;
begin
  FillChar
(GKeyS[0],SizeOf(GKeyS),0);
  
FillChar(GKeyR[0],SizeOf(GKeyR),0);
  
keyLen := 0;
end;

procedure TXorCodingOut.DecryptGP(var Data; const SizeWord);
var
  
k:integer;
  
pck:array[0..$4FFFof Byte absolute Data;
begin
  
for k:=size-1 downto 1 do
    
pck[k]:=pck[k] xor GKeyR[and keyLen] xor pck[k-1];
  if 
size<>0 then pck[0]:=pck[0] xor GKeyR[0];
  
Inc(PLongWord(@GKeyR[keyLen-7])^,size);
end;

procedure TXorCodingOut.EncryptGP(var Data; const SizeWord);
var
  
i:integer;
  
pck:array[0..$4FFFof Byte absolute Data;
begin
  
if size<>0 then pck[0]:=pck[0] xor GKeyS[0];
  for 
i:=1 to size-do
    
pck[i]:=pck[i] xor GKeyS[and keyLen] xor pck[i-1];
  
Inc(PLongWord(@GKeyS[keyLen-7])^,size);
end;

procedure TXorCodingOut.InitKey(const XorKeyInterludeBoolean);
const
  
KeyConst: array[0..3of Byte = ($A1,$6C,$54,$87);
  
KeyIntrl: array[0..7of Byte = ($C8,$27,$93,$01,$A1,$6C,$31,$97);
var 
key2:array[0..15of Byte;
begin
  
if Interlude then begin
    keyLen
:=15;
    
Move(XorKey,key2,8);
    
Move(KeyIntrl,key2[8],8);
  
end else begin
    keyLen
:=7;
    
Move(XorKey,key2,4);
    
Move(KeyConst,key2[4],4);
  
end;
  
Move(key2,GKeyS,16);
  
Move(key2,GKeyR,16);
end;

begin

end

я так понимаю этот нюксор меняет шифрование при получении пакета KeyInit, мне же надо менять ключ шиырования по мере поступления пакетов после первичной инициализации ключа.

Последний раз редактировалось Sherman, 28.04.2009 в 14:21.
Sherman вне форума   Ответить с цитированием