我一直在看libnet提供的示例源代码,但是,我不清楚如何处理以下内容。
length+=LIBNET_TCP_H;
t = libnet_build_tcp(
    0x6666,                                     /* source port */
    179,                                        /* destination port */
    0x01010101,                                 /* sequence number */
    0x02020202,                                 /* acknowledgement num */
    TH_SYN,                                     /* control flags */
    32767,                                      /* window size */
    0,                                          /* checksum */
    0,                                          /* urgent pointer */
length,                                     /* TCP packet size */
    NULL,                                       /* payload */
    0,                                          /* payload size */
    l,                                          /* libnet handle */
    0);                                         /* libnet id */这似乎是一个tcp报头结构,但是,如果我想更改dst端口,我是在# 179处更改,还是有更好的方法?
另外,这是正确的编译方法吗:
gcc -Wall libnet-config --defines arp-new-new.c libnet-config --libs -lpcap -lnet
发布于 2013-02-26 02:29:30
根据我对libnet的一点经验,拥有dst端口的字段是WAS179,我自己的编译命令是:$ gcc -Wall -std=gnu99 -pedantic disect5.c -lpcap libnet-config --defines libnet-config --libs -lnet -o disect5 (对于名为disect5的C程序) gretz
https://stackoverflow.com/questions/11677144
复制相似问题