title: NetfilterQueue refusing packet using scapy
body: <p>I am trying to make a firewall for SOAP packets, I am using NetfilterQueue to intercept the packets, I only validate the packets that contain the actual SOAP request, however the NetfilterQueue function pckt.drop() doesn't alert the client that the request has been refused, in this case the client keeps re transmitting the packet, I tried to send an HTTP 403 error but it didn't effect the process as if the client didn't receive it at all, may be I did something wrong, I would be very thankful if someone could help me out, here is my python script:</p>
  
  <pre><code>from scapy.all import *
  from netfilterqueue import NetfilterQueue
  from scapy.layers import inet
  
  def isSOAP(pkt):
      message=str(IP(pkt.get_payload())[TCP].payload)
      if(len(message)&gt;0 and message.find("xml")&gt;-1 and message.find("soap")&gt;-1):
          return True
      else:
          return False
  
  def check_signatures(pkt):
      if (isSOAP(pkt)):
          message=str(IP(pkt.get_payload())[TCP].payload)
          if is_attack(message):
              print "detected as attack"
              log_attack(pkt)
              pkt.drop()
              send_403(IP(pkt))
          else:
              print "normal message"
              log_normal(message,IP(pkt.get_payload()).src)
              pkt.accept()
      else:
          pkt.accept()
  
  def send_403(pkt):
      AckNr=pkt[TCP].seq+len(pkt[TCP].payload)
      seqNr=pkt[TCP].ack
      port=pkt.sport
      html1="HTTP/1.1 403 OK\x0d\x0aDate: Wed, 29 Sep 2010 20:19:05 GMT\x0d\x0aServer: Testserver\x0d\x0aConnection: Keep-Alive\x0d\x0aContent-Type: text/html; charset=UTF-8\x0d\x0aContent-Length: 291\x0d\x0a\x0d\x0a&lt;!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"&gt;&lt;html&gt;&lt;head&gt;&lt;title&gt;Testserver&lt;/title&gt;&lt;/head&gt;&lt;body bgcolor=\"black\" text=\"white\" link=\"blue\" vlink=\"purple\" alink=\"red\"&gt;&lt;p&gt;&lt;font face=\"Courier\" color=\"blue\"&gt;-Welcome to test server-------------------------------&lt;/font&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;"
      ip=IP(src=pkt.dst, dst=pkt.src)
      TCP_SYNACK=TCP(sport=80, dport=port, flags="A", seq=seqNr, ack=AckNr)
      ANSWER=sr1(ip/TCP_SYNACK)
      data1=TCP(sport=80, dport=port, flags="PA", seq=seqNr, ack=AckNr, options=[('MSS', 1460)])
      ackdata1=sr1(ip/data1/html1)
      SeqNr=ackdata1.ack
      Bye=TCP(sport=80, dport=port, flags="RA", seq=SeqNr, ack=AckNr, options=[('MSS', 1460)])
      send(ip/Bye)
  
  nfqueue = NetfilterQueue()
  nfqueue.bind(1, check_signatures)
  try:
      nfqueue.run()
  except KeyboardInterrupt:
      print
  </code></pre>