From 4a52d180fa3673a1f29f6a491200e6f09dec9327 Mon Sep 17 00:00:00 2001 From: "sgunderson@bigfoot.com" <> Date: Sat, 10 Feb 2007 01:51:46 +0100 Subject: [PATCH] Add a kill switch. --- bt-remote.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/bt-remote.c b/bt-remote.c index b161bc8..77ca270 100644 --- a/bt-remote.c +++ b/bt-remote.c @@ -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 -- 2.39.2