How to capture and change packet using linux?

I want to capture and change the packets when they pass through my
linux firewall. I know the "Iptables" can do some of this job, but I
want to fullly control every packet, I want to change the packet's
data and source ip etc, but I found Iptables can not give me fullly
control, he can not let me edit the packet data as my will.

I want a method or a tool can capture and change the packet and then
send them as it would, and I want the tool has a friendly interface--
it analyse the packet for me, and I just do my change, I do not want
to analyse the every packet header and options.

Now, I want to know is there in linux has such tools or how to use
"iptables" to do it? I like iptables, it has a friendly user
interface, but it do not give (at least I do not found) the programmer
a hook point to link my own packet process functions, but it analyse
the packet for me, and I can just use some keywords to refer packet
parts, good.

PS: the packet data I need do a lot of things to reconstruct a valid
packet data. for example: I need to unencrypt and then encrypt the