title: How to calculate a TCP packet checksum using Python?
body: <p>I'm using Scapy (the below code) to capture the IP/TCP packets on network:</p>
  
  <pre><code>sniff(iface='ens33', prn=call_back, filter="ip and dst host 10.0.0.12", store=0)
  
  def call_back(packet):
      ip_packet = packet['IP']
      tcp_packet = ip_packet['TCP']
  </code></pre>
  
  <p>When I got 'ip_packet', I need to change its source address to another one, and send it out.</p>
  
  <p>How can I re-calculate its checksum in IP header and TCP header? </p>