tags:

views:

92

answers:

1

I just took a glance at the introduction of libnet,

seems it mentioned support for udp,*ip*,but not tcp?

Does it support tcp at all?

A: 

Looking here, there seems to be a function related to tcp, so I guess yes, you can inject tcp segments with libnet.

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.

nc3b
One important thing is can it be used for packet mangling?
libnet