title: Scapy View Transmitted Html
body: <p>I am trying to view the raw html being sent over the wire using scapy. The issue i am having is the the payload of the tcp packet isn't printing as ascii.</p>
  
  <pre><code>def sniffer_callback(packet):
      print "[*] Got a packet"
      if(validate_packet(packet)):
              resend_packet(packet)
      else:
              resend_packet(packet)
               print "------------------------------"
  
  def validate_packet(packet):
  # Validate whether the packet came from the right domain    
       print "[!] Validating Packet"
        tcp = packet[TCP]
        print  tcp.payload
  </code></pre>
  
  <p>[*] Got a packet</p>
  
  <p>[!] Validating Packet</p>
  
  <p>HTTP/1.1 200 OK</p>
  
  <p>Content-Type: application/json;charset=utf-8</p>
  
  <p>Cache-Control: max-age=5</p>
  
  <p>Content-Encoding: gzip</p>
  
  <p>Content-Length: 121</p>
  
  <p>Accept-Ranges: bytes</p>
  
  <p>Date: Thu, 11 Oct 2012 23:45:45 GMT</p>
  
  <p>Age: 4</p>
  
  <p>Connection: keep-alive</p>
  
  <p>P3P: CP="CAO DSP COR CURa ADMa DEVa TAIa PSAa PSDa IVAi IVDi CONi OUR SAMo OTRo BUS PHY 
  ONL UNI PUR COM NAV INT DEM CNT STA PRE"</p>
  
  <p>m�=
  �0
    ���
  MSkxqP�A��I�n������Fާ3���/HE����jFn�Vm���xk��ZL��b��m���������"h��=�L,�2�Q����</p>
  
  <p>Thats an example of a packet i recieve but i am wondering how to view the entire packet not just the http header.</p>
  
  <p>Thanks in advance for the help</p>