Новичок
Регистрация: 26.01.2009
Сообщений: 4
Сказал Спасибо: 2
Имеет 1 спасибку в 1 сообщении
|
Может кому пригодится...
Код:
procedure SendGsp(data: array of byte; len: integer;crypt:boolean);
var
send_buff: array [0..MAX_PKT_SIZE-1] of byte; //Буфер отправки
temp_buff: array [0..MAX_PKT_SIZE-1] of byte; //Буфер шифрования
pl: string; //Длина пакета
begin
move(data[0],temp_buff[0],len); // Переносим в темп
if crypt then EncryptGP(temp_buff,len); // Если нада шифруем
pl:= IntToHex(len+2,4); // ******************
send_buff[0]:=StrToInt('$'+pl[3]+pl[4]);// Высчитываем длину пакета и
send_buff[1]:=StrToInt('$'+pl[1]+pl[2]);// записываем в первые 2 байта
move(temp_buff,send_buff[2],len); // Добавляем остальную часть пакета
len:=len+2; // Коректируем длину пакета +2
//view_pkt(send_buff,Len,false); // Просмотр пакета
send(Sock,send_buff,len,0); // Собсно отправка
end;
И пакет ProtocolVersion для ИЛ:
Код:
version_data: array[0..264] of byte=(
$00, $EA, $02, $00, $00, $09, $07, $54, $56, $03, $09, $0B, $01, $07, $02, $54,
$54, $56, $07, $00, $02, $55, $56, $00, $51, $00, $53, $57, $04, $07, $55, $08,
$54, $01, $07, $01, $53, $00, $56, $55, $56, $01, $06, $05, $04, $51, $03, $08,
$51, $08, $51, $56, $04, $54, $06, $55, $08, $02, $09, $51, $56, $01, $53, $06,
$55, $04, $53, $00, $56, $56, $53, $01, $09, $02, $09, $01, $51, $54, $51, $09,
$55, $56, $09, $03, $04, $07, $05, $55, $04, $06, $55, $04, $06, $09, $04, $51,
$01, $08, $08, $06, $05, $52, $06, $04, $01, $07, $54, $03, $06, $52, $55, $06,
$55, $55, $51, $01, $02, $04, $54, $03, $55, $54, $01, $57, $51, $55, $05, $52,
$05, $54, $07, $51, $51, $55, $07, $02, $53, $53, $00, $52, $05, $52, $07, $01,
$54, $00, $03, $05, $05, $08, $06, $05, $05, $06, $03, $00, $0D, $08, $01, $07,
$09, $03, $51, $03, $07, $53, $09, $51, $06, $07, $54, $0A, $50, $56, $02, $52,
$04, $05, $55, $51, $02, $53, $00, $08, $54, $04, $52, $56, $06, $02, $09, $00,
$08, $03, $53, $56, $01, $05, $00, $55, $06, $08, $56, $04, $0D, $06, $07, $52,
$06, $07, $04, $0A, $06, $01, $04, $54, $04, $00, $05, $02, $04, $54, $00, $09,
$52, $53, $05, $04, $01, $04, $05, $05, $01, $52, $51, $52, $0D, $06, $51, $08,
$09, $54, $53, $00, $0D, $01, $02, $03, $54, $53, $01, $05, $03, $08, $56, $54,
$07, $02, $54, $0B, $06, $DC, $4F, $61, $4F
);
Пакет протокола версии 746 под Ил
Отправляем пакет
procedure GS_ProtocolVersion;
begin
SendGsp(version_data,265,false);
end;
если нада изменить протокол то...
procedure GS_ProtocolVersion;
var
hex_ver: string;
data: array[0..260] of char;
begin
move(version_data,data,265);
hex_ver:=IntToHex(746,8); //Пишем версию...
data[1]:=Chr(StrToInt('$'+hex_ver[7]+hex_ver[8]));
data[2]:=Chr(StrToInt('$'+hex_ver[5]+hex_ver[6]));
data[3]:=Chr(StrToInt('$'+hex_ver[3]+hex_ver[4]));
data[4]:=Chr(StrToInt('$'+hex_ver[1]+hex_ver[2]));
SendPkt(data,length(data));
end;
В ответ получаем от сервера пакет CryptInit и отселе идет пляска с бубнами...
Последний раз редактировалось Stimer, 03.02.2009 в 18:46.
Причина: Дополнение...
|