title: Failure to send raw ip packets in python
body: <p>First of all I'm using Windows 7, (I've read that this might be causing my problems), I'm trying to send a RAW IP packet with a customized IP header using python, but when I'm trying to catch it with wireshark, I manage to catch a packet, but the packet looks like this, my windows kernel created an auto IP-header and added the IP-header I created as the IP payload, now what I'm trying to understand is what's wrong with my code? And how can I fix it so I'll be able send a raw IP packet with a customized IP header?
  Here's my code:</p>
  
  <pre><code>import socket
  import struct
  
  s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP)
  
  
  
  ipheader = ''
  
  byte1 = int(bin(4)[2:].zfill(4)+bin(5)[2:].zfill(4),2)
  
  ipheader = ipheader + struct.pack('!B',byte1)
  
  byte2 = 0
  
  ipheader = ipheader + struct.pack('!B',byte2)
  
  byte34 = 0
  
  ipheader = ipheader + struct.pack('!H',byte34)
  
  byte56 = 16
  
  ipheader = ipheader + struct.pack('!H',byte56)
  
  byte78 = 0
  
  ipheader = ipheader + struct.pack('!H',byte78)
  
  byte9 = 50 
  
  ipheader = ipheader + struct.pack('!B',byte9)
  
  byte10 = 6
  
  ipheader = ipheader + struct.pack('!B',byte10)
  
  byte1112 = 0 
  
  ipheader = ipheader + struct.pack('!H',byte1112)
  
  byte13 = 10
  byte14 = 0
  byte15 = 0
  byte16 = 1
  
  ipheader = ipheader + struct.pack('!4B',byte13,byte14,byte15,byte16)
  
  byte17 = 8
  byte18 = 8
  byte19 = 8
  byte20 = 8
  
  ipheader = ipheader + struct.pack('!4B',byte17,byte18,byte19,byte20)
  
  s.sendto(ipheader,("8.8.8.8",0))
  
  print len(ipheader)
  </code></pre>
  
  <p>Thanks in advance.</p>