]> git.sesse.net Git - wardrive/blobdiff - bt-remote.c
More test data.
[wardrive] / bt-remote.c
index b161bc8bb6cd58c2605c36b898fb50581743fc47..315e96b4e0e700bf0c7fd083f4c84bdc7293f526 100644 (file)
@@ -136,7 +136,8 @@ int parse_packet(unsigned char *buf, unsigned bytes, int sock)
                        if (sscanf(ptr, "*NETWORK: %s %d %d %d %d", bssid, &crypted, &weak, &signal, &noise) != 5) {
                                printf("Couldn't parse NETWORK packet\n");
                        } else {
-                               if (strcmp(bssid, "00:0D:54:A0:27:7F") == 0) {
+                               if (strcmp(bssid, "00:18:39:0A:97:C9") == 0) {
+                               //if (strcmp(bssid, "00:13:10:1F:2A:1C") == 0) {
                                        static int last_crypted = 0;
                                        char str1[64], str2[64], str3[64], str4[64], str5[64], str6[64];
                                        short len;
@@ -261,6 +262,24 @@ int main(int argc, char **argv)
                        for (i = 0; i < bytes_read; ++i)
                                printf("0x%02x ", buf[i]);
                        printf("]\n");
+
+                       // don't bother with any sophisticated parsing
+                       while (bytes_read > 4) {
+                               int command = (buf[0] << 8) | buf[1];
+                               int len = (buf[2] << 8) | buf[3];
+       
+                               // menu item
+                               if (command == 3) {
+                                       int no = (buf[4] << 8) | buf[5];
+                                       if (no == 5) {
+                                               system("killall kismet_client");
+                                               exit(0);
+                                       }
+                               }
+
+                               memmove(buf, buf + len + 4, bytes_read - (len + 4));
+                               bytes_read -= len + 4;
+                       }
                }
                
                // read from kismet