Hacking the Kismet network protocol dr For a side project, this came up today: echo -e '\n!0 enable channel channel,bytes' | nc localhost 2501 | awk 'BEGIN { CHN = 0; }; /CHANNEL:/ { chnum[CHN]=$2; chval[CHN]=$3; CHN=CHN+1; }; /TIME/ { if (CHN != 0) { printf("["); for (x = 0; x < CHN; x++) { printf("{\"id\":%s,\"value\":%s}", chnum[x], chval[x]); if (x < (CHN-1)) printf(",") } printf("]\n"); CHN=0; fflush(""); } };' | while read line; do echo "$line" > channel.json.txt; done A little bash script to talk enough of the Kismet network protocol to capture the channel allocation stats, realtime, convert them to JSON for an AJAX app, and dump them to a file, replacing the JSON content of the file each time. It uses the TIME protocol as a sync delimiter to indicate we've gotten the complete channel list. The output is something like: [{"id":1,"value":112359},{"id":2,"value":50818},{"id":3,"value":14094},{"id":4,"value":930890},{"id":5,"value":14814},{"id":6,"value":24224},{"id":7,"value":12480},{"id":8,"value":354},{"id":9,"value":2328},{"id":10,"value":16953},{"id":11,"value":19567},{"id":36,"value":0},{"id":37,"value":0},{"id":38,"value":0},{"id":39,"value":0},{"id":40,"value":0},{"id":41,"value":0},{"id":42,"value":0},{"id":43,"value":0},{"id":44,"value":0},{"id":45,"value":0},{"id":46,"value":0},{"id":47,"value":0},{"id":48,"value":19894},{"id":52,"value":0},{"id":53,"value":0},{"id":54,"value":0},{"id":55,"value":0},{"id":56,"value":0},{"id":57,"value":0},{"id":58,"value":0},{"id":59,"value":0}]