delphi如何wpe怎么发送封包包?

传奇封包的加解密源码(Delphi)
传奇封包的加解密源码(Delphi)
加密部分 function Encode(source : string): var Source_Len,Len : Count,c : a1,a2 : ind : Encode_Str : begin Result := ''; Encode_Str := ''; Len := 0; a1 := 0; a2 := 0; c := 0; ind := 0; Count := 0; Source_Len := Length(source); while Count & Source_Len do begin if Len &= $2710 then
ind := ord(source[Count+1]); ind := ind shr (c+2); a1 := ind or a2; a1 := a1 and $3f; ind := ord(source[Count+1]); ind := ind shl (8-(c+2)); ind := ind shr 2; a2 := ind and $3f; inc(c,2); if c &= 6 then begin if Len &= $270f then begin Encode_Str := Encode_Str + chr(a1 + $3c); inc(Len); end else begin Encode_Str := Encode_Str + chr(a1 + $3c); Encode_Str := Encode_Str + chr(a2 + $3c); Inc(Len,2);
c := 0; a2 := 0; end else begin Encode_Str := Encode_Str + chr(a1 + $3c); Inc(Len);
inc(Count);
if c & 0 then begin Encode_Str := Encode_Str + chr(a2 + $3c); Inc(Len);
SetLength(Encode_Str,Len); Result := Encode_S
解密部分 function Decode(source : string): var Source_Len,Len : Count,c1,c2 : code : array[0..7] a1,a2 : ind : Decode_Str : label L1,L2; begin Result := ''; Decode_Str := ''; code[2] := $ code[4] := $f0; code[6] := $c0; Len := 0; a1 := 0; a2 := 0; c1 := 2; c2 := 0; ind := 0; Count := 0; Source_Len := Length(source); while (Count & Source_Len) do begin if(ord(Source[Count+1]) - $3c) & 0 then begin Decode_Str := Decode_Str + Source[Count+1]; inc(Len); inc(Count); a1 := 0; a2 := 0; c1 := 2; c2 := 0; ind := 0; C //
a1 := ord(Source[Count+1]) - $3c; if Len &= Source_Len then begin
if (c2 + 6) & 8 then begin goto L2;
ind := a1 and $3f; ind := ind shr (6-c1); Decode_Str := Decode_Str + chr(ind or a2); Inc(Len); c2 := 0; if c1 &= 6 then begin c1 := 2; goto L1;
inc(c1,2); L2 :a2 := a1 shl c1; a2 := a2 and code[c1]; c2 := c2 + (8 - c1); L1 :inc(count);
SetLength(Decode_Str,Len); Result := Decode_S
【声明】:黑吧安全网()登载此文出于传递更多信息之目的,并不代表本站赞同其观点和对其真实性负责,仅适于网络安全技术爱好者学习研究使用,学习中请遵循国家相关法律法规。如有问题请联系我们,联系邮箱,我们会在最短的时间内进行处理。
上一篇:【】【】所有回答(2)
你得到的數據,應該 進行轉換的。c#發送的是byte【】數組。你讀取到的是byte【】,應該先轉換成string,然互毆才能正確。
园豆:3739
楼主写网络通讯的时候一定要注意字节码顺序,是高位在前还是低位在前。参考资料如下:
字节顺序是多字节数据被存储的顺序。例如,一个32位的长整型0x跨越4个字节(每个字节8位)。Intel x86机器使用小尾顺序(little-endian),意思是最不重要的字节首先存储。因此,数据&0x在内存中以{0x78、0x56、0x34、0x12}顺序存放。大多数不使用小尾顺序的机器使用大尾顺序(big-endian),即最重要的字节首先存储。同样的值在内存中以{0x12、0x34、0x56、0x78}顺序存放。
因为协议数据要在这些机器间传输,就必须选定其中的一种方式做为标准,否则会引起混淆。TCP/IP协议统一规定使用大尾方式传输数据,也称为网络字节顺序(network byte order)。例如,端口号(它是一个&16位的数字)19)的存储顺序是{0x30、0x39}。
根据你的情况,需要进行组包,伪代码如下:
memorystream ms = new memorystream();
bianryWriter wr = new bianryWriter(ms);
wr.write(obj); //这里的obj是你要写的数值,注意字节顺序,否则服务器解析出来的就是乱码。。。。
最后使用 byte [] data = wr.toArray();
c#转变高低位字节的方式为:
以Int为例:
int i =100; byte[] bytes = BitConverter.GetBytes(i).Reverse().ToArray();
自己移位的方式函数如下:
private & int & SwapInt32(int & int32)&{&& && && && & return & (int32 & & & 0xFF) && & & & 24 & | & (int32 & & && & 8 & & & 0xFF) && & & & 16 & |&& && && && && && && && & (int32 & & && & 16 & & & 0xFF) && & & & 8 & | & (int32 & & && & 24 & & & 0xFF);&}&
希望对你有所帮助。
&&&您需要以后才能回答,未注册用户请先。花了几个通宵时间,终于把武林发邮件的功能做好了,发点代码(delphi封包)给想做的人参考一下吧|::::广海游戏:::: - ★广海社区★ -
授人以鱼不如授人以渔 - Powered by phpwind
查看完整版本: [--
花了几个通宵时间,终于把武林发邮件的功能做好了,发点代码(delphi封包)给想做的人参考一下吧
激活邮箱npc发包:&长6位;&内容:23 00 9A 2F 00 80(后四位为npc的id);&&发信发包:&长度50位;&内容:&25 00 19 00 00 00 28 00 00 00 74 10 00 00 1D A4 2C 67 (前面四位的为自己ID,正写)00 92 2E B0 1D A4 24 E7(前面四位的为收邮件人ID,正写) 02 31 00 02 32 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00&&&调用方法:&&//激活邮箱NPC&& baostring := '0';&& CallParam2.baolen := round(length(baostring) / 2);&& for i := 1 to round(length(baostring) / 2) do begin&& & j := i * 2 - 1;&& & CallParam2.baostring := strtoint('$' + baostring[j] + baostring[j + 1]);&&&& InjectFunc1(MyHwnd, @baocall, @CallParam2, sizeof(CallParam2));&&//发邮件&& baostring := '04E0';&& CallParam2.baolen := round(length(baostring) / 2);&& for i := 1 to round(length(baostring) / 2) do begin&& & j := i * 2 - 1;&& & CallParam2.baostring := strtoint('$' + baostring[j] + baostring[j + 1]);&&&& InjectFunc1(MyHwnd, @baocall, @CallParam2, sizeof(CallParam2));&&今天终于通过自己查封包把自己想做的两个功能(自动摆摊和发邮件)做完了,总算了却了自己一个心愿!下个月就到国外去谋生了,估计再也不会做计算机了,所以自己的一点心血发上来给大家参考下,也不枉自己半年来的广海生涯,很怀念广海,这里真的很好,大家都互相帮助,进步很快,可惜我来时,很多高手都走了,但他们的文章教了我很多东西.&&自动摆摊的功能,今天一个朋友已发了,如果不懂的可以这里短信问我,这里我就不再发了。
[s:15]& 怎么人才都要出国呢?
zhuangzhi 高手啊,其他的call能发来参考一下吗?尤其走路的.&出国至少能开阔眼界,学会一门外语!支持!
真的要走,就祝你一路顺风顺水.&有时间回来看看,广海真的离不开 你的.
这个发包长度应该是50吧
谢谢 一路顺风~~~~~~~~
请问,CallParam2是什么类型
学习学习。
谢谢!收下! [s:15]
LZ还有什么好东西都丢下来给我们啊,我们不会嫌弃的
角色ID的偏移用OD或CE好不好找?能找到不?
好东西啊~~!&收下了
你这个包真长
查看完整版本: [--
Powered by
Time 0.066673 second(s),query:2 Gzip enableddelphi版载入封包
在Windows XP,D7编译测试通过
HOOK.DLL源码
library HOOK;
{ Important note about DLL memory management: ShareMem must be
& first unit in your library's USES clause AND
your project's (select
& Project-View Source) USES clause if your DLL
exports any procedures or
& functions that pass strings as parameters or
function results. This
& applies to all strings passed to and from
your DLL--even those that
& are nested in records and classes. ShareMem
is the interface unit to
& the BORLNDMM.DLL shared memory manager, which
must be deployed along
& with your DLL. To avoid using BORLNDMM.DLL,
pass string information
& using PChar or ShortString parameters. }
APIHook in 'APIHook.pas';
PData = ^TD
TData = record
DLLData: PD
{------------------------------------}
{过程名:HookProc
{过程功能:HOOK过程
{过程参数:nCode, wParam, lParam消息的相
{------------------------------------}
procedure HookProc(nCode, wParam, lParam: LongWORD);
if not DLLData^.Hooked then
DLLData^.Hooked := T
//调用下一个Hook
CallNextHookEx(DLLData^.Hook, nCode, wParam, lParam);
{------------------------------------}
{函数名:InstallHook
{函数功能:在指定窗口上安装HOOK
{函数参数:sWindow:要安装HOOK的窗口
{返回值:成功返回TRUE,失败返回FALSE
{------------------------------------}
function InstallHook(SWindow: LongWORD):B
ThreadID: LongWORD;
Result := F
DLLData^.Hook := 0;
ThreadID := GetWindowThreadProcessId(sWindow, nil);
//给指定窗口挂上钩子
DLLData^.Hook := SetWindowsHookEx(WH_GETMESSAGE, @HookProc,
Hinstance, ThreadID);
if DLLData^.Hook & 0 then
Result := True //是否成功HOOK
{------------------------------------}
{过程名:UnHook
{过程功能:卸载HOOK
{过程参数:无
{------------------------------------}
procedure UnH
UnHookAPI;
//卸载Hook
UnhookWindowsHookEx(DLLData^.Hook);
{------------------------------------}
{过程名:DLL入口函数
{过程功能:进行DLL初始化,释放等
{过程参数:DLL状态
{------------------------------------}
procedure MyDLLHandler(Reason: Integer);
FHandle: LongWORD;
case Reason of
DLL_PROCESS_ATTACH:
begin //建立文件映射,以实现DLL中的全局变量
FHandle := CreateFileMapping($FFFFFFFF, nil, PAGE_READWRITE, 0,
$ffff, 'MYDLLDATA');
if FHandle = 0 then
if GetLastError = ERROR_ALREADY_EXISTS then
FHandle := OpenFileMapping(FILE_MAP_ALL_ACCESS, False,
'MYDLLDATA');
if FHandle = 0 then E
end else E
DLLData := MapViewOfFile(FHandle, FILE_MAP_ALL_ACCESS, 0, 0,
if DLLData = nil then
CloseHandle(FHandle);
DLL_PROCESS_DETACH:
if Assigned(DLLData) then
UnmapViewOfFile(DLLData);
DLLData :=
{$R *.res}
InstallHook, UnHook, HookP
DLLProc := @MyDLLH
MyDLLhandler(DLL_PROCESS_ATTACH);
DLLData^.Hooked := F
'APIHook.pas'源码
Windows, WinS
//要HOOK的API函数定义
TSockProc = function (s: TS var B len, flags: Integer):
PJmpCode = ^TJmpC
TJmpCode = packed record
JmpCode: BYTE;
Address: TSockP
MovEAX: Array [0..2] of BYTE;
//--------------------函数声明---------------------------
procedure HookAPI;
procedure UnHookAPI;
procedure SaveInfo(var buf);
function recvout(var RRLen:Integer):I
OldSend, OldRecv: TSockP //原来的API地址
JmpCode: TJmpC
OldProc: array [0..1] of TJmpC
AddSend, AddRecv: //API地址
TmpJmp: TJmpC
ProcessHandle: TH
implementation
procedure SaveInfo(var buf);
& FileName:
& {保存为文件信息}
& FileName:='c:\test.txt';
& assignfile(f, FileName);
& closefile(f);
function recvout(var RRLen:Integer):I
for i:=1 to Rlen do
ss:=ss+inttohex(byte(buf1^),2)+' ';
buf1:=buf1+1;
ShowMessage('封包内容[16进制]:'+ss);
ShowMessage('发送封包长度:'+inttostr(Rlen));
{---------------------------------------}
{函数功能:Send函数的HOOK
{函数参数:同Send
{函数返回值:integer
{---------------------------------------}
function MySend(s: TS var B len, flags: Integer):
//这儿进行发送的数据处理
MessageBeep(1000); //简单的响一声
recvout(Buf,len);
//SaveInfo(Buf);
//调用直正的Send函数
WriteProcessMemory(ProcessHandle, AddSend, @OldProc[0], 8,
Result := OldSend(S, Buf, len, flags);
JmpCode.Address := @MyS
WriteProcessMemory(ProcessHandle, AddSend, @JmpCode, 8,
{---------------------------------------}
{函数功能:Recv函数的HOOK
{函数参数:同Recv
{函数返回值:integer
{---------------------------------------}
function MyRecv(s: TS var B len, flags: Integer):
//这儿进行接收的数据处理
MessageBeep(1000); //简单的响一声
//调用直正的Recv函数
WriteProcessMemory(ProcessHandle, AddRecv, @OldProc[1], 8,
Result := OldRecv(S, Buf, len, flags);
JmpCode.Address := @MyR
WriteProcessMemory(ProcessHandle, AddRecv, @JmpCode, 8,
{------------------------------------}
{过程功能:HookAPI
{过程参数:无
{------------------------------------}
procedure HookAPI;
DLLModule: TH
ProcessHandle := GetCurrentP
DLLModule := LoadLibrary('ws2_32.dll');
AddSend := GetProcAddress(DLLModule, 'send'); //取得API地址
AddRecv := GetProcAddress(DLLModule, 'recv');
JmpCode.JmpCode := $B8;
JmpCode.MovEAX[0] := $FF;
JmpCode.MovEAX[1] := $E0;
JmpCode.MovEAX[2] := 0;
ReadProcessMemory(ProcessHandle, AddSend, @OldProc[0], 8,
JmpCode.Address := @MyS
WriteProcessMemory(ProcessHandle, AddSend, @JmpCode, 8, dwSize);
//修改Send入口
ReadProcessMemory(ProcessHandle, AddRecv, @OldProc[1], 8,
JmpCode.Address := @MyR
WriteProcessMemory(ProcessHandle, AddRecv, @JmpCode, 8, dwSize);
//修改Recv入口
OldSend := AddS
OldRecv := AddR
{------------------------------------}
{过程功能:取消HOOKAPI
{过程参数:无
{------------------------------------}
procedure UnHookAPI;
WriteProcessMemory(ProcessHandle, AddSend, @OldProc[0], 8,
WriteProcessMemory(ProcessHandle, AddRecv, @OldProc[1], 8,
procedure TForm1.Button1Click(Sender: TObject);
& MOduleHandle:TH
& TmpWndHandle:TH
& TmpWndHandle:=0;
& //TmpWndHandle:=FindWindow('IEFrame',
TmpWndHandle:=FindWindowA(nil,'《风云online》');
& if not IsWindow(TmpWndHandle) then
MessageBox(Self.Handle,'没有找到窗口','!!',MB_OK);
& MOduleHandle:=LoadLibrary('HOOK.dll');
@InstallHook:=GetProcAddress(MOduleHandle,'InstallHook');
@UnHook:=GetProcAddress(MOduleHandle,'UnHook');
& if InstallHook(FindWindowA(nil,'《风云online》'))
& ShowMessage('Hook OK');
procedure TForm1.Button2Click(Sender: TObject);
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。RMB求DELPHI 发送封包源码_程序设计吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:3,416贴子:
RMB求DELPHI 发送封包源码收藏
DELPHI HOOK一个网游(无任何加密保护),根据走路取服务器地址端口,发送指定封包,价格200以内 ,有兴趣的联系QQ(注封包开发)
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或

我要回帖

更多关于 易语言发送封包源码 的文章

 

随机推荐