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