]> git.sesse.net Git - wardrive/commitdiff
Add a kill switch.
authorsgunderson@bigfoot.com <>
Sat, 10 Feb 2007 00:51:46 +0000 (01:51 +0100)
committersgunderson@bigfoot.com <>
Sat, 10 Feb 2007 00:51:46 +0000 (01:51 +0100)
bt-remote.c

index b161bc8bb6cd58c2605c36b898fb50581743fc47..77ca2702273ab40e5b14321bfe65ec2d3bf313dd 100644 (file)
@@ -261,6 +261,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