X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=bt-remote.c;h=77ca2702273ab40e5b14321bfe65ec2d3bf313dd;hb=4a52d180fa3673a1f29f6a491200e6f09dec9327;hp=b161bc8bb6cd58c2605c36b898fb50581743fc47;hpb=2b5553d4eaca51f00c8cad937534fd7747e9fc13;p=wardrive 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