title: Fix pcap checksum using Python Scapy
body: <p>I've written one small python script to fix the checksum of L3-4 protocols using scapy. When I'm running the script it is not taking command line argument or may be some other reason it is not generating the fix checksum pcap. I've verified the rdpcap() from scapy command line it is working file using script it is not getting executed. My program is</p>
  
  <pre><code>import sys
  import logging
  logging.getLogger("scapy").setLevel(1)
  try:
      from scapy.all import *
  except ImportError:
  import scapy
  if len(sys.argv) != 3: 
      print "Usage:./ChecksumFixer  &lt;input_pcap_file&gt; &lt;output_pcap_file&gt;"
      print "Example: ./ChecksumFixer input.pcap output.pcap"
      sys.exit(1)
  
  #------------------------Command Line Argument---------------------------------------
  
  input_file = sys.argv[1]
  output_file = sys.argv[2]
  
  #------------------------Get The layer and Fix Checksum-------------------------------
  
  def getLayer(p):
      for paktype in (scapy.IP, scapy.TCP, scapy.UDP, scapy.ICMP):
          try:
              p.getlayer(paktype).chksum = None
          except: AttributeError
          pass
      return p
  #-----------------------FixPcap in input file and write to output fi`enter code here`le----------------
  
  def fixpcap():
      paks = scapy.rdpcap(input_file)
      fc = map(getLayer, paks)
      scapy.wrpcap(output_file, fc) 
  </code></pre>