书名:super红客

vb 从零开始(八)

海棠书屋备用网站
    ----------------------------------------------------------------------------------------------------

    做外挂的人都知道,目前有两种办法制作网络游戏外挂。一种是封包式另外一种是内存式!下面就给大家制作一个抓包器,来研究一下,网络游戏的数据!

    ----------------------------------------------------------------------------------------------------

    sub

    =0

    =1,,"源ip",2,,"源端口",3,,"目标ip",4,,"目标端口",5,,"协议",6,,"时间",1500

    endsub

    sub

    calls

    endsub

    sub

    dim

    dim,

    dim,=""'清除

    dim

    =then'如果控件没有数值则提示错误

    exitsub

    end

    '将的值(即通过接收的数据包)转换为一定格式并在控件下显示出来

    fori=

    =+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&""

    ==&"|"&sar2&

    =0

    sar2=""

    sar3=""

    end

    i

    =-*3+1

    =r,chr32

    =&&"|"&sar2

    end

    endsub

    sub

    =""

    endsub

    '程序开始捕捉

    sub

    =""

    ip,'开始截取封包

    endsub

    sub

    =true'停止截取封包

    endsub

    sub,,,

    =+1

    s,1

    =truethen

    calls

    =

    "退出",,"数据封包截取"

    end

    endsub

    模块:

    '用来判断所支持的版本,也就是初始化dll,其中第一个参数为你所想需要的版本!低字节为主版本,高字节为副版本!由于目前有两个版本:1.1和2.2,因此该参数可以是或;第二个参数是一个结构,用于接收函数的返回信息!函数调用成功会返回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

    ,

    ,为临时变量,循环语句用,用来计算一共有多少个数据包

    '存放数据包

    '返回值,临时变量

    '退出标识

    '开始

    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'创建套接字,s是功能返回的文件描述符

    calls

    exitsub'如果创建失败则退出

    end='类型

    =ip'所用的ip地址

    res=binds,sock,lensock'绑定端口

    res

    calls

    exitsub'如果绑定失败则退出

    end

    res=s,,buf,lenbuf,0,0,bufb,0,0'改变io模式,将其改为混乱模式,即接受与自己无关的数据,则

    res

    calls

    exitsub

    end

    res=s,,,'设置套接字处于阻塞方式或者非阻塞方式,消息发送的窗口是pic,即

    res

    calls

    exitsub

    end

    endsub

    '接收信息

    sub,

    =then

    2000'重定义缓冲区大小为2000

    res=recvs,0,2000,0&'接收信息

    res>0then

    '改变数组大小,并保留以前的数据

    str=

    =res

    ,0,len'将里面的数据复制到结构里面

    '根据ip头结构的标识来获得是什么类型的数据包,并将从头结构中分离出来

    =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"

    百度搜“乡村911”直达本站!

    </p>