IPQueue allows us to specify a modified packet with a verdict
If specified, it replaces the original packet
Replace all occurrences of "FOO" with "BAR":
my $tcp = NetPacket::TCP->decode($ip->{data}); $tcp->{data} =~ s/FOO/BAR/g; $ip->{data} = $tcp->encode($ip); my $raw = $ip->encode; $ipq->set_verdict($msg->packet_id, NF_ACCEPT, length($raw), $raw);
The server:
[mct@quint ~]$ echo "Hello, FOO" | nc -v -v -l -p 4242
The client:
[mct@ellesmere ~]$ telnet quint 4242 Trying 207.8.132.210... Connected to quint.netisland.net. Escape character is '^]'. Hello, BAR