?----------------------------------------------------------------------------------------------------
做外掛的人都知道,目前有兩種辦法制作網(wǎng)絡游戲外掛。一種是封包式另外一種是內存式!下面就給大家制作一個抓包器,來研究一下,網(wǎng)絡游戲的數(shù)據(jù)!
----------------------------------------------------------------------------------------------------
sub
=0
=1,,"源ip",2,,"源端口",3,,"目標ip",4,,"目標端口",5,,"協(xié)議",6,,"時間",1500
endsub
sub
calls
endsub
sub
dim
dim,
dim,=""'清除
dim
=then'如果控件沒有數(shù)值則提示錯誤
exitsub
end
'將的值(即通過接收的數(shù)據(jù)包)轉換為一定格式并在控件下顯示出來
fori=
coun=coun+1
lenhexi=1then
sar="0"&hexi
else
sar=hexi
end
sar3=sar3&sar
ascchr"&h"&hexi
sar1="."
else
sar1=chr"&h"&hexi
end
sar2=sar2&=&sar&""
coun==&"|"&sar2&
coun=0
sar2=""
sar3=""
end
nexti
coun
=-coun*3+1
=r,chr32
=&&"|"&sar2
end
endsub
sub
=""
endsub
'程序開始捕捉
sub
=""
ip,'開始截取封包
endsub
sub
=true'停止截取封包
endsub
sub,,,
=+1
s,1
=truethen
calls
=
"退出",,"數(shù)據(jù)封包截取"
end
endsub
模塊:
'用來判斷所支持的版本,也就是初始化dll,其中第一個參數(shù)為你所想需要的版本!低字節(jié)為主版本,高字節(jié)為副版本!由于目前有兩個版本:1.1和2.2,因此該參數(shù)可以是或;第二個參數(shù)是一個結構,用于接收函數(shù)的返回信息!函數(shù)調用成功會返回0,否則返回非0值!
'用來關閉,與一起使用,即也可以看為啟動
'用來返回一個關于主機信息的結構的指針
lib"""",long
lib""""long
sublib"""",,
lib""""long
lib"""",long
lib""long
lib"",long
lib""long
lib""long
recvlib"",,,long
lib""long,,long
lib"",,,long
lib"",,,,,,,,long
lib""long
bindlib"",,
lib""
type
*255
*128
endtype
'sock地址結構
type
*8
endtype
type
endtype
'ip頭結構
type
endtype
'tcp頭結構
type
endtype
'udp頭結構
type
endtype
'icmp頭結構
type
endtype
'常量
=2
=3
=2
=&h1
=
=&hc2
,
,為臨時變量,循環(huán)語句用,用來計算一共有多少個數(shù)據(jù)包
'存放數(shù)據(jù)包
'返回值,臨時變量
'退出標識
'開始
sub
dim
call,data'初始化為2.2
endsub
'結束
sub
call'關閉
s
endsub
'獲得當前主機的
ip
dim
dim
dim
dim
host,,lenhost'將獲得的值放到host
pip,,4'將的值放到pip
uip,pip,4'將pip的值放到uip
=uip'將uip轉換為標準的ipv4格式
=s'去掉空格
cul=ss,s
='獲得ipv4格式的地址并將其放如
end
'獲得當前機器的主機名
dim
dim
dim
host=255,0
=host,255'獲得當前主機的主機名
=0then
=lefthost,1,host,-1
end
end
'連接
sub,
dim,,
buf=1
'初始化
=,,0'創(chuàng)建套接字,s是功能返回的文件描述符
calls
exitsub'如果創(chuàng)建失敗則退出
end='類型
=ip'所用的ip地址
res=binds,sock,lensock'綁定端口
res
calls
exitsub'如果綁定失敗則退出
end
res=s,,buf,lenbuf,0,0,bufb,0,0'改變io模式,將其改為混亂模式,即接受與自己無關的數(shù)據(jù),則
res
calls
exitsub
end
res=s,,,'設置套接字處于阻塞方式或者非阻塞方式,消息發(fā)送的窗口是pic,即
res
calls
exitsub
end
endsub
'接收信息
sub,
=then
2000'重定義緩沖區(qū)大小為2000
res=recvs,0,2000,0&'接收信息
res>0then
'改變數(shù)組大小,并保留以前的數(shù)據(jù)
str=
=res
,0,len'將里面的數(shù)據(jù)復制到結構里面
'根據(jù)ip頭結構的標識來獲得是什么類型的數(shù)據(jù)包,并將從頭結構中分離出來
=1then
="icmp"
hex,hex
end=6then
="tcp"
hex,hex
end=then
="udp"
hex,hex
end
end
loopres
end
endsub
'將進制轉換為地址
dim
caselenlng
case1
lng=""&lng
case2
lng=""&lng
case3
lng=""&lng
case4
lng="0000"&lng
case5
lng="000"&lng
case6
lng="00"&lng
case7
lng="0"&lng
end
fori=1lenlngstep2
ips=ips&val"
百度搜“鄉(xiāng)村911”直達本站!