最佳答案
寻找here ,好像有一个与tcp相关的功能,所以我想是的,你可以用libnet注入(inject)tcp段。
int libnet_build_tcp(u_short sport, u_short dport, u_long seq,
u_long ack, u_char control, u_short win, u_short urg,
const u_char *payload, int payload_s, u_char *buf);
libnet_build_tcp() builds a TCP (Transmission Control Protocol) packet. Supplied is the source port, destination port, the sequence and acknowledgement numbers, the control bits (which can be logically OR'd together to set multiple flags -- see the example below), the advertised window size, the urgent pointer, a pointer to an optional data payload, the payload size, and lastly, the pointer to a pre-allocated block of memory for the packet. To just build a TCP header with no data payload, only TCP_H bytes need be allocated.
关于c++ - libnet 可以用来注入(inject) tcp 数据包/数据包修改吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2872000/