Bugfixes
authorJavier Palacios <javiplx@gmail.com>
Mon, 23 Jul 2012 13:35:34 +0000 (15:35 +0200)
committerJavier Palacios <javiplx@gmail.com>
Mon, 23 Jul 2012 13:35:34 +0000 (15:35 +0200)
wifisniffer/wifilogger.py

index 34c6c2f..8b44527 100755 (executable)
@@ -3,7 +3,11 @@
 import pcapy
 import struct
 
 import pcapy
 import struct
 
+import pyiw
+import threading
+
 iface = 'wlan0'
 iface = 'wlan0'
+wlan = pyiw.WirelessInterface(iface)
 
 import time
 
 
 import time
 
@@ -137,8 +141,13 @@ def dealWithPacket ( hdr , data ) :
                 frame_subtype = name
                 break
         else :
                 frame_subtype = name
                 break
         else :
-            print "ERROR : unknown CTL subtype %s" % ( frame_ctl & 0xf0 , )
-            return
+            if frame_ctl & 0xf0 == 144 :
+                frame_subtype = "CF_END_ACK"
+            elif frame_ctl & 0xf0 == 128 :
+                frame_subtype = "UNKNOWN_1"
+            else :
+                print "ERROR : unknown CTL subtype %s" % ( frame_ctl & 0xf0 , )
+                return
 
     elif frame_type == "DATA" :
         _subtype = []
 
     elif frame_type == "DATA" :
         _subtype = []
@@ -181,7 +190,7 @@ def dealWithPacket ( hdr , data ) :
         sequence = ( -1 , -1 )
 
 
         sequence = ( -1 , -1 )
 
 
-    if frame_type == "DATA" :
+    if frame_type == "DATA" and pcktlen > 6 :
         maclist.append( mac_fmt % struct.unpack( mac_str , payload[pointer:pointer+6] ) )
         pointer += 6
         pcktlen -= 6
         maclist.append( mac_fmt % struct.unpack( mac_str , payload[pointer:pointer+6] ) )
         pointer += 6
         pcktlen -= 6
@@ -211,6 +220,7 @@ try :
 except CaptureEnd , ex :
     print "FINISED : %s" % ex
 except Exception , ex :
 except CaptureEnd , ex :
     print "FINISED : %s" % ex
 except Exception , ex :
+    channel_hop[0] = 0
     print "ERROR : %s" % ex
 
 logfile.close()
     print "ERROR : %s" % ex
 
 logfile.close()