How to recalculate IP checksum with scapy?

Mr. Shickadance picture Mr. Shickadance · May 24, 2011 · Viewed 20.8k times · Source

Possible Duplicate:
How to calculate a packet checksum without sending it?

I've spoofed a source IP and MAC address in a captured packet, but now I need to recalculate the checksum so that it checks out once its been received (after being injected into the network of course). I didn't really want to implement the checksum myself, and I was thinking that scapy could do this for me. I read that the show2() function should recalculate the checksum, but I can't seem to get it to work.

So, how can I use scapy to recalculate (and replace) the checksum for a captured + spoofed packet?

Thanks!

Answer

Cédric Julien picture Cédric Julien · May 24, 2011

As shown here, you have to delete the .chksum attribute before calling the show2() method from scapy