| [475ad56] | 1 | diff -urN kismet.dev/cursesfront.cc kismet.dev2/cursesfront.cc
|
|---|
| 2 | --- kismet.dev/cursesfront.cc 2005-03-10 17:49:34.000000000 +0100
|
|---|
| 3 | +++ kismet.dev2/cursesfront.cc 2006-04-14 19:31:55.000000000 +0200
|
|---|
| 4 | @@ -30,7 +30,6 @@
|
|---|
| 5 | // Enable the protocols we can use
|
|---|
| 6 | void NCurseFront::AddClient(TcpClient *in_client) {
|
|---|
| 7 | client = in_client;
|
|---|
| 8 | - client->EnableProtocol("GPS");
|
|---|
| 9 | client->EnableProtocol("INFO");
|
|---|
| 10 | client->EnableProtocol("REMOVE");
|
|---|
| 11 | client->EnableProtocol("NETWORK");
|
|---|
| 12 | @@ -88,32 +87,8 @@
|
|---|
| 13 | mvwaddstr(netborder, 1, 2, " SSID T W Ch Data LLC Crypt Wk Flags");
|
|---|
| 14 | }
|
|---|
| 15 |
|
|---|
| 16 | - char gpsdata[1024];
|
|---|
| 17 | - float lat, lon, alt, spd, heading;
|
|---|
| 18 | int mode;
|
|---|
| 19 |
|
|---|
| 20 | - client->FetchLoc(&lat, &lon, &alt, &spd, &heading, &mode);
|
|---|
| 21 | -
|
|---|
| 22 | - if (!(lat == 0 && lon == 0 && alt == 0 && spd == 0 && mode == 0)) {
|
|---|
| 23 | -
|
|---|
| 24 | - char fix[16];
|
|---|
| 25 | -
|
|---|
| 26 | - if (mode == -1)
|
|---|
| 27 | - snprintf(fix, 16, "No signal");
|
|---|
| 28 | - else if (mode == 2)
|
|---|
| 29 | - snprintf(fix, 5, "2D");
|
|---|
| 30 | - else if (mode == 3)
|
|---|
| 31 | - snprintf(fix, 5, "3D");
|
|---|
| 32 | - else
|
|---|
| 33 | - snprintf(fix, 5, "NONE");
|
|---|
| 34 | -
|
|---|
| 35 | - snprintf(gpsdata, 1024, "Lat %.3f Lon %.3f Alt %.3f Spd %.3f Fix %s",
|
|---|
| 36 | - lat, lon, alt, spd, fix);
|
|---|
| 37 | -
|
|---|
| 38 | - mvwaddstr(netborder, LINES-statheight-1, 2, gpsdata);
|
|---|
| 39 | -
|
|---|
| 40 | - }
|
|---|
| 41 | -
|
|---|
| 42 | box(infoborder, '|', '-');
|
|---|
| 43 | mvwaddstr(infoborder, 0, 2, "Info");
|
|---|
| 44 |
|
|---|
| 45 | diff -urN kismet.dev/dronesource.cc kismet.dev2/dronesource.cc
|
|---|
| 46 | --- kismet.dev/dronesource.cc 2005-05-26 16:51:45.000000000 +0200
|
|---|
| 47 | +++ kismet.dev2/dronesource.cc 2006-04-14 19:31:55.000000000 +0200
|
|---|
| 48 | @@ -201,9 +201,6 @@
|
|---|
| 49 | return -1;
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | - // Grab the GPS info
|
|---|
| 53 | - gps_enabled = vpkt.gps_enabled;
|
|---|
| 54 | -
|
|---|
| 55 | stream_recv_bytes = 0;
|
|---|
| 56 |
|
|---|
| 57 | // printf("debug - version packet valid\n\n");
|
|---|
| 58 | @@ -336,25 +333,6 @@
|
|---|
| 59 | packet->encoding = (encoding_type) phdr.encoding;
|
|---|
| 60 | packet->datarate = (uint32_t) ntohl(phdr.datarate);
|
|---|
| 61 |
|
|---|
| 62 | - if (gps_enabled) {
|
|---|
| 63 | - // If the drone is sending us GPS data, use it
|
|---|
| 64 | - packet->gps_lat = Pair2Float((int16_t) ntohs(phdr.gps_lat),
|
|---|
| 65 | - (int64_t) kis_ntoh64(phdr.gps_lat_mant));
|
|---|
| 66 | - packet->gps_lon = Pair2Float((int16_t) ntohs(phdr.gps_lon),
|
|---|
| 67 | - (int64_t) kis_ntoh64(phdr.gps_lon_mant));
|
|---|
| 68 | - packet->gps_alt = Pair2Float((int16_t) ntohs(phdr.gps_alt),
|
|---|
| 69 | - (int64_t) kis_ntoh64(phdr.gps_alt_mant));
|
|---|
| 70 | - packet->gps_spd = Pair2Float((int16_t) ntohs(phdr.gps_spd),
|
|---|
| 71 | - (int64_t) kis_ntoh64(phdr.gps_spd_mant));
|
|---|
| 72 | - packet->gps_heading = Pair2Float((int16_t) ntohs(phdr.gps_heading),
|
|---|
| 73 | - (int64_t) kis_ntoh64(phdr.gps_heading_mant));
|
|---|
| 74 | - packet->gps_fix = phdr.gps_fix;
|
|---|
| 75 | - } else if (gpsd != NULL) {
|
|---|
| 76 | - // Otherwise, no
|
|---|
| 77 | - gpsd->FetchLoc(&packet->gps_lat, &packet->gps_lon, &packet->gps_alt,
|
|---|
| 78 | - &packet->gps_spd, &packet->gps_heading, &packet->gps_fix);
|
|---|
| 79 | - }
|
|---|
| 80 | -
|
|---|
| 81 | packet->data = data;
|
|---|
| 82 | packet->moddata = moddata;
|
|---|
| 83 | packet->modified = 0;
|
|---|
| 84 | diff -urN kismet.dev/dronesource.h kismet.dev2/dronesource.h
|
|---|
| 85 | --- kismet.dev/dronesource.h 2005-05-26 16:51:45.000000000 +0200
|
|---|
| 86 | +++ kismet.dev2/dronesource.h 2006-04-14 19:31:55.000000000 +0200
|
|---|
| 87 | @@ -79,9 +79,6 @@
|
|---|
| 88 | uint8_t databuf[MAX_PACKET_LEN];
|
|---|
| 89 |
|
|---|
| 90 | unsigned int resyncing;
|
|---|
| 91 | -
|
|---|
| 92 | - // Is the drone pushing GPS data to us?
|
|---|
| 93 | - int gps_enabled;
|
|---|
| 94 | };
|
|---|
| 95 |
|
|---|
| 96 | // Nothing but a registrant for us
|
|---|
| 97 | diff -urN kismet.dev/frontend.cc kismet.dev2/frontend.cc
|
|---|
| 98 | --- kismet.dev/frontend.cc 2005-06-29 20:04:43.000000000 +0200
|
|---|
| 99 | +++ kismet.dev2/frontend.cc 2006-04-14 19:31:55.000000000 +0200
|
|---|
| 100 | @@ -248,33 +248,6 @@
|
|---|
| 101 |
|
|---|
| 102 | }
|
|---|
| 103 |
|
|---|
| 104 | - // Aggregate the GPS data
|
|---|
| 105 | - if (wnet->aggregate_points > 0) {
|
|---|
| 106 | - dnet->virtnet->aggregate_lat += wnet->aggregate_lat;
|
|---|
| 107 | - dnet->virtnet->aggregate_lon += wnet->aggregate_lon;
|
|---|
| 108 | - dnet->virtnet->aggregate_alt += wnet->aggregate_alt;
|
|---|
| 109 | - dnet->virtnet->aggregate_points += wnet->aggregate_points;
|
|---|
| 110 | - }
|
|---|
| 111 | -
|
|---|
| 112 | - if (wnet->gps_fixed > dnet->virtnet->gps_fixed)
|
|---|
| 113 | - dnet->virtnet->gps_fixed = wnet->gps_fixed;
|
|---|
| 114 | - if (wnet->min_lat < dnet->virtnet->min_lat || dnet->virtnet->min_lat == 0)
|
|---|
| 115 | - dnet->virtnet->min_lat = wnet->min_lat;
|
|---|
| 116 | - if (wnet->min_lon < dnet->virtnet->min_lon || dnet->virtnet->min_lon == 0)
|
|---|
| 117 | - dnet->virtnet->min_lon = wnet->min_lon;
|
|---|
| 118 | - if (wnet->min_alt < dnet->virtnet->min_alt || dnet->virtnet->min_alt == 0)
|
|---|
| 119 | - dnet->virtnet->min_alt = wnet->min_alt;
|
|---|
| 120 | - if (wnet->min_spd < dnet->virtnet->min_spd || dnet->virtnet->min_spd == 0)
|
|---|
| 121 | - dnet->virtnet->min_spd = wnet->min_spd;
|
|---|
| 122 | - if (wnet->max_lat > dnet->virtnet->max_lat || dnet->virtnet->max_lat == 0)
|
|---|
| 123 | - dnet->virtnet->max_lat = wnet->max_lat;
|
|---|
| 124 | - if (wnet->max_lon > dnet->virtnet->max_lon || dnet->virtnet->max_lon == 0)
|
|---|
| 125 | - dnet->virtnet->max_lon = wnet->max_lon;
|
|---|
| 126 | - if (wnet->max_alt > dnet->virtnet->max_alt || dnet->virtnet->max_alt == 0)
|
|---|
| 127 | - dnet->virtnet->max_alt = wnet->max_alt;
|
|---|
| 128 | - if (wnet->max_spd > dnet->virtnet->max_spd || dnet->virtnet->max_spd == 0)
|
|---|
| 129 | - dnet->virtnet->max_spd = wnet->max_spd;
|
|---|
| 130 | -
|
|---|
| 131 | // Aggregate the carriers and encodings
|
|---|
| 132 | dnet->virtnet->carrier_set |= wnet->carrier_set;
|
|---|
| 133 | dnet->virtnet->encoding_set |= wnet->encoding_set;
|
|---|
| 134 | diff -urN kismet.dev/kismet_client.cc kismet.dev2/kismet_client.cc
|
|---|
| 135 | --- kismet.dev/kismet_client.cc 2005-06-10 04:02:24.000000000 +0200
|
|---|
| 136 | +++ kismet.dev2/kismet_client.cc 2006-04-14 19:31:55.000000000 +0200
|
|---|
| 137 | @@ -28,7 +28,6 @@
|
|---|
| 138 | #include "cursesfront.h"
|
|---|
| 139 | #include "panelfront.h"
|
|---|
| 140 | #include "configfile.h"
|
|---|
| 141 | -#include "speech.h"
|
|---|
| 142 |
|
|---|
| 143 | #ifndef exec_name
|
|---|
| 144 | char *exec_name;
|
|---|
| 145 | @@ -47,11 +46,7 @@
|
|---|
| 146 | char *configfile;
|
|---|
| 147 | char *uiconfigfile;
|
|---|
| 148 | char *server = NULL;
|
|---|
| 149 | -int sound = -1;
|
|---|
| 150 | -int speech = -1;
|
|---|
| 151 | int flite = 0;
|
|---|
| 152 | -int speech_encoding = 0;
|
|---|
| 153 | -string speech_sentence_encrypted, speech_sentence_unencrypted;
|
|---|
| 154 | unsigned int metric = 0;
|
|---|
| 155 | unsigned int reconnect = 0;
|
|---|
| 156 |
|
|---|
| 157 | @@ -59,20 +54,9 @@
|
|---|
| 158 | string configdir, groupfile;
|
|---|
| 159 | FILE *group_file = NULL;
|
|---|
| 160 |
|
|---|
| 161 | -// Pipe file descriptor pairs and fd's
|
|---|
| 162 | -int soundpair[2];
|
|---|
| 163 | -int speechpair[2];
|
|---|
| 164 | -pid_t soundpid = -1, speechpid = -1;
|
|---|
| 165 | -
|
|---|
| 166 | // Catch our interrupt
|
|---|
| 167 | void CatchShutdown(int sig) {
|
|---|
| 168 |
|
|---|
| 169 | - // Kill our sound players
|
|---|
| 170 | - if (soundpid > 0)
|
|---|
| 171 | - kill(soundpid, 9);
|
|---|
| 172 | - if (speechpid > 0)
|
|---|
| 173 | - kill(speechpid, 9);
|
|---|
| 174 | -
|
|---|
| 175 | if (group_track) {
|
|---|
| 176 | if ((group_file = fopen(groupfile.c_str(), "w")) == NULL) {
|
|---|
| 177 | fprintf(stderr, "WARNING: Unable to open '%s' for writing, groups will not be saved.\n",
|
|---|
| 178 | @@ -116,215 +100,6 @@
|
|---|
| 179 | exit(0);
|
|---|
| 180 | }
|
|---|
| 181 |
|
|---|
| 182 | -// Subprocess sound handler
|
|---|
| 183 | -void SoundHandler(int *fds, const char *player, map<string, string> soundmap) {
|
|---|
| 184 | - int read_sock = fds[0];
|
|---|
| 185 | -
|
|---|
| 186 | - close(fds[1]);
|
|---|
| 187 | -
|
|---|
| 188 | - signal(SIGPIPE, PipeHandler);
|
|---|
| 189 | -
|
|---|
| 190 | - fd_set rset;
|
|---|
| 191 | -
|
|---|
| 192 | - char data[1024];
|
|---|
| 193 | -
|
|---|
| 194 | - pid_t sndpid = -1;
|
|---|
| 195 | - int harvested = 1;
|
|---|
| 196 | -
|
|---|
| 197 | - while (1) {
|
|---|
| 198 | - FD_ZERO(&rset);
|
|---|
| 199 | - FD_SET(read_sock, &rset);
|
|---|
| 200 | - char *end;
|
|---|
| 201 | -
|
|---|
| 202 | - memset(data, 0, 1024);
|
|---|
| 203 | -
|
|---|
| 204 | - if (harvested == 0) {
|
|---|
| 205 | - // We consider a wait error to be a sign that the child pid died
|
|---|
| 206 | - // so we flag it as harvested and keep on going
|
|---|
| 207 | - pid_t harvestpid = waitpid(sndpid, NULL, WNOHANG);
|
|---|
| 208 | - if (harvestpid == -1 || harvestpid == sndpid)
|
|---|
| 209 | - harvested = 1;
|
|---|
| 210 | - }
|
|---|
| 211 | -
|
|---|
| 212 | - struct timeval tim;
|
|---|
| 213 | - tim.tv_sec = 1;
|
|---|
| 214 | - tim.tv_usec = 0;
|
|---|
| 215 | -
|
|---|
| 216 | - if (select(read_sock + 1, &rset, NULL, NULL, &tim) < 0) {
|
|---|
| 217 | - if (errno != EINTR) {
|
|---|
| 218 | - exit(1);
|
|---|
| 219 | - }
|
|---|
| 220 | - }
|
|---|
| 221 | -
|
|---|
| 222 | - if (FD_ISSET(read_sock, &rset)) {
|
|---|
| 223 | - int ret;
|
|---|
| 224 | - ret = read(read_sock, data, 1024);
|
|---|
| 225 | -
|
|---|
| 226 | - // We'll die off if we get a read error, and we'll let kismet on the
|
|---|
| 227 | - // other side detact that it died
|
|---|
| 228 | - if (ret <= 0 && (errno != EAGAIN && errno != EPIPE))
|
|---|
| 229 | - exit(1);
|
|---|
| 230 | -
|
|---|
| 231 | - if ((end = strstr(data, "\n")) == NULL)
|
|---|
| 232 | - continue;
|
|---|
| 233 | -
|
|---|
| 234 | - end[0] = '\0';
|
|---|
| 235 | - }
|
|---|
| 236 | -
|
|---|
| 237 | - if (data[0] == '\0')
|
|---|
| 238 | - continue;
|
|---|
| 239 | -
|
|---|
| 240 | - // If we've harvested the process, spawn a new one and watch it
|
|---|
| 241 | - // instead. Otherwise, we just let go of the data we read
|
|---|
| 242 | - if (harvested == 1) {
|
|---|
| 243 | - // Only take the first line
|
|---|
| 244 | - char *nl;
|
|---|
| 245 | - if ((nl = strchr(data, '\n')) != NULL)
|
|---|
| 246 | - *nl = '\0';
|
|---|
| 247 | -
|
|---|
| 248 | - char snd[1024];
|
|---|
| 249 | -
|
|---|
| 250 | - if (soundmap.size() == 0)
|
|---|
| 251 | - snprintf(snd, 1024, "%s", data);
|
|---|
| 252 | - if (soundmap.find(data) != soundmap.end())
|
|---|
| 253 | - snprintf(snd, 1024, "%s", soundmap[data].c_str());
|
|---|
| 254 | - else
|
|---|
| 255 | - continue;
|
|---|
| 256 | -
|
|---|
| 257 | - char plr[1024];
|
|---|
| 258 | - snprintf(plr, 1024, "%s", player);
|
|---|
| 259 | -
|
|---|
| 260 | - harvested = 0;
|
|---|
| 261 | - if ((sndpid = fork()) == 0) {
|
|---|
| 262 | - // Suppress errors
|
|---|
| 263 | - int nulfd = open("/dev/null", O_RDWR);
|
|---|
| 264 | - dup2(nulfd, 1);
|
|---|
| 265 | - dup2(nulfd, 2);
|
|---|
| 266 | -
|
|---|
| 267 | - char * const echoarg[] = { plr, snd, NULL };
|
|---|
| 268 | - execve(echoarg[0], echoarg, NULL);
|
|---|
| 269 | - }
|
|---|
| 270 | - }
|
|---|
| 271 | -
|
|---|
| 272 | - data[0] = '\0';
|
|---|
| 273 | - }
|
|---|
| 274 | -}
|
|---|
| 275 | -
|
|---|
| 276 | -// Subprocess speech handler
|
|---|
| 277 | -void SpeechHandler(int *fds, const char *player) {
|
|---|
| 278 | - int read_sock = fds[0];
|
|---|
| 279 | - close(fds[1]);
|
|---|
| 280 | -
|
|---|
| 281 | - fd_set rset;
|
|---|
| 282 | -
|
|---|
| 283 | - char data[1024];
|
|---|
| 284 | -
|
|---|
| 285 | - pid_t sndpid = -1;
|
|---|
| 286 | - int harvested = 1;
|
|---|
| 287 | -
|
|---|
| 288 | - while (1) {
|
|---|
| 289 | - FD_ZERO(&rset);
|
|---|
| 290 | - FD_SET(read_sock, &rset);
|
|---|
| 291 | - //char *end;
|
|---|
| 292 | -
|
|---|
| 293 | - memset(data, 0, 1024);
|
|---|
| 294 | -
|
|---|
| 295 | - struct timeval tim;
|
|---|
| 296 | - tim.tv_sec = 1;
|
|---|
| 297 | - tim.tv_usec = 0;
|
|---|
| 298 | -
|
|---|
| 299 | - if (select(read_sock + 1, &rset, NULL, NULL, &tim) < 0) {
|
|---|
| 300 | - if (errno != EINTR) {
|
|---|
| 301 | - exit(1);
|
|---|
| 302 | - }
|
|---|
| 303 | - }
|
|---|
| 304 | -
|
|---|
| 305 | - if (harvested == 0) {
|
|---|
| 306 | - // We consider a wait error to be a sign that the child pid died
|
|---|
| 307 | - // so we flag it as harvested and keep on going
|
|---|
| 308 | - pid_t harvestpid = waitpid(sndpid, NULL, WNOHANG);
|
|---|
| 309 | - if (harvestpid == -1 || harvestpid == sndpid)
|
|---|
| 310 | - harvested = 1;
|
|---|
| 311 | - }
|
|---|
| 312 | -
|
|---|
| 313 | - if (FD_ISSET(read_sock, &rset)) {
|
|---|
| 314 | - int ret;
|
|---|
| 315 | - ret = read(read_sock, data, 1024);
|
|---|
| 316 | -
|
|---|
| 317 | - // We'll die off if we get a read error, and we'll let kismet on the
|
|---|
| 318 | - // other side detact that it died
|
|---|
| 319 | - if (ret <= 0 && (errno != EAGAIN && errno != EPIPE))
|
|---|
| 320 | - exit(1);
|
|---|
| 321 | -
|
|---|
| 322 | - data[ret] = '\0';
|
|---|
| 323 | -
|
|---|
| 324 | - }
|
|---|
| 325 | -
|
|---|
| 326 | - if (data[0] == '\0')
|
|---|
| 327 | - continue;
|
|---|
| 328 | -
|
|---|
| 329 | - // If we've harvested the process, spawn a new one and watch it
|
|---|
| 330 | - // instead. Otherwise, we just let go of the data we read
|
|---|
| 331 | - if (harvested == 1) {
|
|---|
| 332 | - harvested = 0;
|
|---|
| 333 | - if ((sndpid = fork()) == 0) {
|
|---|
| 334 | - // Only take the first line
|
|---|
| 335 | - char *nl;
|
|---|
| 336 | - if ((nl = strchr(data, '\n')) != NULL)
|
|---|
| 337 | - *nl = '\0';
|
|---|
| 338 | -
|
|---|
| 339 | - // Make sure it's shell-clean
|
|---|
| 340 | - MungeToShell(data, strlen(data));
|
|---|
| 341 | - char spk_call[1024];
|
|---|
| 342 | - snprintf(spk_call, 1024, "echo \"(%s\\\"%s\\\")\" | %s "
|
|---|
| 343 | - ">/dev/null 2>/dev/null",
|
|---|
| 344 | - flite ? "": "SayText ", data, player);
|
|---|
| 345 | -
|
|---|
| 346 | - system(spk_call);
|
|---|
| 347 | -
|
|---|
| 348 | - exit(0);
|
|---|
| 349 | - }
|
|---|
| 350 | - }
|
|---|
| 351 | -
|
|---|
| 352 | - data[0] = '\0';
|
|---|
| 353 | - }
|
|---|
| 354 | -}
|
|---|
| 355 | -
|
|---|
| 356 | -
|
|---|
| 357 | -int PlaySound(string in_sound) {
|
|---|
| 358 | -
|
|---|
| 359 | - char snd[1024];
|
|---|
| 360 | -
|
|---|
| 361 | - snprintf(snd, 1024, "%s\n", in_sound.c_str());
|
|---|
| 362 | -
|
|---|
| 363 | - if (write(soundpair[1], snd, strlen(snd)) < 0) {
|
|---|
| 364 | - char status[STATUS_MAX];
|
|---|
| 365 | - snprintf(status, STATUS_MAX,
|
|---|
| 366 | - "ERROR: Could not write to sound pipe. Stopping sound.");
|
|---|
| 367 | - gui->WriteStatus(status);
|
|---|
| 368 | -
|
|---|
| 369 | - return 0;
|
|---|
| 370 | - }
|
|---|
| 371 | -
|
|---|
| 372 | - return 1;
|
|---|
| 373 | -}
|
|---|
| 374 | -
|
|---|
| 375 | -int SayText(string in_text) {
|
|---|
| 376 | - char snd[1024];
|
|---|
| 377 | -
|
|---|
| 378 | - snprintf(snd, 1024, "%s\n", in_text.c_str());
|
|---|
| 379 | -
|
|---|
| 380 | - if (write(speechpair[1], snd, strlen(snd)) < 0) {
|
|---|
| 381 | - char status[STATUS_MAX];
|
|---|
| 382 | - snprintf(status, STATUS_MAX,
|
|---|
| 383 | - "ERROR: Could not write to speech pipe. Stopping speech.");
|
|---|
| 384 | - gui->WriteStatus(status);
|
|---|
| 385 | -
|
|---|
| 386 | - return 0;
|
|---|
| 387 | - }
|
|---|
| 388 | -
|
|---|
| 389 | - return 1;
|
|---|
| 390 | -}
|
|---|
| 391 |
|
|---|
| 392 | int main(int argc, char *argv[]) {
|
|---|
| 393 | exec_name = argv[0];
|
|---|
| 394 | @@ -345,8 +120,6 @@
|
|---|
| 395 | char guihost[1024];
|
|---|
| 396 | int guiport = -1;
|
|---|
| 397 |
|
|---|
| 398 | - int gpsmode = -1;
|
|---|
| 399 | -
|
|---|
| 400 | configfile = NULL;
|
|---|
| 401 | uiconfigfile = NULL;
|
|---|
| 402 |
|
|---|
| 403 | @@ -391,7 +164,6 @@
|
|---|
| 404 | fprintf(stderr, "Using alternate UI config file: %s\n", uiconfigfile);
|
|---|
| 405 | break;
|
|---|
| 406 | case 'q':
|
|---|
| 407 | - sound = 0;
|
|---|
| 408 | break;
|
|---|
| 409 | case 'g':
|
|---|
| 410 | reqgui = strdup(optarg);
|
|---|
| 411 | @@ -515,70 +287,6 @@
|
|---|
| 412 | server = strdup(gui_conf->FetchOpt("host").c_str());
|
|---|
| 413 | }
|
|---|
| 414 |
|
|---|
| 415 | - if (gui_conf->FetchOpt("sound") == "true" && sound == -1) {
|
|---|
| 416 | - if (gui_conf->FetchOpt("soundplay") != "") {
|
|---|
| 417 | - sndplay = gui_conf->FetchOpt("soundplay");
|
|---|
| 418 | - sound = 1;
|
|---|
| 419 | -
|
|---|
| 420 | - if (gui_conf->FetchOpt("soundopts") != "")
|
|---|
| 421 | - sndplay += " " + gui_conf->FetchOpt("soundopts");
|
|---|
| 422 | -
|
|---|
| 423 | - if (gui_conf->FetchOpt("sound_new") != "")
|
|---|
| 424 | - wav_map["new"] = gui_conf->FetchOpt("sound_new");
|
|---|
| 425 | - if (gui_conf->FetchOpt("sound_new_wep") != "")
|
|---|
| 426 | - wav_map["new_wep"] = gui_conf->FetchOpt("sound_new_wep");
|
|---|
| 427 | - if (gui_conf->FetchOpt("sound_traffic") != "")
|
|---|
| 428 | - wav_map["traffic"] = gui_conf->FetchOpt("sound_traffic");
|
|---|
| 429 | - if (gui_conf->FetchOpt("sound_junktraffic") != "")
|
|---|
| 430 | - wav_map["junktraffic"] = gui_conf->FetchOpt("sound_junktraffic");
|
|---|
| 431 | - if (gui_conf->FetchOpt("sound_gpslock") != "")
|
|---|
| 432 | - wav_map["gpslock"] = gui_conf->FetchOpt("sound_gpslock");
|
|---|
| 433 | - if (gui_conf->FetchOpt("sound_gpslost") != "")
|
|---|
| 434 | - wav_map["gpslost"] = gui_conf->FetchOpt("sound_gpslost");
|
|---|
| 435 | - if (gui_conf->FetchOpt("sound_alert") != "")
|
|---|
| 436 | - wav_map["alert"] = gui_conf->FetchOpt("sound_alert");
|
|---|
| 437 | -
|
|---|
| 438 | - } else {
|
|---|
| 439 | - fprintf(stderr, "ERROR: Sound alerts enabled but no sound playing binary specified.\n");
|
|---|
| 440 | - sound = 0;
|
|---|
| 441 | - }
|
|---|
| 442 | - } else if (sound == -1)
|
|---|
| 443 | - sound = 0;
|
|---|
| 444 | -
|
|---|
| 445 | - /* Added by Shaw Innes 17/2/02 */
|
|---|
| 446 | - if (gui_conf->FetchOpt("speech") == "true" && speech == -1) {
|
|---|
| 447 | - if (gui_conf->FetchOpt("festival") != "") {
|
|---|
| 448 | - festival = strdup(gui_conf->FetchOpt("festival").c_str());
|
|---|
| 449 | - speech = 1;
|
|---|
| 450 | -
|
|---|
| 451 | - if (gui_conf->FetchOpt("flite") == "true")
|
|---|
| 452 | - flite = 1;
|
|---|
| 453 | -
|
|---|
| 454 | - string speechtype = gui_conf->FetchOpt("speech_type");
|
|---|
| 455 | -
|
|---|
| 456 | - if (!strcasecmp(speechtype.c_str(), "nato"))
|
|---|
| 457 | - speech_encoding = SPEECH_ENCODING_NATO;
|
|---|
| 458 | - else if (!strcasecmp(speechtype.c_str(), "spell"))
|
|---|
| 459 | - speech_encoding = SPEECH_ENCODING_SPELL;
|
|---|
| 460 | - else
|
|---|
| 461 | - speech_encoding = SPEECH_ENCODING_NORMAL;
|
|---|
| 462 | -
|
|---|
| 463 | - // Make sure we have encrypted text lines
|
|---|
| 464 | - if (gui_conf->FetchOpt("speech_encrypted") == "" || gui_conf->FetchOpt("speech_unencrypted") == "") {
|
|---|
| 465 | - fprintf(stderr, "ERROR: Speech request but speech_encrypted or speech_unencrypted line missing.\n");
|
|---|
| 466 | - speech = 0;
|
|---|
| 467 | - }
|
|---|
| 468 | -
|
|---|
| 469 | - speech_sentence_encrypted = gui_conf->FetchOpt("speech_encrypted");
|
|---|
| 470 | - speech_sentence_unencrypted = gui_conf->FetchOpt("speech_unencrypted");
|
|---|
| 471 | -
|
|---|
| 472 | - } else {
|
|---|
| 473 | - fprintf(stderr, "ERROR: Speech alerts enabled but no path to festival has been specified.\n");
|
|---|
| 474 | - speech = 0;
|
|---|
| 475 | - }
|
|---|
| 476 | - } else if (speech == -1)
|
|---|
| 477 | - speech = 0;
|
|---|
| 478 | -
|
|---|
| 479 | if (gui_conf->FetchOpt("decay") != "") {
|
|---|
| 480 | if (sscanf(gui_conf->FetchOpt("decay").c_str(), "%d", &decay) != 1) {
|
|---|
| 481 | fprintf(stderr, "FATAL: Illegal config file value for decay.\n");
|
|---|
| 482 | @@ -636,45 +344,6 @@
|
|---|
| 483 | }
|
|---|
| 484 | }
|
|---|
| 485 |
|
|---|
| 486 | - // Fork and find the sound options
|
|---|
| 487 | - if (sound) {
|
|---|
| 488 | - if (pipe(soundpair) == -1) {
|
|---|
| 489 | - fprintf(stderr, "WARNING: Unable to create pipe for audio. Disabling sound.\n");
|
|---|
| 490 | - sound = 0;
|
|---|
| 491 | - } else {
|
|---|
| 492 | - soundpid = fork();
|
|---|
| 493 | -
|
|---|
| 494 | - if (soundpid < 0) {
|
|---|
| 495 | - fprintf(stderr, "WARNING: Unable to fork for audio. Disabling sound.\n");
|
|---|
| 496 | - sound = 0;
|
|---|
| 497 | - } else if (soundpid == 0) {
|
|---|
| 498 | - SoundHandler(soundpair, sndplay.c_str(), wav_map);
|
|---|
| 499 | - exit(0);
|
|---|
| 500 | - }
|
|---|
| 501 | -
|
|---|
| 502 | - close(soundpair[0]);
|
|---|
| 503 | - }
|
|---|
| 504 | - }
|
|---|
| 505 | -
|
|---|
| 506 | - if (speech) {
|
|---|
| 507 | - if (pipe(speechpair) == -1) {
|
|---|
| 508 | - fprintf(stderr, "WARNING: Unable to create pipe for speech. Disabling speech.\n");
|
|---|
| 509 | - speech = 0;
|
|---|
| 510 | - } else {
|
|---|
| 511 | - speechpid = fork();
|
|---|
| 512 | -
|
|---|
| 513 | - if (speechpid < 0) {
|
|---|
| 514 | - fprintf(stderr, "WARNING: Unable to fork for speech. Disabling speech.\n");
|
|---|
| 515 | - speech = 0;
|
|---|
| 516 | - } else if (speechpid == 0) {
|
|---|
| 517 | - SpeechHandler(speechpair, festival);
|
|---|
| 518 | - exit(0);
|
|---|
| 519 | - }
|
|---|
| 520 | -
|
|---|
| 521 | - close(speechpair[0]);
|
|---|
| 522 | - }
|
|---|
| 523 | - }
|
|---|
| 524 | -
|
|---|
| 525 | if (kismet_serv.Connect(guiport, guihost) < 0) {
|
|---|
| 526 | fprintf(stderr, "FATAL: Could not connect to %s:%d.\n", guihost, guiport);
|
|---|
| 527 | CatchShutdown(-1);
|
|---|
| 528 | @@ -884,53 +553,13 @@
|
|---|
| 529 | }
|
|---|
| 530 |
|
|---|
| 531 | if (pollret != 0) {
|
|---|
| 532 | - if (pollret == CLIENT_ALERT)
|
|---|
| 533 | - if (sound == 1)
|
|---|
| 534 | - sound = PlaySound("alert");
|
|---|
| 535 | -
|
|---|
| 536 | if (strlen(tcpcli->FetchStatus()) != 0) {
|
|---|
| 537 | gui->WriteStatus(tcpcli->FetchStatus());
|
|---|
| 538 | // gui->DrawDisplay();
|
|---|
| 539 | }
|
|---|
| 540 |
|
|---|
| 541 | - // The GPS only gets updated for the primary client
|
|---|
| 542 | - if (tcpcli == primary_client) {
|
|---|
| 543 | - if (tcpcli->FetchMode() == 0 && gpsmode != 0) {
|
|---|
| 544 | - if (sound == 1 && gpsmode != -1)
|
|---|
| 545 | - sound = PlaySound("gpslost");
|
|---|
| 546 | - gpsmode = 0;
|
|---|
| 547 | - } else if (tcpcli->FetchMode() != 0 && gpsmode == 0) {
|
|---|
| 548 | - if (sound == 1 && gpsmode != -1)
|
|---|
| 549 | - sound = PlaySound("gpslock");
|
|---|
| 550 | - gpsmode = 1;
|
|---|
| 551 | - }
|
|---|
| 552 | - }
|
|---|
| 553 | -
|
|---|
| 554 | if (tcpcli->FetchDeltaNumNetworks() > 0) {
|
|---|
| 555 | wireless_network *newnet = tcpcli->FetchLastNewNetwork();
|
|---|
| 556 | -
|
|---|
| 557 | - if (sound == 1 && newnet != lastspoken) {
|
|---|
| 558 | - if (newnet->crypt_set &&
|
|---|
| 559 | - wav_map.find("new_wep") != wav_map.end())
|
|---|
| 560 | - sound = PlaySound("new_wep");
|
|---|
| 561 | - else
|
|---|
| 562 | - sound = PlaySound("new");
|
|---|
| 563 | - }
|
|---|
| 564 | -
|
|---|
| 565 | - if (speech == 1 && newnet != lastspoken) {
|
|---|
| 566 | - string text;
|
|---|
| 567 | -
|
|---|
| 568 | - if (newnet != NULL) {
|
|---|
| 569 | - if (newnet->crypt_set)
|
|---|
| 570 | - text = ExpandSpeechString(speech_sentence_encrypted, newnet, speech_encoding);
|
|---|
| 571 | - else
|
|---|
| 572 | - text = ExpandSpeechString(speech_sentence_unencrypted, newnet, speech_encoding);
|
|---|
| 573 | -
|
|---|
| 574 | - speech = SayText(text.c_str());
|
|---|
| 575 | - }
|
|---|
| 576 | - }
|
|---|
| 577 | -
|
|---|
| 578 | - lastspoken = newnet;
|
|---|
| 579 | }
|
|---|
| 580 |
|
|---|
| 581 | num_networks += tcpcli->FetchNumNetworks();
|
|---|
| 582 | @@ -938,17 +567,7 @@
|
|---|
| 583 | num_noise += tcpcli->FetchNumNoise();
|
|---|
| 584 | num_dropped += tcpcli->FetchNumDropped();
|
|---|
| 585 |
|
|---|
| 586 | - if (tcpcli->FetchDeltaNumPackets() != 0) {
|
|---|
| 587 | - if (time(0) - last_click >= decay && sound == 1) {
|
|---|
| 588 | - if (tcpcli->FetchDeltaNumPackets() > tcpcli->FetchDeltaNumDropped()) {
|
|---|
| 589 | - sound = PlaySound("traffic");
|
|---|
| 590 | - } else {
|
|---|
| 591 | - sound = PlaySound("junktraffic");
|
|---|
| 592 | - }
|
|---|
| 593 | -
|
|---|
| 594 | - last_click = time(0);
|
|---|
| 595 | - }
|
|---|
| 596 | - }
|
|---|
| 597 | + tcpcli->FetchDeltaNumPackets();
|
|---|
| 598 | }
|
|---|
| 599 | }
|
|---|
| 600 | } else {
|
|---|
| 601 | diff -urN kismet.dev/kismet_drone.cc kismet.dev2/kismet_drone.cc
|
|---|
| 602 | --- kismet.dev/kismet_drone.cc 2006-04-13 00:42:59.000000000 +0200
|
|---|
| 603 | +++ kismet.dev2/kismet_drone.cc 2006-04-14 20:21:46.000000000 +0200
|
|---|
| 604 | @@ -32,16 +32,11 @@
|
|---|
| 605 | #include "packet.h"
|
|---|
| 606 |
|
|---|
| 607 | #include "packetsource.h"
|
|---|
| 608 | -#include "prism2source.h"
|
|---|
| 609 | #include "pcapsource.h"
|
|---|
| 610 | -#include "wtapfilesource.h"
|
|---|
| 611 | -#include "wsp100source.h"
|
|---|
| 612 | -#include "vihasource.h"
|
|---|
| 613 | #include "dronesource.h"
|
|---|
| 614 | #include "packetsourcetracker.h"
|
|---|
| 615 | #include "kis_packsources.h"
|
|---|
| 616 |
|
|---|
| 617 | -#include "gpsd.h"
|
|---|
| 618 | #include "tcpstreamer.h"
|
|---|
| 619 | #include "configfile.h"
|
|---|
| 620 |
|
|---|
| 621 | @@ -53,10 +48,6 @@
|
|---|
| 622 |
|
|---|
| 623 | const char *config_base = "kismet_drone.conf";
|
|---|
| 624 |
|
|---|
| 625 | -GPSD *gps = NULL;
|
|---|
| 626 | -int gpsmode = 0;
|
|---|
| 627 | -int gps_enable = 0;
|
|---|
| 628 | -
|
|---|
| 629 | // Unused, only here to make packetsourcetracker link
|
|---|
| 630 | int retain_monitor = 0;
|
|---|
| 631 |
|
|---|
| 632 | @@ -84,26 +75,6 @@
|
|---|
| 633 | exit(0);
|
|---|
| 634 | }
|
|---|
| 635 |
|
|---|
| 636 | -int GpsEvent(Timetracker::timer_event *evt, void *parm) {
|
|---|
| 637 | - // The GPS only provides us a new update once per second we might
|
|---|
| 638 | - // as well only update it here once a second
|
|---|
| 639 | - if (gps_enable) {
|
|---|
| 640 | - int gpsret;
|
|---|
| 641 | - gpsret = gps->Scan();
|
|---|
| 642 | - if (gpsret < 0) {
|
|---|
| 643 | - if (!silent)
|
|---|
| 644 | - fprintf(stderr, "GPS error fetching data: %s\n",
|
|---|
| 645 | - gps->FetchError());
|
|---|
| 646 | -
|
|---|
| 647 | - gps_enable = 0;
|
|---|
| 648 | - }
|
|---|
| 649 | -
|
|---|
| 650 | - }
|
|---|
| 651 | -
|
|---|
| 652 | - // We want to be rescheduled
|
|---|
| 653 | - return 1;
|
|---|
| 654 | -}
|
|---|
| 655 | -
|
|---|
| 656 | // Handle channel hopping... this is actually really simple.
|
|---|
| 657 | int ChannelHopEvent(Timetracker::timer_event *evt, void *parm) {
|
|---|
| 658 | sourcetracker.AdvanceChannel();
|
|---|
| 659 | @@ -151,9 +122,6 @@
|
|---|
| 660 |
|
|---|
| 661 | TcpStreamer streamer;
|
|---|
| 662 |
|
|---|
| 663 | - char gpshost[1024];
|
|---|
| 664 | - int gpsport = -1;
|
|---|
| 665 | -
|
|---|
| 666 | int channel_hop = -1;
|
|---|
| 667 | int channel_velocity = 1;
|
|---|
| 668 | int channel_dwell = 0;
|
|---|
| 669 | @@ -354,46 +322,6 @@
|
|---|
| 670 | exit(1);
|
|---|
| 671 | }
|
|---|
| 672 |
|
|---|
| 673 | - if (conf->FetchOpt("gps") == "true") {
|
|---|
| 674 | - if (sscanf(conf->FetchOpt("gpshost").c_str(), "%1023[^:]:%d", gpshost, &gpsport) != 2) {
|
|---|
| 675 | - fprintf(stderr, "Invalid GPS host in config (host:port required)\n");
|
|---|
| 676 | - exit(1);
|
|---|
| 677 | - }
|
|---|
| 678 | -
|
|---|
| 679 | - gps_enable = 1;
|
|---|
| 680 | - } else {
|
|---|
| 681 | - gps_enable = 0;
|
|---|
| 682 | - }
|
|---|
| 683 | -
|
|---|
| 684 | - if (gps_enable == 1) {
|
|---|
| 685 | - // Open the GPS
|
|---|
| 686 | - gps = new GPSD(gpshost, gpsport);
|
|---|
| 687 | -
|
|---|
| 688 | - // Lock GPS position
|
|---|
| 689 | - if (conf->FetchOpt("gpsmodelock") == "true") {
|
|---|
| 690 | - fprintf(stderr, "Enabling GPS position lock override (broken GPS unit reports 0 always)\n");
|
|---|
| 691 | - gps->SetOptions(GPSD_OPT_FORCEMODE);
|
|---|
| 692 | - }
|
|---|
| 693 | -
|
|---|
| 694 | - if (gps->OpenGPSD() < 0) {
|
|---|
| 695 | - fprintf(stderr, "%s\n", gps->FetchError());
|
|---|
| 696 | -
|
|---|
| 697 | - gps_enable = 0;
|
|---|
| 698 | - } else {
|
|---|
| 699 | - fprintf(stderr, "Opened GPS connection to %s port %d\n",
|
|---|
| 700 | - gpshost, gpsport);
|
|---|
| 701 | -
|
|---|
| 702 | - }
|
|---|
| 703 | - }
|
|---|
| 704 | -
|
|---|
| 705 | - // Update GPS coordinates and handle signal loss if defined
|
|---|
| 706 | - timetracker.RegisterTimer(SERVER_TIMESLICES_SEC, NULL, 1, &GpsEvent, NULL);
|
|---|
| 707 | -
|
|---|
| 708 | - // Add the GPS to the tcpstreamer
|
|---|
| 709 | - streamer.AddGpstracker(gps);
|
|---|
| 710 | -
|
|---|
| 711 | - // Register the gps and timetracker with the sourcetracker
|
|---|
| 712 | - sourcetracker.AddGpstracker(gps);
|
|---|
| 713 | sourcetracker.AddTimetracker(&timetracker);
|
|---|
| 714 |
|
|---|
| 715 | // Register the sources
|
|---|
| 716 | diff -urN kismet.dev/kismet_server.cc kismet.dev2/kismet_server.cc
|
|---|
| 717 | --- kismet.dev/kismet_server.cc 2006-04-13 00:42:59.000000000 +0200
|
|---|
| 718 | +++ kismet.dev2/kismet_server.cc 2006-04-14 19:31:55.000000000 +0200
|
|---|
| 719 | @@ -37,11 +37,7 @@
|
|---|
| 720 | #include "packet.h"
|
|---|
| 721 |
|
|---|
| 722 | #include "packetsource.h"
|
|---|
| 723 | -#include "prism2source.h"
|
|---|
| 724 | #include "pcapsource.h"
|
|---|
| 725 | -#include "wtapfilesource.h"
|
|---|
| 726 | -#include "wsp100source.h"
|
|---|
| 727 | -#include "vihasource.h"
|
|---|
| 728 | #include "dronesource.h"
|
|---|
| 729 | #include "packetsourcetracker.h"
|
|---|
| 730 | #include "kis_packsources.h"
|
|---|
| 731 | @@ -51,15 +47,11 @@
|
|---|
| 732 | #include "wtaplocaldump.h"
|
|---|
| 733 | #include "airsnortdump.h"
|
|---|
| 734 | #include "fifodump.h"
|
|---|
| 735 | -#include "gpsdump.h"
|
|---|
| 736 | -
|
|---|
| 737 | -#include "gpsd.h"
|
|---|
| 738 |
|
|---|
| 739 | #include "packetracker.h"
|
|---|
| 740 | #include "timetracker.h"
|
|---|
| 741 | #include "alertracker.h"
|
|---|
| 742 |
|
|---|
| 743 | -#include "speech.h"
|
|---|
| 744 | #include "tcpserver.h"
|
|---|
| 745 | #include "server_globals.h"
|
|---|
| 746 | #include "kismet_server.h"
|
|---|
| 747 | @@ -89,17 +81,8 @@
|
|---|
| 748 | Alertracker alertracker;
|
|---|
| 749 | Timetracker timetracker;
|
|---|
| 750 |
|
|---|
| 751 | -GPSD *gps = NULL;
|
|---|
| 752 | -int gpsmode = 0;
|
|---|
| 753 | -GPSDump gpsdump;
|
|---|
| 754 | -
|
|---|
| 755 | -// Last time we tried to reconnect to the gps
|
|---|
| 756 | -time_t last_gpsd_reconnect = 0;
|
|---|
| 757 | -int gpsd_reconnect_attempt = 0;
|
|---|
| 758 | -
|
|---|
| 759 | FifoDumpFile fifodump;
|
|---|
| 760 | TcpServer ui_server;
|
|---|
| 761 | -int sound = -1;
|
|---|
| 762 | packet_info last_info;
|
|---|
| 763 | int decay;
|
|---|
| 764 | channel_power channel_graph[CHANNEL_MAX];
|
|---|
| 765 | @@ -112,11 +95,8 @@
|
|---|
| 766 | // Wep keys
|
|---|
| 767 | macmap<wep_key_info *> bssid_wep_map;
|
|---|
| 768 |
|
|---|
| 769 | -// Pipe file descriptor pairs and fd's
|
|---|
| 770 | -int soundpair[2];
|
|---|
| 771 | -int speechpair[2];
|
|---|
| 772 | int chanpair[2];
|
|---|
| 773 | -pid_t soundpid = -1, speechpid = -1, chanpid = -1;
|
|---|
| 774 | +pid_t chanpid = -1;
|
|---|
| 775 |
|
|---|
| 776 | // Past alerts
|
|---|
| 777 | unsigned int max_alerts = 50;
|
|---|
| 778 | @@ -177,17 +157,6 @@
|
|---|
| 779 | int tcpport = -1;
|
|---|
| 780 | int tcpmax;
|
|---|
| 781 |
|
|---|
| 782 | -//const char *sndplay = NULL;
|
|---|
| 783 | -string sndplay;
|
|---|
| 784 | -
|
|---|
| 785 | -const char *festival = NULL;
|
|---|
| 786 | -int speech = -1;
|
|---|
| 787 | -int flite = 0;
|
|---|
| 788 | -int speech_encoding = 0;
|
|---|
| 789 | -string speech_sentence_encrypted, speech_sentence_unencrypted;
|
|---|
| 790 | -
|
|---|
| 791 | -map<string, string> wav_map;
|
|---|
| 792 | -
|
|---|
| 793 | int beacon_log = 1;
|
|---|
| 794 | int phy_log = 1;
|
|---|
| 795 | int mangle_log = 0;
|
|---|
| 796 | @@ -348,17 +317,6 @@
|
|---|
| 797 | // delete cryptfile;
|
|---|
| 798 | }
|
|---|
| 799 |
|
|---|
| 800 | - if (gps_log == 1) {
|
|---|
| 801 | - if (gpsdump.CloseDump(1) < 0)
|
|---|
| 802 | - fprintf(stderr, "Didn't log any GPS coordinates, unlinking gps file\n");
|
|---|
| 803 | - }
|
|---|
| 804 | -
|
|---|
| 805 | - // Kill our sound players
|
|---|
| 806 | - if (soundpid > 0)
|
|---|
| 807 | - kill(soundpid, 9);
|
|---|
| 808 | - if (speechpid > 0)
|
|---|
| 809 | - kill(speechpid, 9);
|
|---|
| 810 | -
|
|---|
| 811 | // Shut down the packet sources
|
|---|
| 812 | sourcetracker.CloseSources();
|
|---|
| 813 |
|
|---|
| 814 | @@ -369,228 +327,10 @@
|
|---|
| 815 | exit(0);
|
|---|
| 816 | }
|
|---|
| 817 |
|
|---|
| 818 | -// Subprocess sound handler
|
|---|
| 819 | -void SoundHandler(int *fds, const char *player, map<string, string> soundmap) {
|
|---|
| 820 | - int read_sock = fds[0];
|
|---|
| 821 | - close(fds[1]);
|
|---|
| 822 | -
|
|---|
| 823 | - fd_set rset;
|
|---|
| 824 | -
|
|---|
| 825 | - char data[1024];
|
|---|
| 826 | -
|
|---|
| 827 | - pid_t sndpid = -1;
|
|---|
| 828 | - int harvested = 1;
|
|---|
| 829 | -
|
|---|
| 830 | - while (1) {
|
|---|
| 831 | - FD_ZERO(&rset);
|
|---|
| 832 | - FD_SET(read_sock, &rset);
|
|---|
| 833 | - char *end;
|
|---|
| 834 | -
|
|---|
| 835 | - memset(data, 0, 1024);
|
|---|
| 836 | -
|
|---|
| 837 | - struct timeval tm;
|
|---|
| 838 | - tm.tv_sec = 1;
|
|---|
| 839 | - tm.tv_usec = 0;
|
|---|
| 840 | -
|
|---|
| 841 | - if (select(read_sock + 1, &rset, NULL, NULL, &tm) < 0) {
|
|---|
| 842 | - if (errno != EINTR) {
|
|---|
| 843 | - exit(1);
|
|---|
| 844 | - }
|
|---|
| 845 | - }
|
|---|
| 846 | -
|
|---|
| 847 | - if (harvested == 0) {
|
|---|
| 848 | - // We consider a wait error to be a sign that the child pid died
|
|---|
| 849 | - // so we flag it as harvested and keep on going
|
|---|
| 850 | - pid_t harvestpid = waitpid(sndpid, NULL, WNOHANG);
|
|---|
| 851 | - if (harvestpid == -1 || harvestpid == sndpid)
|
|---|
| 852 | - harvested = 1;
|
|---|
| 853 | - }
|
|---|
| 854 | -
|
|---|
| 855 | - if (FD_ISSET(read_sock, &rset)) {
|
|---|
| 856 | - int ret;
|
|---|
| 857 | - ret = read(read_sock, data, 1024);
|
|---|
| 858 | -
|
|---|
| 859 | - // We'll die off if we get a read error, and we'll let kismet on the
|
|---|
| 860 | - // other side detact that it died
|
|---|
| 861 | - if (ret <= 0 && (errno != EAGAIN && errno != EPIPE))
|
|---|
| 862 | - exit(1);
|
|---|
| 863 | -
|
|---|
| 864 | - if ((end = strstr(data, "\n")) == NULL)
|
|---|
| 865 | - continue;
|
|---|
| 866 | -
|
|---|
| 867 | - end[0] = '\0';
|
|---|
| 868 | - }
|
|---|
| 869 | -
|
|---|
| 870 | - if (data[0] == '\0')
|
|---|
| 871 | - continue;
|
|---|
| 872 | -
|
|---|
| 873 | -
|
|---|
| 874 | - // If we've harvested the process, spawn a new one and watch it
|
|---|
| 875 | - // instead. Otherwise, we just let go of the data we read
|
|---|
| 876 | - if (harvested == 1) {
|
|---|
| 877 | - // Only take the first line
|
|---|
| 878 | - char *nl;
|
|---|
| 879 | - if ((nl = strchr(data, '\n')) != NULL)
|
|---|
| 880 | - *nl = '\0';
|
|---|
| 881 | -
|
|---|
| 882 | - // Make sure it's shell-clean
|
|---|
| 883 | -
|
|---|
| 884 | - char snd[1024];
|
|---|
| 885 | -
|
|---|
| 886 | - if (soundmap.size() == 0)
|
|---|
| 887 | - snprintf(snd, 1024, "%s", data);
|
|---|
| 888 | - if (soundmap.find(data) != soundmap.end())
|
|---|
| 889 | - snprintf(snd, 1024, "%s", soundmap[data].c_str());
|
|---|
| 890 | - else
|
|---|
| 891 | - continue;
|
|---|
| 892 | -
|
|---|
| 893 | - char plr[1024];
|
|---|
| 894 | - snprintf(plr, 1024, "%s", player);
|
|---|
| 895 | -
|
|---|
| 896 | - harvested = 0;
|
|---|
| 897 | - if ((sndpid = fork()) == 0) {
|
|---|
| 898 | - // Suppress errors
|
|---|
| 899 | - if (silent) {
|
|---|
| 900 | - int nulfd = open("/dev/null", O_RDWR);
|
|---|
| 901 | - dup2(nulfd, 1);
|
|---|
| 902 | - dup2(nulfd, 2);
|
|---|
| 903 | - }
|
|---|
| 904 | -
|
|---|
| 905 | - char * const echoarg[] = { plr, snd, NULL };
|
|---|
| 906 | - execve(echoarg[0], echoarg, NULL);
|
|---|
| 907 | - }
|
|---|
| 908 | - }
|
|---|
| 909 | - data[0] = '\0';
|
|---|
| 910 | - }
|
|---|
| 911 | -}
|
|---|
| 912 | -
|
|---|
| 913 | -// Subprocess speech handler
|
|---|
| 914 | -void SpeechHandler(int *fds, const char *player) {
|
|---|
| 915 | - int read_sock = fds[0];
|
|---|
| 916 | - close(fds[1]);
|
|---|
| 917 | -
|
|---|
| 918 | - fd_set rset;
|
|---|
| 919 | -
|
|---|
| 920 | - char data[1024];
|
|---|
| 921 | -
|
|---|
| 922 | - pid_t sndpid = -1;
|
|---|
| 923 | - int harvested = 1;
|
|---|
| 924 | -
|
|---|
| 925 | - while (1) {
|
|---|
| 926 | - FD_ZERO(&rset);
|
|---|
| 927 | - FD_SET(read_sock, &rset);
|
|---|
| 928 | - //char *end;
|
|---|
| 929 | -
|
|---|
| 930 | - memset(data, 0, 1024);
|
|---|
| 931 | -
|
|---|
| 932 | - if (harvested == 0) {
|
|---|
| 933 | - // We consider a wait error to be a sign that the child pid died
|
|---|
| 934 | - // so we flag it as harvested and keep on going
|
|---|
| 935 | - pid_t harvestpid = waitpid(sndpid, NULL, WNOHANG);
|
|---|
| 936 | - if (harvestpid == -1 || harvestpid == sndpid)
|
|---|
| 937 | - harvested = 1;
|
|---|
| 938 | - }
|
|---|
| 939 | -
|
|---|
| 940 | - struct timeval tm;
|
|---|
| 941 | - tm.tv_sec = 1;
|
|---|
| 942 | - tm.tv_usec = 0;
|
|---|
| 943 | -
|
|---|
| 944 | - if (select(read_sock + 1, &rset, NULL, NULL, &tm) < 0) {
|
|---|
| 945 | - if (errno != EINTR) {
|
|---|
| 946 | - exit(1);
|
|---|
| 947 | - }
|
|---|
| 948 | - }
|
|---|
| 949 | -
|
|---|
| 950 | - if (FD_ISSET(read_sock, &rset)) {
|
|---|
| 951 | - int ret;
|
|---|
| 952 | - ret = read(read_sock, data, 1024);
|
|---|
| 953 | -
|
|---|
| 954 | - // We'll die off if we get a read error, and we'll let kismet on the
|
|---|
| 955 | - // other side detact that it died
|
|---|
| 956 | - if (ret <= 0 && (errno != EAGAIN && errno != EPIPE))
|
|---|
| 957 | - exit(1);
|
|---|
| 958 | -
|
|---|
| 959 | - data[ret] = '\0';
|
|---|
| 960 | - }
|
|---|
| 961 | -
|
|---|
| 962 | - if (data[0] == '\0')
|
|---|
| 963 | - continue;
|
|---|
| 964 | -
|
|---|
| 965 | - // If we've harvested the process, spawn a new one and watch it
|
|---|
| 966 | - // instead. Otherwise, we just let go of the data we read
|
|---|
| 967 | - if (harvested == 1) {
|
|---|
| 968 | - harvested = 0;
|
|---|
| 969 | - if ((sndpid = fork()) == 0) {
|
|---|
| 970 | - // Only take the first line
|
|---|
| 971 | - char *nl;
|
|---|
| 972 | - if ((nl = strchr(data, '\n')) != NULL)
|
|---|
| 973 | - *nl = '\0';
|
|---|
| 974 | -
|
|---|
| 975 | - // Make sure it's shell-clean
|
|---|
| 976 | - MungeToShell(data, strlen(data));
|
|---|
| 977 | - char spk_call[1024];
|
|---|
| 978 | - snprintf(spk_call, 1024, "echo \"(%s\\\"%s\\\")\" | %s "
|
|---|
| 979 | - ">/dev/null 2>/dev/null",
|
|---|
| 980 | - flite ? "" : "SayText ", data, player);
|
|---|
| 981 | - system(spk_call);
|
|---|
| 982 | -
|
|---|
| 983 | - exit(0);
|
|---|
| 984 | - }
|
|---|
| 985 | - }
|
|---|
| 986 | -
|
|---|
| 987 | - data[0] = '\0';
|
|---|
| 988 | - }
|
|---|
| 989 | -}
|
|---|
| 990 | -
|
|---|
| 991 | -
|
|---|
| 992 | -// Fork and run a system call to play a sound
|
|---|
| 993 | -int PlaySound(string in_sound) {
|
|---|
| 994 | -
|
|---|
| 995 | - char snd[1024];
|
|---|
| 996 | -
|
|---|
| 997 | - snprintf(snd, 1024, "%s\n", in_sound.c_str());
|
|---|
| 998 | -
|
|---|
| 999 | - if (write(soundpair[1], snd, strlen(snd)) < 0) {
|
|---|
| 1000 | - char status[STATUS_MAX];
|
|---|
| 1001 | - if (!silent)
|
|---|
| 1002 | - fprintf(stderr, "ERROR: Write error, closing sound pipe.\n");
|
|---|
| 1003 | - snprintf(status, STATUS_MAX, "ERROR: Write error on sound pipe, closing sound connection");
|
|---|
| 1004 | - NetWriteStatus(status);
|
|---|
| 1005 | -
|
|---|
| 1006 | - return 0;
|
|---|
| 1007 | - }
|
|---|
| 1008 | -
|
|---|
| 1009 | - return 1;
|
|---|
| 1010 | -}
|
|---|
| 1011 | -
|
|---|
| 1012 | -int SayText(string in_text) {
|
|---|
| 1013 | -
|
|---|
| 1014 | - char snd[1024];
|
|---|
| 1015 | -
|
|---|
| 1016 | - snprintf(snd, 1024, "%s\n", in_text.c_str());
|
|---|
| 1017 | - MungeToShell(snd, 1024);
|
|---|
| 1018 | -
|
|---|
| 1019 | - if (write(speechpair[1], snd, strlen(snd)) < 0) {
|
|---|
| 1020 | - char status[STATUS_MAX];
|
|---|
| 1021 | - if (!silent)
|
|---|
| 1022 | - fprintf(stderr, "ERROR: Write error, closing speech pipe.\n");
|
|---|
| 1023 | - snprintf(status, STATUS_MAX, "ERROR: Write error on speech pipe, closing speech connection");
|
|---|
| 1024 | - NetWriteStatus(status);
|
|---|
| 1025 | -
|
|---|
| 1026 | - return 0;
|
|---|
| 1027 | - }
|
|---|
| 1028 | -
|
|---|
| 1029 | - return 1;
|
|---|
| 1030 | -}
|
|---|
| 1031 | -
|
|---|
| 1032 | void KisLocalAlert(const char *in_text) {
|
|---|
| 1033 | time_t now = time(0);
|
|---|
| 1034 | if (!silent)
|
|---|
| 1035 | fprintf(stderr, "ALERT %.24s %s\n", ctime(&now), in_text);
|
|---|
| 1036 | -
|
|---|
| 1037 | - if (sound == 1)
|
|---|
| 1038 | - sound = PlaySound("alert");
|
|---|
| 1039 | -
|
|---|
| 1040 | }
|
|---|
| 1041 |
|
|---|
| 1042 | void KisLocalStatus(const char *in_status) {
|
|---|
| 1043 | @@ -639,37 +379,6 @@
|
|---|
| 1044 |
|
|---|
| 1045 | char tmpstr[32];
|
|---|
| 1046 |
|
|---|
| 1047 | - GPS_data gdata;
|
|---|
| 1048 | -
|
|---|
| 1049 | - if (gps_enable) {
|
|---|
| 1050 | - float lat, lon, alt, spd, hed;
|
|---|
| 1051 | - int mode;
|
|---|
| 1052 | -
|
|---|
| 1053 | - gps->FetchLoc(&lat, &lon, &alt, &spd, &hed, &mode);
|
|---|
| 1054 | -
|
|---|
| 1055 | - snprintf(tmpstr, 32, "%f", lat);
|
|---|
| 1056 | - gdata.lat = tmpstr;
|
|---|
| 1057 | - snprintf(tmpstr, 32, "%f", lon);
|
|---|
| 1058 | - gdata.lon = tmpstr;
|
|---|
| 1059 | - snprintf(tmpstr, 32, "%f", alt);
|
|---|
| 1060 | - gdata.alt = tmpstr;
|
|---|
| 1061 | - snprintf(tmpstr, 32, "%f", spd);
|
|---|
| 1062 | - gdata.spd = tmpstr;
|
|---|
| 1063 | - snprintf(tmpstr, 32, "%f", hed);
|
|---|
| 1064 | - gdata.heading = tmpstr;
|
|---|
| 1065 | - snprintf(tmpstr, 32, "%d", mode);
|
|---|
| 1066 | - gdata.mode = tmpstr;
|
|---|
| 1067 | - } else {
|
|---|
| 1068 | - gdata.lat = "0.0";
|
|---|
| 1069 | - gdata.lon = "0.0";
|
|---|
| 1070 | - gdata.alt = "0.0";
|
|---|
| 1071 | - gdata.spd = "0.0";
|
|---|
| 1072 | - gdata.heading = "0.0";
|
|---|
| 1073 | - gdata.mode = "0";
|
|---|
| 1074 | - }
|
|---|
| 1075 | -
|
|---|
| 1076 | - ui_server.SendToAll(gps_ref, (void *) &gdata);
|
|---|
| 1077 | -
|
|---|
| 1078 | INFO_data idata;
|
|---|
| 1079 | snprintf(tmpstr, 32, "%d", tracker.FetchNumNetworks());
|
|---|
| 1080 | idata.networks = tmpstr;
|
|---|
| 1081 | @@ -790,81 +499,6 @@
|
|---|
| 1082 | }
|
|---|
| 1083 | }
|
|---|
| 1084 |
|
|---|
| 1085 | -int GpsEvent(Timetracker::timer_event *evt, void *parm) {
|
|---|
| 1086 | - char status[STATUS_MAX];
|
|---|
| 1087 | -
|
|---|
| 1088 | - // The GPS only provides us a new update once per second we might
|
|---|
| 1089 | - // as well only update it here once a second
|
|---|
| 1090 | -
|
|---|
| 1091 | - // If we're disconnected, try to reconnect.
|
|---|
| 1092 | - if (gpsd_reconnect_attempt > 0) {
|
|---|
| 1093 | - // Increment the time between connection attempts
|
|---|
| 1094 | - if (last_gpsd_reconnect + ((gpsd_reconnect_attempt - 1) * 2) < time(0)) {
|
|---|
| 1095 | - if (gps->OpenGPSD() < 0) {
|
|---|
| 1096 | - last_gpsd_reconnect = time(0);
|
|---|
| 1097 | -
|
|---|
| 1098 | - if (gpsd_reconnect_attempt < 20)
|
|---|
| 1099 | - gpsd_reconnect_attempt++;
|
|---|
| 1100 | -
|
|---|
| 1101 | - snprintf(status, STATUS_MAX, "Unable to reconnect to GPSD, trying "
|
|---|
| 1102 | - "again in %d seconds.", ((gpsd_reconnect_attempt - 1) * 2));
|
|---|
| 1103 | -
|
|---|
| 1104 | - if (!silent || NetWriteStatus(status) == 0)
|
|---|
| 1105 | - fprintf(stderr, "WARNING: %s\n", status);
|
|---|
| 1106 | -
|
|---|
| 1107 | - return 1;
|
|---|
| 1108 | - } else {
|
|---|
| 1109 | - gpsd_reconnect_attempt = 0;
|
|---|
| 1110 | -
|
|---|
| 1111 | - snprintf(status, STATUS_MAX, "Reopened connection to GPSD");
|
|---|
| 1112 | - if (!silent || NetWriteStatus(status) == 0)
|
|---|
| 1113 | - fprintf(stderr, "NOTICE: %s\n", status);
|
|---|
| 1114 | - }
|
|---|
| 1115 | - } else {
|
|---|
| 1116 | - // Don't process more if we haven't woken up yet
|
|---|
| 1117 | - return 1;
|
|---|
| 1118 | - }
|
|---|
| 1119 | -
|
|---|
| 1120 | - }
|
|---|
| 1121 | -
|
|---|
| 1122 | - if (gps_enable) {
|
|---|
| 1123 | - int gpsret;
|
|---|
| 1124 | - gpsret = gps->Scan();
|
|---|
| 1125 | -
|
|---|
| 1126 | - if (gpsret < 0) {
|
|---|
| 1127 | - snprintf(status, STATUS_MAX, "GPS error requesting data: %s",
|
|---|
| 1128 | - gps->FetchError());
|
|---|
| 1129 | -
|
|---|
| 1130 | - if (!silent || NetWriteStatus(status) == 0)
|
|---|
| 1131 | - fprintf(stderr, "WARNING: %s\n", status);
|
|---|
| 1132 | -
|
|---|
| 1133 | - gpsd_reconnect_attempt = 1;
|
|---|
| 1134 | - }
|
|---|
| 1135 | -
|
|---|
| 1136 | - if (gpsret == 0 && gpsmode != 0) {
|
|---|
| 1137 | - if (!silent || NetWriteStatus("Lost GPS signal.") == 0)
|
|---|
| 1138 | - fprintf(stderr, "Lost GPS signal.\n");
|
|---|
| 1139 | - if (sound == 1)
|
|---|
| 1140 | - sound = PlaySound("gpslost");
|
|---|
| 1141 | -
|
|---|
| 1142 | - gpsmode = 0;
|
|---|
| 1143 | - } else if (gpsret != 0 && gpsmode == 0) {
|
|---|
| 1144 | - if (!silent || NetWriteStatus("Acquired GPS signal.") == 0)
|
|---|
| 1145 | - fprintf(stderr, "Acquired GPS signal.\n");
|
|---|
| 1146 | - if (sound == 1)
|
|---|
| 1147 | - sound = PlaySound("gpslock");
|
|---|
| 1148 | -
|
|---|
| 1149 | - gpsmode = 1;
|
|---|
| 1150 | - }
|
|---|
| 1151 | - }
|
|---|
| 1152 | -
|
|---|
| 1153 | - if (gps_log == 1 && gpsmode != 0 && gps != NULL) {
|
|---|
| 1154 | - gpsdump.DumpTrack(gps);
|
|---|
| 1155 | - }
|
|---|
| 1156 | -
|
|---|
| 1157 | - // We want to be rescheduled
|
|---|
| 1158 | - return 1;
|
|---|
| 1159 | -}
|
|---|
| 1160 |
|
|---|
| 1161 | // Simple redirect to the network info drawer. We don't want to change netwriteinfo to a
|
|---|
| 1162 | // timer event since we call it un-timed too
|
|---|
| 1163 | @@ -885,13 +519,6 @@
|
|---|
| 1164 | return 1;
|
|---|
| 1165 | }
|
|---|
| 1166 |
|
|---|
| 1167 | -// Write the waypoints for gpsdrive
|
|---|
| 1168 | -int WaypointSyncEvent(Timetracker::timer_event *evt, void *parm) {
|
|---|
| 1169 | - tracker.WriteGpsdriveWaypt(waypoint_file);
|
|---|
| 1170 | -
|
|---|
| 1171 | - return 1;
|
|---|
| 1172 | -}
|
|---|
| 1173 | -
|
|---|
| 1174 | // Handle tracker maintenance
|
|---|
| 1175 | int TrackerTickEvent(Timetracker::timer_event *evt, void *parm) {
|
|---|
| 1176 | tracker.Tick();
|
|---|
| 1177 | @@ -1160,11 +787,9 @@
|
|---|
| 1178 | " -c, --capture-source <src> Packet capture source line (type,interface,name)\n"
|
|---|
| 1179 | " -C, --enable-capture-sources Comma separated list of named packet sources to use.\n"
|
|---|
| 1180 | " -l, --log-types <types> Comma separated list of types to log,\n"
|
|---|
| 1181 | - " (ie, dump,cisco,weak,network,gps)\n"
|
|---|
| 1182 | + " (ie, dump,cisco,weak,network)\n"
|
|---|
| 1183 | " -d, --dump-type <type> Dumpfile type (wiretap)\n"
|
|---|
| 1184 | " -m, --max-packets <num> Maximum number of packets before starting new dump\n"
|
|---|
| 1185 | - " -q, --quiet Don't play sounds\n"
|
|---|
| 1186 | - " -g, --gps <host:port> GPS server (host:port or off)\n"
|
|---|
| 1187 | " -p, --port <port> TCPIP server port for GUI connections\n"
|
|---|
| 1188 | " -a, --allowed-hosts <hosts> Comma separated list of hosts allowed to connect\n"
|
|---|
| 1189 | " -b, --bind-address <address> Bind to this address. Default INADDR_ANY\n."
|
|---|
| 1190 | @@ -1289,23 +914,6 @@
|
|---|
| 1191 | ip_track = 1;
|
|---|
| 1192 | }
|
|---|
| 1193 |
|
|---|
| 1194 | -
|
|---|
| 1195 | - if (conf->FetchOpt("waypoints") == "true") {
|
|---|
| 1196 | - if(conf->FetchOpt("waypointdata") == "") {
|
|---|
| 1197 | - fprintf(stderr, "WARNING: Waypoint logging requested but no waypoint data file given.\n"
|
|---|
| 1198 | - "Waypoint logging will be disabled.\n");
|
|---|
| 1199 | - waypoint = 0;
|
|---|
| 1200 | - } else {
|
|---|
| 1201 | - waypointfile = conf->ExpandLogPath(conf->FetchOpt("waypointdata"), "", "", 0, 1);
|
|---|
| 1202 | - waypoint = 1;
|
|---|
| 1203 | - }
|
|---|
| 1204 | - if(conf->FetchOpt("waypoint_essid") == "true") {
|
|---|
| 1205 | - waypointformat = 1;
|
|---|
| 1206 | - } else {
|
|---|
| 1207 | - waypointformat = 0;
|
|---|
| 1208 | - }
|
|---|
| 1209 | - }
|
|---|
| 1210 | -
|
|---|
| 1211 | if (conf->FetchOpt("metric") == "true") {
|
|---|
| 1212 | fprintf(stderr, "Using metric measurements.\n");
|
|---|
| 1213 | metric = 1;
|
|---|
| 1214 | @@ -1423,26 +1031,6 @@
|
|---|
| 1215 | }
|
|---|
| 1216 |
|
|---|
| 1217 | }
|
|---|
| 1218 | -
|
|---|
| 1219 | - if (strstr(logtypes, "gps")) {
|
|---|
| 1220 | - if (gps_log == 0) {
|
|---|
| 1221 | - fprintf(stderr, "WARNING: Disabling GPS logging.\n");
|
|---|
| 1222 | - } else {
|
|---|
| 1223 | - gps_log = 1;
|
|---|
| 1224 | -
|
|---|
| 1225 | - if (conf->FetchOpt("logtemplate") == "") {
|
|---|
| 1226 | - fprintf(stderr, "FATAL: Logging (gps coordinates) enabled but no logtemplate given in config.\n");
|
|---|
| 1227 | - ErrorShutdown();
|
|---|
| 1228 | - }
|
|---|
| 1229 | - }
|
|---|
| 1230 | -
|
|---|
| 1231 | - }
|
|---|
| 1232 | -
|
|---|
| 1233 | - if (gps_log == 1 && !net_log) {
|
|---|
| 1234 | - fprintf(stderr, "WARNING: Logging (gps coordinates) enabled but XML logging (networks) was not.\n"
|
|---|
| 1235 | - "It will be enabled now.\n");
|
|---|
| 1236 | - xml_log = 1;
|
|---|
| 1237 | - }
|
|---|
| 1238 | }
|
|---|
| 1239 |
|
|---|
| 1240 | if (conf->FetchOpt("decay") != "") {
|
|---|
| 1241 | @@ -1563,72 +1151,6 @@
|
|---|
| 1242 | legal_ipblock_vec.push_back(ipb);
|
|---|
| 1243 | }
|
|---|
| 1244 |
|
|---|
| 1245 | - // Process sound stuff
|
|---|
| 1246 | - if (conf->FetchOpt("sound") == "true" && sound == -1) {
|
|---|
| 1247 | - if (conf->FetchOpt("soundplay") != "") {
|
|---|
| 1248 | - sndplay = conf->FetchOpt("soundplay");
|
|---|
| 1249 | -
|
|---|
| 1250 | - if (conf->FetchOpt("soundopts") != "")
|
|---|
| 1251 | - sndplay += " " + conf->FetchOpt("soundopts");
|
|---|
| 1252 | -
|
|---|
| 1253 | - sound = 1;
|
|---|
| 1254 | -
|
|---|
| 1255 | - if (conf->FetchOpt("sound_new") != "")
|
|---|
| 1256 | - wav_map["new"] = conf->FetchOpt("sound_new");
|
|---|
| 1257 | - if (conf->FetchOpt("sound_new_wep") != "")
|
|---|
| 1258 | - wav_map["new_wep"] = conf->FetchOpt("sound_new_wep");
|
|---|
| 1259 | - if (conf->FetchOpt("sound_traffic") != "")
|
|---|
| 1260 | - wav_map["traffic"] = conf->FetchOpt("sound_traffic");
|
|---|
| 1261 | - if (conf->FetchOpt("sound_junktraffic") != "")
|
|---|
| 1262 | - wav_map["junktraffic"] = conf->FetchOpt("sound_traffic");
|
|---|
| 1263 | - if (conf->FetchOpt("sound_gpslock") != "")
|
|---|
| 1264 | - wav_map["gpslock"] = conf->FetchOpt("sound_gpslock");
|
|---|
| 1265 | - if (conf->FetchOpt("sound_gpslost") != "")
|
|---|
| 1266 | - wav_map["gpslost"] = conf->FetchOpt("sound_gpslost");
|
|---|
| 1267 | - if (conf->FetchOpt("sound_alert") != "")
|
|---|
| 1268 | - wav_map["alert"] = conf->FetchOpt("sound_alert");
|
|---|
| 1269 | -
|
|---|
| 1270 | - } else {
|
|---|
| 1271 | - fprintf(stderr, "ERROR: Sound alerts enabled but no sound playing binary specified.\n");
|
|---|
| 1272 | - sound = 0;
|
|---|
| 1273 | - }
|
|---|
| 1274 | - } else if (sound == -1)
|
|---|
| 1275 | - sound = 0;
|
|---|
| 1276 | -
|
|---|
| 1277 | - /* Added by Shaw Innes 17/2/02 */
|
|---|
| 1278 | - /* Modified by Andrew Etter 15/9/02 */
|
|---|
| 1279 | - if (conf->FetchOpt("speech") == "true" && speech == -1) {
|
|---|
| 1280 | - if (conf->FetchOpt("festival") != "") {
|
|---|
| 1281 | - festival = strdup(conf->FetchOpt("festival").c_str());
|
|---|
| 1282 | - speech = 1;
|
|---|
| 1283 | -
|
|---|
| 1284 | - if (conf->FetchOpt("flite") == "true")
|
|---|
| 1285 | - flite = 1;
|
|---|
| 1286 | -
|
|---|
| 1287 | - string speechtype = conf->FetchOpt("speech_type");
|
|---|
| 1288 | -
|
|---|
| 1289 | - if (!strcasecmp(speechtype.c_str(), "nato"))
|
|---|
| 1290 | - speech_encoding = SPEECH_ENCODING_NATO;
|
|---|
| 1291 | - else if (!strcasecmp(speechtype.c_str(), "spell"))
|
|---|
| 1292 | - speech_encoding = SPEECH_ENCODING_SPELL;
|
|---|
| 1293 | - else
|
|---|
| 1294 | - speech_encoding = SPEECH_ENCODING_NORMAL;
|
|---|
| 1295 | -
|
|---|
| 1296 | - // Make sure we have encrypted text lines
|
|---|
| 1297 | - if (conf->FetchOpt("speech_encrypted") == "" || conf->FetchOpt("speech_unencrypted") == "") {
|
|---|
| 1298 | - fprintf(stderr, "ERROR: Speech request but speech_encrypted or speech_unencrypted line missing.\n");
|
|---|
| 1299 | - speech = 0;
|
|---|
| 1300 | - }
|
|---|
| 1301 | -
|
|---|
| 1302 | - speech_sentence_encrypted = conf->FetchOpt("speech_encrypted");
|
|---|
| 1303 | - speech_sentence_unencrypted = conf->FetchOpt("speech_unencrypted");
|
|---|
| 1304 | - } else {
|
|---|
| 1305 | - fprintf(stderr, "ERROR: Speech alerts enabled but no path to festival has been specified.\n");
|
|---|
| 1306 | - speech = 0;
|
|---|
| 1307 | - }
|
|---|
| 1308 | - } else if (speech == -1)
|
|---|
| 1309 | - speech = 0;
|
|---|
| 1310 | -
|
|---|
| 1311 | if (conf->FetchOpt("writeinterval") != "") {
|
|---|
| 1312 | if (sscanf(conf->FetchOpt("writeinterval").c_str(), "%d", &datainterval) != 1) {
|
|---|
| 1313 | fprintf(stderr, "FATAL: Illegal config file value for data interval.\n");
|
|---|
| 1314 | @@ -1648,45 +1170,6 @@
|
|---|
| 1315 | fprintf(stderr, "WARNING: No client_manuf file specified. Client manufacturers will not be detected.\n");
|
|---|
| 1316 | }
|
|---|
| 1317 |
|
|---|
| 1318 | - // Fork and find the sound options
|
|---|
| 1319 | - if (sound) {
|
|---|
| 1320 | - if (pipe(soundpair) == -1) {
|
|---|
| 1321 | - fprintf(stderr, "WARNING: Unable to create pipe for audio. Disabling sound.\n");
|
|---|
| 1322 | - sound = 0;
|
|---|
| 1323 | - } else {
|
|---|
| 1324 | - soundpid = fork();
|
|---|
| 1325 | -
|
|---|
| 1326 | - if (soundpid < 0) {
|
|---|
| 1327 | - fprintf(stderr, "WARNING: Unable to fork for audio. Disabling sound.\n");
|
|---|
| 1328 | - sound = 0;
|
|---|
| 1329 | - } else if (soundpid == 0) {
|
|---|
| 1330 | - SoundHandler(soundpair, sndplay.c_str(), wav_map);
|
|---|
| 1331 | - exit(0);
|
|---|
| 1332 | - }
|
|---|
| 1333 | -
|
|---|
| 1334 | - close(soundpair[0]);
|
|---|
| 1335 | - }
|
|---|
| 1336 | - }
|
|---|
| 1337 | -
|
|---|
| 1338 | - if (speech) {
|
|---|
| 1339 | - if (pipe(speechpair) == -1) {
|
|---|
| 1340 | - fprintf(stderr, "WARNING: Unable to create pipe for speech. Disabling speech.\n");
|
|---|
| 1341 | - speech = 0;
|
|---|
| 1342 | - } else {
|
|---|
| 1343 | - speechpid = fork();
|
|---|
| 1344 | -
|
|---|
| 1345 | - if (speechpid < 0) {
|
|---|
| 1346 | - fprintf(stderr, "WARNING: Unable to fork for speech. Disabling speech.\n");
|
|---|
| 1347 | - speech = 0;
|
|---|
| 1348 | - } else if (speechpid == 0) {
|
|---|
| 1349 | - SpeechHandler(speechpair, festival);
|
|---|
| 1350 | - exit(0);
|
|---|
| 1351 | - }
|
|---|
| 1352 | -
|
|---|
| 1353 | - close(speechpair[0]);
|
|---|
| 1354 | - }
|
|---|
| 1355 | - }
|
|---|
| 1356 | -
|
|---|
| 1357 | // Grab the filtering
|
|---|
| 1358 | string filter_bit;
|
|---|
| 1359 |
|
|---|
| 1360 | @@ -1712,7 +1195,7 @@
|
|---|
| 1361 | }
|
|---|
| 1362 |
|
|---|
| 1363 | if ((filter_bit = conf->FetchOpt("filter_export")) != "") {
|
|---|
| 1364 | - fprintf(stderr, "Enabling filtering on exported (csv, xml, network, gps) files.\n");
|
|---|
| 1365 | + fprintf(stderr, "Enabling filtering on exported (csv, xml, network) files.\n");
|
|---|
| 1366 | filter_export = 1;
|
|---|
| 1367 | if (ConfigFile::ParseFilterLine(filter_bit, &filter_export_bssid, &filter_export_source,
|
|---|
| 1368 | &filter_export_dest, &filter_export_bssid_invert,
|
|---|
| 1369 | @@ -1818,14 +1301,6 @@
|
|---|
| 1370 |
|
|---|
| 1371 | }
|
|---|
| 1372 |
|
|---|
| 1373 | - if (waypoint) {
|
|---|
| 1374 | - if ((waypoint_file = fopen(waypointfile.c_str(), "a")) == NULL) {
|
|---|
| 1375 | - fprintf(stderr, "WARNING: Could not open waypoint file '%s' for writing: %s\n",
|
|---|
| 1376 | - waypointfile.c_str(), strerror(errno));
|
|---|
| 1377 | - waypoint = 0;
|
|---|
| 1378 | - }
|
|---|
| 1379 | - }
|
|---|
| 1380 | -
|
|---|
| 1381 | // Create all the logs and title/number them appropriately
|
|---|
| 1382 | // We need to save this for after we toast the conf record
|
|---|
| 1383 | int logfile_matched = 0;
|
|---|
| 1384 | @@ -1873,13 +1348,6 @@
|
|---|
| 1385 | continue;
|
|---|
| 1386 | }
|
|---|
| 1387 |
|
|---|
| 1388 | - if (gps_log == 1) {
|
|---|
| 1389 | - gpslogfile = conf->ExpandLogPath(conf->FetchOpt("logtemplate"), logname, "gps", run_num);
|
|---|
| 1390 | -
|
|---|
| 1391 | - if (gpslogfile == "")
|
|---|
| 1392 | - continue;
|
|---|
| 1393 | - }
|
|---|
| 1394 | -
|
|---|
| 1395 | // if we made it this far we're cool -- all the logfiles we're writing to matched
|
|---|
| 1396 | // this number
|
|---|
| 1397 | logfile_matched = 1;
|
|---|
| 1398 | @@ -1908,9 +1376,6 @@
|
|---|
| 1399 | if (cisco_log)
|
|---|
| 1400 | fprintf(stderr, "Logging cisco product information to %s\n", ciscologfile.c_str());
|
|---|
| 1401 |
|
|---|
| 1402 | - if (gps_log == 1)
|
|---|
| 1403 | - fprintf(stderr, "Logging gps coordinates to %s\n", gpslogfile.c_str());
|
|---|
| 1404 | -
|
|---|
| 1405 | if (data_log)
|
|---|
| 1406 | fprintf(stderr, "Logging data to %s\n", dumplogfile.c_str());
|
|---|
| 1407 |
|
|---|
| 1408 | @@ -2058,7 +1523,6 @@
|
|---|
| 1409 | { "dump-type", required_argument, 0, 'd' },
|
|---|
| 1410 | { "max-packets", required_argument, 0, 'm' },
|
|---|
| 1411 | { "quiet", no_argument, 0, 'q' },
|
|---|
| 1412 | - { "gps", required_argument, 0, 'g' },
|
|---|
| 1413 | { "port", required_argument, 0, 'p' },
|
|---|
| 1414 | { "allowed-hosts", required_argument, 0, 'a' },
|
|---|
| 1415 | { "bind-address", required_argument, 0, 'b'},
|
|---|
| 1416 | @@ -2140,18 +1604,6 @@
|
|---|
| 1417 | Usage(argv[0]);
|
|---|
| 1418 | }
|
|---|
| 1419 | break;
|
|---|
| 1420 | - case 'g':
|
|---|
| 1421 | - // GPS
|
|---|
| 1422 | - if (strcmp(optarg, "off") == 0) {
|
|---|
| 1423 | - gps_enable = 0;
|
|---|
| 1424 | - }
|
|---|
| 1425 | - else if (sscanf(optarg, "%1023[^:]:%d", gpshost, &gpsport) < 2) {
|
|---|
| 1426 | - fprintf(stderr, "Invalid GPS host '%s' (host:port or off required)\n",
|
|---|
| 1427 | - optarg);
|
|---|
| 1428 | - gps_enable = 1;
|
|---|
| 1429 | - Usage(argv[0]);
|
|---|
| 1430 | - }
|
|---|
| 1431 | - break;
|
|---|
| 1432 | case 'p':
|
|---|
| 1433 | // Port
|
|---|
| 1434 | if (sscanf(optarg, "%d", &tcpport) != 1) {
|
|---|
| 1435 | @@ -2173,7 +1625,6 @@
|
|---|
| 1436 | break;
|
|---|
| 1437 | case 'q':
|
|---|
| 1438 | // Quiet
|
|---|
| 1439 | - sound = 0;
|
|---|
| 1440 | break;
|
|---|
| 1441 | case 'v':
|
|---|
| 1442 | // version
|
|---|
| 1443 | @@ -2331,39 +1782,6 @@
|
|---|
| 1444 | // And we're done
|
|---|
| 1445 | fclose(pid_file);
|
|---|
| 1446 |
|
|---|
| 1447 | -
|
|---|
| 1448 | - // Set up the GPS object to give to the children
|
|---|
| 1449 | - if (gpsport == -1 && gps_enable) {
|
|---|
| 1450 | - if (conf->FetchOpt("gps") == "true") {
|
|---|
| 1451 | - if (sscanf(conf->FetchOpt("gpshost").c_str(), "%1023[^:]:%d", gpshost,
|
|---|
| 1452 | - &gpsport) != 2) {
|
|---|
| 1453 | - fprintf(stderr, "Invalid GPS host in config (host:port required)\n");
|
|---|
| 1454 | - exit(1);
|
|---|
| 1455 | - }
|
|---|
| 1456 | -
|
|---|
| 1457 | - gps_enable = 1;
|
|---|
| 1458 | - } else {
|
|---|
| 1459 | - gps_enable = 0;
|
|---|
| 1460 | - gps_log = 0;
|
|---|
| 1461 | - }
|
|---|
| 1462 | - }
|
|---|
| 1463 | -
|
|---|
| 1464 | - if (gps_enable == 1) {
|
|---|
| 1465 | - gps = new GPSD(gpshost, gpsport);
|
|---|
| 1466 | -
|
|---|
| 1467 | - // Lock GPS position
|
|---|
| 1468 | - if (conf->FetchOpt("gpsmodelock") == "true") {
|
|---|
| 1469 | - fprintf(stderr, "Enabling GPS position lock override (broken GPS unit "
|
|---|
| 1470 | - "reports 0 always)\n");
|
|---|
| 1471 | - gps->SetOptions(GPSD_OPT_FORCEMODE);
|
|---|
| 1472 | - }
|
|---|
| 1473 | -
|
|---|
| 1474 | - } else {
|
|---|
| 1475 | - gps_log = 0;
|
|---|
| 1476 | - }
|
|---|
| 1477 | -
|
|---|
| 1478 | - // Register the gps and timetracker with the sourcetracker
|
|---|
| 1479 | - sourcetracker.AddGpstracker(gps);
|
|---|
| 1480 | sourcetracker.AddTimetracker(&timetracker);
|
|---|
| 1481 |
|
|---|
| 1482 | // Handle errors here maybe in the future
|
|---|
| 1483 | @@ -2530,13 +1948,6 @@
|
|---|
| 1484 | fprintf(stderr, "Dump file format: %s\n", dumpfile->FetchType());
|
|---|
| 1485 | }
|
|---|
| 1486 |
|
|---|
| 1487 | - if (gps_enable && gps_log == 1) {
|
|---|
| 1488 | - if (gpsdump.OpenDump(gpslogfile.c_str(), xmllogfile.c_str()) < 0) {
|
|---|
| 1489 | - fprintf(stderr, "FATAL: GPS dump error: %s\n", gpsdump.FetchError());
|
|---|
| 1490 | - ErrorShutdown();
|
|---|
| 1491 | - }
|
|---|
| 1492 | - }
|
|---|
| 1493 | -
|
|---|
| 1494 | // Open our files first to make sure we can, we'll unlink the empties later.
|
|---|
| 1495 | FILE *testfile = NULL;
|
|---|
| 1496 | if (net_log) {
|
|---|
| 1497 | @@ -2608,14 +2019,13 @@
|
|---|
| 1498 | */
|
|---|
| 1499 |
|
|---|
| 1500 | if (data_log || net_log || crypt_log) {
|
|---|
| 1501 | - snprintf(status, STATUS_MAX, "Logging%s%s%s%s%s%s%s",
|
|---|
| 1502 | + snprintf(status, STATUS_MAX, "Logging%s%s%s%s%s%s",
|
|---|
| 1503 | data_log ? " data" : "" ,
|
|---|
| 1504 | net_log ? " networks" : "" ,
|
|---|
| 1505 | csv_log ? " CSV" : "" ,
|
|---|
| 1506 | xml_log ? " XML" : "" ,
|
|---|
| 1507 | crypt_log ? " weak" : "",
|
|---|
| 1508 | - cisco_log ? " cisco" : "",
|
|---|
| 1509 | - gps_log == 1 ? " gps" : "");
|
|---|
| 1510 | + cisco_log ? " cisco" : "");
|
|---|
| 1511 | fprintf(stderr, "%s\n", status);
|
|---|
| 1512 | } else if (no_log) {
|
|---|
| 1513 | snprintf(status, STATUS_MAX, "Not logging any data.");
|
|---|
| 1514 | @@ -2633,23 +2043,6 @@
|
|---|
| 1515 | }
|
|---|
| 1516 | }
|
|---|
| 1517 |
|
|---|
| 1518 | - if (gps_enable) {
|
|---|
| 1519 | - // Open the GPS
|
|---|
| 1520 | - if (gps->OpenGPSD() < 0) {
|
|---|
| 1521 | - fprintf(stderr, "%s\n", gps->FetchError());
|
|---|
| 1522 | -
|
|---|
| 1523 | - gps_enable = 0;
|
|---|
| 1524 | - gps_log = 0;
|
|---|
| 1525 | - } else {
|
|---|
| 1526 | - fprintf(stderr, "Opened GPS connection to %s port %d\n",
|
|---|
| 1527 | - gpshost, gpsport);
|
|---|
| 1528 | -
|
|---|
| 1529 | - gpsmode = gps->FetchMode();
|
|---|
| 1530 | -
|
|---|
| 1531 | - last_gpsd_reconnect = time(0);
|
|---|
| 1532 | - }
|
|---|
| 1533 | - }
|
|---|
| 1534 | -
|
|---|
| 1535 | fprintf(stderr, "Listening on port %d.\n", tcpport);
|
|---|
| 1536 | for (unsigned int ipvi = 0; ipvi < legal_ipblock_vec.size(); ipvi++) {
|
|---|
| 1537 | char *netaddr = strdup(inet_ntoa(legal_ipblock_vec[ipvi]->network));
|
|---|
| 1538 | @@ -2690,8 +2083,6 @@
|
|---|
| 1539 | &Protocol_NETWORK, &ProtocolNetworkEnable);
|
|---|
| 1540 | client_ref = ui_server.RegisterProtocol("CLIENT", 0, CLIENT_fields_text,
|
|---|
| 1541 | &Protocol_CLIENT, &ProtocolClientEnable);
|
|---|
| 1542 | - gps_ref = ui_server.RegisterProtocol("GPS", 0, GPS_fields_text,
|
|---|
| 1543 | - &Protocol_GPS, NULL);
|
|---|
| 1544 | info_ref = ui_server.RegisterProtocol("INFO", 0, INFO_fields_text,
|
|---|
| 1545 | &Protocol_INFO, NULL);
|
|---|
| 1546 | remove_ref = ui_server.RegisterProtocol("REMOVE", 0, REMOVE_fields_text,
|
|---|
| 1547 | @@ -2746,14 +2137,9 @@
|
|---|
| 1548 | // Write network info and tick the tracker once per second
|
|---|
| 1549 | timetracker.RegisterTimer(SERVER_TIMESLICES_SEC, NULL, 1, &NetWriteEvent, NULL);
|
|---|
| 1550 | timetracker.RegisterTimer(SERVER_TIMESLICES_SEC, NULL, 1, &TrackerTickEvent, NULL);
|
|---|
| 1551 | - // Update GPS coordinates and handle signal loss if defined
|
|---|
| 1552 | - timetracker.RegisterTimer(SERVER_TIMESLICES_SEC, NULL, 1, &GpsEvent, NULL);
|
|---|
| 1553 | // Sync the data files if requested
|
|---|
| 1554 | if (datainterval > 0 && no_log == 0)
|
|---|
| 1555 | timetracker.RegisterTimer(datainterval * SERVER_TIMESLICES_SEC, NULL, 1, &ExportSyncEvent, NULL);
|
|---|
| 1556 | - // Write waypoints if requested
|
|---|
| 1557 | - if (waypoint)
|
|---|
| 1558 | - timetracker.RegisterTimer(decay * SERVER_TIMESLICES_SEC, NULL, 1, &WaypointSyncEvent, NULL);
|
|---|
| 1559 | // Channel hop if requested
|
|---|
| 1560 | if (channel_hop) {
|
|---|
| 1561 | if (channel_dwell)
|
|---|
| 1562 | @@ -2777,7 +2163,6 @@
|
|---|
| 1563 | snprintf(status, 1024, "%s", TIMESTAMP);
|
|---|
| 1564 | kdata.timestamp = status;
|
|---|
| 1565 |
|
|---|
| 1566 | - time_t last_click = 0;
|
|---|
| 1567 | int num_networks = 0, num_packets = 0, num_noise = 0, num_dropped = 0;
|
|---|
| 1568 |
|
|---|
| 1569 |
|
|---|
| 1570 | @@ -2926,54 +2311,13 @@
|
|---|
| 1571 |
|
|---|
| 1572 | }
|
|---|
| 1573 |
|
|---|
| 1574 | - if (gps_log == 1 && info.type != packet_noise &&
|
|---|
| 1575 | - info.type != packet_unknown && info.type != packet_phy &&
|
|---|
| 1576 | - info.corrupt == 0) {
|
|---|
| 1577 | - if (gpsdump.DumpPacket(&info) < 0) {
|
|---|
| 1578 | - snprintf(status, STATUS_MAX, "%s", gpsdump.FetchError());
|
|---|
| 1579 | - if (!silent || NetWriteStatus(status) == 0)
|
|---|
| 1580 | - fprintf(stderr, "%s\n", status);
|
|---|
| 1581 | - }
|
|---|
| 1582 | - }
|
|---|
| 1583 | -
|
|---|
| 1584 | // tracker.ProcessPacket(info);
|
|---|
| 1585 | tracker.ProcessPacket(&packet, &info, &bssid_wep_map,
|
|---|
| 1586 | wep_identity);
|
|---|
| 1587 |
|
|---|
| 1588 | - if (tracker.FetchNumNetworks() > num_networks) {
|
|---|
| 1589 | - if (sound == 1)
|
|---|
| 1590 | - if (info.crypt_set &&
|
|---|
| 1591 | - wav_map.find("new_wep") != wav_map.end())
|
|---|
| 1592 | - sound = PlaySound("new_wep");
|
|---|
| 1593 | - else
|
|---|
| 1594 | - sound = PlaySound("new");
|
|---|
| 1595 | - if (speech == 1) {
|
|---|
| 1596 | - string text;
|
|---|
| 1597 | -
|
|---|
| 1598 | - if (info.crypt_set)
|
|---|
| 1599 | - text = ExpandSpeechString(speech_sentence_encrypted, &info,
|
|---|
| 1600 | - speech_encoding);
|
|---|
| 1601 | - else
|
|---|
| 1602 | - text = ExpandSpeechString(speech_sentence_unencrypted,
|
|---|
| 1603 | - &info, speech_encoding);
|
|---|
| 1604 | -
|
|---|
| 1605 | - speech = SayText(MungeToShell(text).c_str());
|
|---|
| 1606 | - }
|
|---|
| 1607 | - }
|
|---|
| 1608 | num_networks = tracker.FetchNumNetworks();
|
|---|
| 1609 |
|
|---|
| 1610 | if (tracker.FetchNumPackets() != num_packets) {
|
|---|
| 1611 | - if (cur_time - last_click >= decay && sound == 1) {
|
|---|
| 1612 | - if (tracker.FetchNumPackets() - num_packets >
|
|---|
| 1613 | - tracker.FetchNumDropped() + localdropnum - num_dropped) {
|
|---|
| 1614 | - sound = PlaySound("traffic");
|
|---|
| 1615 | - } else {
|
|---|
| 1616 | - sound = PlaySound("junktraffic");
|
|---|
| 1617 | - }
|
|---|
| 1618 | -
|
|---|
| 1619 | - last_click = cur_time;
|
|---|
| 1620 | - }
|
|---|
| 1621 | -
|
|---|
| 1622 | num_packets = tracker.FetchNumPackets();
|
|---|
| 1623 | num_noise = tracker.FetchNumNoise();
|
|---|
| 1624 | num_dropped = tracker.FetchNumDropped() + localdropnum;
|
|---|
| 1625 | diff -urN kismet.dev/kismet_server.h kismet.dev2/kismet_server.h
|
|---|
| 1626 | --- kismet.dev/kismet_server.h 2004-03-07 22:28:01.000000000 +0100
|
|---|
| 1627 | +++ kismet.dev2/kismet_server.h 2006-04-14 19:31:55.000000000 +0200
|
|---|
| 1628 | @@ -33,10 +33,6 @@
|
|---|
| 1629 | void handle_command(TcpServer *tcps, client_command *cc);
|
|---|
| 1630 | int NetWriteStatus(const char *in_status);
|
|---|
| 1631 | void NetWriteInfo();
|
|---|
| 1632 | -int SayText(string in_text);
|
|---|
| 1633 | -int PlaySound(string in_sound);
|
|---|
| 1634 | -void SpeechHandler(int *fds, const char *player);
|
|---|
| 1635 | -void SoundHandler(int *fds, const char *player, map<string, string> soundmap);
|
|---|
| 1636 | void ProtocolAlertEnable(int in_fd);
|
|---|
| 1637 | void ProtocolNetworkEnable(int in_fd);
|
|---|
| 1638 | void ProtocolClientEnable(int in_fd);
|
|---|
| 1639 | diff -urN kismet.dev/kis_packsources.cc kismet.dev2/kis_packsources.cc
|
|---|
| 1640 | --- kismet.dev/kis_packsources.cc 2006-04-14 23:43:01.694817572 +0200
|
|---|
| 1641 | +++ kismet.dev2/kis_packsources.cc 2006-04-14 20:21:12.000000000 +0200
|
|---|
| 1642 | @@ -64,13 +64,8 @@
|
|---|
| 1643 | pcapsource_11g_registrant,
|
|---|
| 1644 | monitor_wext, unmonitor_wext,
|
|---|
| 1645 | chancontrol_wext, 1);
|
|---|
| 1646 | - sourcetracker->RegisterPacketsource("cisco", 1, "IEEE80211b", 6,
|
|---|
| 1647 | - pcapsource_wext_registrant,
|
|---|
| 1648 | - monitor_cisco, unmonitor_cisco,
|
|---|
| 1649 | - chancontrol_wext, 1);
|
|---|
| 1650 | - sourcetracker->RegisterPacketsource("cisco_wifix", 1, "IEEE80211b", 6,
|
|---|
| 1651 | - pcapsource_ciscowifix_registrant,
|
|---|
| 1652 | - monitor_cisco_wifix, NULL, NULL, 1);
|
|---|
| 1653 | + REG_EMPTY_CARD(sourcetracker, "cisco");
|
|---|
| 1654 | + REG_EMPTY_CARD(sourcetracker, "cisco_wifix");
|
|---|
| 1655 | sourcetracker->RegisterPacketsource("hostap", 1, "IEEE80211b", 6,
|
|---|
| 1656 | pcapsource_wext_registrant,
|
|---|
| 1657 | monitor_hostap, unmonitor_hostap,
|
|---|
| 1658 | @@ -83,21 +78,10 @@
|
|---|
| 1659 | pcapsource_wext_registrant,
|
|---|
| 1660 | monitor_orinoco, unmonitor_orinoco,
|
|---|
| 1661 | chancontrol_orinoco, 1);
|
|---|
| 1662 | - sourcetracker->RegisterPacketsource("acx100", 1, "IEEE80211b", 6,
|
|---|
| 1663 | - pcapsource_wext_registrant,
|
|---|
| 1664 | - monitor_acx100, unmonitor_acx100,
|
|---|
| 1665 | - chancontrol_wext, 1);
|
|---|
| 1666 | - sourcetracker->RegisterPacketsource("admtek", 1, "IEEE80211b", 6,
|
|---|
| 1667 | - pcapsource_wext_registrant,
|
|---|
| 1668 | - monitor_admtek, unmonitor_admtek,
|
|---|
| 1669 | - chancontrol_wext, 1);
|
|---|
| 1670 | - sourcetracker->RegisterPacketsource("vtar5k", 1, "IEEE80211a", 36,
|
|---|
| 1671 | - pcapsource_wext_registrant,
|
|---|
| 1672 | - monitor_vtar5k, NULL, chancontrol_wext, 1);
|
|---|
| 1673 | - sourcetracker->RegisterPacketsource("atmel_usb", 1, "IEEE80211b", 6,
|
|---|
| 1674 | - pcapsource_wext_registrant,
|
|---|
| 1675 | - monitor_wext, unmonitor_wext,
|
|---|
| 1676 | - chancontrol_wext, 1);
|
|---|
| 1677 | + REG_EMPTY_CARD(sourcetracker, "acx100");
|
|---|
| 1678 | + REG_EMPTY_CARD(sourcetracker, "admtek");
|
|---|
| 1679 | + REG_EMPTY_CARD(sourcetracker, "vtar5k");
|
|---|
| 1680 | + REG_EMPTY_CARD(sourcetracker, "atmel_usb");
|
|---|
| 1681 |
|
|---|
| 1682 | sourcetracker->RegisterPacketsource("madwifi_a", 1, "IEEE80211a", 36,
|
|---|
| 1683 | pcapsource_wextfcs_registrant,
|
|---|
| 1684 | @@ -146,50 +130,17 @@
|
|---|
| 1685 | monitor_prism54g, unmonitor_prism54g,
|
|---|
| 1686 | chancontrol_prism54g, 1);
|
|---|
| 1687 |
|
|---|
| 1688 | - sourcetracker->RegisterPacketsource("wlanng_wext", 1, "IEEE80211b", 6,
|
|---|
| 1689 | - pcapsource_wlanng_registrant,
|
|---|
| 1690 | - monitor_wlanng_avs, NULL,
|
|---|
| 1691 | - chancontrol_wext, 1);
|
|---|
| 1692 | -
|
|---|
| 1693 | - sourcetracker->RegisterPacketsource("ipw2100", 1, "IEEE80211b", 6,
|
|---|
| 1694 | - pcapsource_wext_registrant,
|
|---|
| 1695 | - monitor_ipw2100, unmonitor_ipw2100,
|
|---|
| 1696 | - chancontrol_ipw2100, 1);
|
|---|
| 1697 | -
|
|---|
| 1698 | - sourcetracker->RegisterPacketsource("ipw2200", 1, "IEEE80211g", 6,
|
|---|
| 1699 | - pcapsource_wext_registrant,
|
|---|
| 1700 | - monitor_ipw2200, unmonitor_ipw2200,
|
|---|
| 1701 | - chancontrol_ipw2200, 1);
|
|---|
| 1702 | -
|
|---|
| 1703 | - sourcetracker->RegisterPacketsource("ipw2915", 1, "IEEE80211ab", 6,
|
|---|
| 1704 | - pcapsource_wext_registrant,
|
|---|
| 1705 | - monitor_ipw2200, unmonitor_ipw2200,
|
|---|
| 1706 | - chancontrol_ipw2200, 1);
|
|---|
| 1707 | -
|
|---|
| 1708 | - sourcetracker->RegisterPacketsource("ipw3945", 1, "IEEE80211ab", 6,
|
|---|
| 1709 | - pcapsource_wext_registrant,
|
|---|
| 1710 | - monitor_ipw3945, unmonitor_ipw3945,
|
|---|
| 1711 | - chancontrol_ipw2200, 1);
|
|---|
| 1712 | -
|
|---|
| 1713 | - sourcetracker->RegisterPacketsource("ipwlivetap", 1, "IEEE80211b", 0,
|
|---|
| 1714 | - pcapsource_wext_registrant,
|
|---|
| 1715 | - monitor_ipwlivetap,
|
|---|
| 1716 | - unmonitor_ipwlivetap,
|
|---|
| 1717 | - NULL, 1);
|
|---|
| 1718 | -
|
|---|
| 1719 | - sourcetracker->RegisterPacketsource("rt2400", 1, "IEEE80211b", 6,
|
|---|
| 1720 | - pcapsource_wext_registrant,
|
|---|
| 1721 | - monitor_wext, unmonitor_wext,
|
|---|
| 1722 | - chancontrol_wext, 1);
|
|---|
| 1723 | - sourcetracker->RegisterPacketsource("rt2500", 1, "IEEE80211g", 6,
|
|---|
| 1724 | - pcapsource_11g_registrant,
|
|---|
| 1725 | - monitor_wext, unmonitor_wext,
|
|---|
| 1726 | - chancontrol_wext, 1);
|
|---|
| 1727 | - sourcetracker->RegisterPacketsource("rt8180", 1, "IEEE80211b", 6,
|
|---|
| 1728 | - pcapsource_wext_registrant,
|
|---|
| 1729 | - monitor_wext, unmonitor_wext,
|
|---|
| 1730 | - chancontrol_wext, 1);
|
|---|
| 1731 | + REG_EMPTY_CARD(sourcetracker, "wlanng_wext");
|
|---|
| 1732 | + REG_EMPTY_CARD(sourcetracker, "ipw2100");
|
|---|
| 1733 | + REG_EMPTY_CARD(sourcetracker, "ipw2200");
|
|---|
| 1734 | + REG_EMPTY_CARD(sourcetracker, "ipw2915");
|
|---|
| 1735 | + REG_EMPTY_CARD(sourcetracker, "ipw3945");
|
|---|
| 1736 | + REG_EMPTY_CARD(sourcetracker, "ipwlivetap");
|
|---|
| 1737 |
|
|---|
| 1738 | + REG_EMPTY_CARD(sourcetracker, "rt2400");
|
|---|
| 1739 | + REG_EMPTY_CARD(sourcetracker, "rt2500");
|
|---|
| 1740 | + REG_EMPTY_CARD(sourcetracker, "rt8180");
|
|---|
| 1741 | +
|
|---|
| 1742 | sourcetracker->RegisterPacketsource("zd1211", 1, "IEEE80211g", 6,
|
|---|
| 1743 | pcapsource_wext_registrant,
|
|---|
| 1744 | monitor_wext, unmonitor_wext,
|
|---|
| 1745 | @@ -233,31 +184,13 @@
|
|---|
| 1746 | REG_EMPTY_CARD(sourcetracker, "zd1211");
|
|---|
| 1747 | #endif
|
|---|
| 1748 |
|
|---|
| 1749 | -#if defined(HAVE_LIBPCAP) && defined(SYS_LINUX)
|
|---|
| 1750 | - sourcetracker->RegisterPacketsource("wlanng", 1, "IEEE80211b", 6,
|
|---|
| 1751 | - pcapsource_wlanng_registrant,
|
|---|
| 1752 | - monitor_wlanng, NULL, chancontrol_wlanng, 1);
|
|---|
| 1753 | - sourcetracker->RegisterPacketsource("wlanng_avs", 1, "IEEE80211b", 6,
|
|---|
| 1754 | - pcapsource_wlanng_registrant,
|
|---|
| 1755 | - monitor_wlanng_avs, NULL,
|
|---|
| 1756 | - chancontrol_wlanng_avs, 1);
|
|---|
| 1757 | sourcetracker->RegisterPacketsource("wrt54g", 1, "na", 0,
|
|---|
| 1758 | pcapsource_wrt54g_registrant,
|
|---|
| 1759 | - monitor_wrt54g, unmonitor_wrt54g, chancontrol_wext, 0);
|
|---|
| 1760 | -#else
|
|---|
| 1761 | + monitor_wrt54g, unmonitor_wrt54g, chancontrol_wext, 0);
|
|---|
| 1762 | +
|
|---|
| 1763 | REG_EMPTY_CARD(sourcetracker, "wlanng");
|
|---|
| 1764 | REG_EMPTY_CARD(sourcetracker, "wlanng_avs");
|
|---|
| 1765 | - REG_EMPTY_CARD(sourcetracker, "wrt54g");
|
|---|
| 1766 | -#endif
|
|---|
| 1767 | -
|
|---|
| 1768 | -#if defined(SYS_LINUX) && defined(HAVE_LINUX_NETLINK)
|
|---|
| 1769 | - sourcetracker->RegisterPacketsource("wlanng_legacy", 1, "IEEE80211b", 6,
|
|---|
| 1770 | - prism2source_registrant,
|
|---|
| 1771 | - monitor_wlanng_legacy, NULL,
|
|---|
| 1772 | - chancontrol_wlanng_legacy, 1);
|
|---|
| 1773 | -#else
|
|---|
| 1774 | REG_EMPTY_CARD(sourcetracker, "wlanng_legacy");
|
|---|
| 1775 | -#endif
|
|---|
| 1776 |
|
|---|
| 1777 | #if defined(HAVE_LIBPCAP) && defined(SYS_OPENBSD)
|
|---|
| 1778 | sourcetracker->RegisterPacketsource("cisco_openbsd", 1, "IEEE80211b", 6,
|
|---|
| 1779 | @@ -291,29 +224,11 @@
|
|---|
| 1780 | REG_EMPTY_CARD(sourcetracker, "radiotap_bsd_b");
|
|---|
| 1781 | #endif
|
|---|
| 1782 |
|
|---|
| 1783 | -#if defined(HAVE_LIBWIRETAP)
|
|---|
| 1784 | - sourcetracker->RegisterPacketsource("wtapfile", 0, "na", 0,
|
|---|
| 1785 | - wtapfilesource_registrant,
|
|---|
| 1786 | - NULL, NULL, NULL, 0);
|
|---|
| 1787 | -#else
|
|---|
| 1788 | REG_EMPTY_CARD(sourcetracker, "wtapfile");
|
|---|
| 1789 | -#endif
|
|---|
| 1790 |
|
|---|
| 1791 | -#if defined(HAVE_WSP100)
|
|---|
| 1792 | - sourcetracker->RegisterPacketsource("wsp100", 0, "IEEE80211b", 6,
|
|---|
| 1793 | - wsp100source_registrant,
|
|---|
| 1794 | - monitor_wsp100, NULL, chancontrol_wsp100, 0);
|
|---|
| 1795 | -#else
|
|---|
| 1796 | REG_EMPTY_CARD(sourcetracker, "wsp100");
|
|---|
| 1797 | -#endif
|
|---|
| 1798 |
|
|---|
| 1799 | -#if defined(HAVE_VIHAHEADERS)
|
|---|
| 1800 | - sourcetracker->RegisterPacketsource("viha", 1, "IEEE80211b", 6,
|
|---|
| 1801 | - vihasource_registrant,
|
|---|
| 1802 | - NULL, NULL, chancontrol_viha, 0);
|
|---|
| 1803 | -#else
|
|---|
| 1804 | REG_EMPTY_CARD(sourcetracker, "viha");
|
|---|
| 1805 | -#endif
|
|---|
| 1806 |
|
|---|
| 1807 | return 1;
|
|---|
| 1808 | }
|
|---|
| 1809 | diff -urN kismet.dev/kis_packsources.h kismet.dev2/kis_packsources.h
|
|---|
| 1810 | --- kismet.dev/kis_packsources.h 2004-06-09 21:09:29.000000000 +0200
|
|---|
| 1811 | +++ kismet.dev2/kis_packsources.h 2006-04-14 19:31:55.000000000 +0200
|
|---|
| 1812 | @@ -22,11 +22,7 @@
|
|---|
| 1813 | #include "config.h"
|
|---|
| 1814 |
|
|---|
| 1815 | #include "packetsource.h"
|
|---|
| 1816 | -#include "prism2source.h"
|
|---|
| 1817 | #include "pcapsource.h"
|
|---|
| 1818 | -#include "wtapfilesource.h"
|
|---|
| 1819 | -#include "wsp100source.h"
|
|---|
| 1820 | -#include "vihasource.h"
|
|---|
| 1821 | #include "dronesource.h"
|
|---|
| 1822 | #include "packetsourcetracker.h"
|
|---|
| 1823 |
|
|---|
| 1824 | diff -urN kismet.dev/Makefile.in kismet.dev2/Makefile.in
|
|---|
| 1825 | --- kismet.dev/Makefile.in 2006-04-13 00:49:15.000000000 +0200
|
|---|
| 1826 | +++ kismet.dev2/Makefile.in 2006-04-14 19:31:55.000000000 +0200
|
|---|
| 1827 | @@ -39,26 +39,25 @@
|
|---|
| 1828 | DEPEND = .depend
|
|---|
| 1829 |
|
|---|
| 1830 | # Objects
|
|---|
| 1831 | -PSO = util.o ringbuf.o configfile.o speech.o ifcontrol.o iwcontrol.o packet.o \
|
|---|
| 1832 | - pcapsource.o prism2source.o wtapfilesource.o wsp100source.o \
|
|---|
| 1833 | - dronesource.o vihasource.o packetsourcetracker.o kis_packsources.o \
|
|---|
| 1834 | - wtapdump.o wtaplocaldump.o gpsdump.o airsnortdump.o fifodump.o \
|
|---|
| 1835 | - gpsd.o manuf.o \
|
|---|
| 1836 | +PSO = util.o ringbuf.o configfile.o ifcontrol.o iwcontrol.o packet.o \
|
|---|
| 1837 | + pcapsource.o manuf.o \
|
|---|
| 1838 | + dronesource.o packetsourcetracker.o kis_packsources.o \
|
|---|
| 1839 | + wtapdump.o wtaplocaldump.o airsnortdump.o fifodump.o \
|
|---|
| 1840 | packetracker.o timetracker.o alertracker.o finitestate.o \
|
|---|
| 1841 | getopt.o \
|
|---|
| 1842 | tcpserver.o server_protocols.o server_globals.o kismet_server.o
|
|---|
| 1843 | PS = kismet_server
|
|---|
| 1844 |
|
|---|
| 1845 | DRONEO = util.o ringbuf.o configfile.o getopt.o ifcontrol.o iwcontrol.o packet.o \
|
|---|
| 1846 | - tcpstreamer.o prism2source.o pcapsource.o wtapfilesource.o wsp100source.o \
|
|---|
| 1847 | - dronesource.o vihasource.o packetsourcetracker.o kis_packsources.o \
|
|---|
| 1848 | - timetracker.o gpsd.o server_globals.o kismet_drone.o
|
|---|
| 1849 | + tcpstreamer.o pcapsource.o \
|
|---|
| 1850 | + dronesource.o packetsourcetracker.o kis_packsources.o \
|
|---|
| 1851 | + timetracker.o server_globals.o kismet_drone.o
|
|---|
| 1852 | DRONE = kismet_drone
|
|---|
| 1853 |
|
|---|
| 1854 | -NCO = util.o configfile.o speech.o manuf.o tcpclient.o \
|
|---|
| 1855 | +NCO = util.o configfile.o manuf.o tcpclient.o \
|
|---|
| 1856 | frontend.o cursesfront.o \
|
|---|
| 1857 | panelfront.o panelfront_display.o panelfront_input.o \
|
|---|
| 1858 | - gpsd.o getopt.o kismet_client.o
|
|---|
| 1859 | + getopt.o kismet_client.o
|
|---|
| 1860 | NC = kismet_client
|
|---|
| 1861 |
|
|---|
| 1862 | GPSLO = getopt.o util.o configfile.o expat.o manuf.o \
|
|---|
| 1863 | diff -urN kismet.dev/packetracker.cc kismet.dev2/packetracker.cc
|
|---|
| 1864 | --- kismet.dev/packetracker.cc 2006-04-01 18:37:07.000000000 +0200
|
|---|
| 1865 | +++ kismet.dev2/packetracker.cc 2006-04-14 19:31:55.000000000 +0200
|
|---|
| 1866 | @@ -2443,23 +2443,3 @@
|
|---|
| 1867 |
|
|---|
| 1868 | }
|
|---|
| 1869 |
|
|---|
| 1870 | -// Write a gpsdrive compatable waypoint file
|
|---|
| 1871 | -int Packetracker::WriteGpsdriveWaypt(FILE *in_file) {
|
|---|
| 1872 | - fseek(in_file, 0L, SEEK_SET);
|
|---|
| 1873 | - ftruncate(fileno(in_file), 0);
|
|---|
| 1874 | -
|
|---|
| 1875 | - // Convert the map to a vector and sort it
|
|---|
| 1876 | - for (map<mac_addr, wireless_network *>::const_iterator i = bssid_map.begin();
|
|---|
| 1877 | - i != bssid_map.end(); ++i) {
|
|---|
| 1878 | - wireless_network *net = i->second;
|
|---|
| 1879 | -
|
|---|
| 1880 | - float lat, lon;
|
|---|
| 1881 | - lat = (net->min_lat + net->max_lat) / 2;
|
|---|
| 1882 | - lon = (net->min_lon + net->max_lon) / 2;
|
|---|
| 1883 | - fprintf(in_file, "%s\t%f %f\n", waypointformat == 1 ? net->ssid.c_str() : net->bssid.Mac2String().c_str(), lat, lon);
|
|---|
| 1884 | - }
|
|---|
| 1885 | -
|
|---|
| 1886 | - fflush(in_file);
|
|---|
| 1887 | -
|
|---|
| 1888 | - return 1;
|
|---|
| 1889 | -}
|
|---|
| 1890 | diff -urN kismet.dev/packetracker.h kismet.dev2/packetracker.h
|
|---|
| 1891 | --- kismet.dev/packetracker.h 2005-06-01 05:46:18.000000000 +0200
|
|---|
| 1892 | +++ kismet.dev2/packetracker.h 2006-04-14 19:31:55.000000000 +0200
|
|---|
| 1893 | @@ -30,7 +30,6 @@
|
|---|
| 1894 | #include <string>
|
|---|
| 1895 |
|
|---|
| 1896 | #include "util.h"
|
|---|
| 1897 | -#include "gpsd.h"
|
|---|
| 1898 | #include "packet.h"
|
|---|
| 1899 | #include "tracktypes.h"
|
|---|
| 1900 | #include "manuf.h"
|
|---|
| 1901 | @@ -85,8 +84,6 @@
|
|---|
| 1902 | int WriteXMLNetworks(string in_fname);
|
|---|
| 1903 | int WriteCisco(string in_fname);
|
|---|
| 1904 |
|
|---|
| 1905 | - int WriteGpsdriveWaypt(FILE *in_file);
|
|---|
| 1906 | -
|
|---|
| 1907 | void WriteSSIDMap(FILE *in_file);
|
|---|
| 1908 | void ReadSSIDMap(FILE *in_file);
|
|---|
| 1909 |
|
|---|
| 1910 | diff -urN kismet.dev/packetsourcetracker.cc kismet.dev2/packetsourcetracker.cc
|
|---|
| 1911 | --- kismet.dev/packetsourcetracker.cc 2006-04-14 23:43:01.695817542 +0200
|
|---|
| 1912 | +++ kismet.dev2/packetsourcetracker.cc 2006-04-14 19:31:55.000000000 +0200
|
|---|
| 1913 | @@ -27,7 +27,6 @@
|
|---|
| 1914 | Packetsourcetracker::Packetsourcetracker() {
|
|---|
| 1915 | next_packsource_id = 0;
|
|---|
| 1916 | next_meta_id = 0;
|
|---|
| 1917 | - gpsd = NULL;
|
|---|
| 1918 | timetracker = NULL;
|
|---|
| 1919 | chanchild_pid = 0;
|
|---|
| 1920 | sockpair[0] = sockpair[1] = 0;
|
|---|
| 1921 | @@ -694,7 +693,6 @@
|
|---|
| 1922 |
|
|---|
| 1923 | // Register the trackers with it
|
|---|
| 1924 | meta->capsource->AddTimetracker(timetracker);
|
|---|
| 1925 | - meta->capsource->AddGpstracker(gpsd);
|
|---|
| 1926 |
|
|---|
| 1927 | // Open it
|
|---|
| 1928 | fprintf(stderr, "Source %d (%s): Opening %s source interface %s...\n",
|
|---|
| 1929 | diff -urN kismet.dev/packetsourcetracker.h kismet.dev2/packetsourcetracker.h
|
|---|
| 1930 | --- kismet.dev/packetsourcetracker.h 2005-03-21 20:47:26.000000000 +0100
|
|---|
| 1931 | +++ kismet.dev2/packetsourcetracker.h 2006-04-14 19:31:55.000000000 +0200
|
|---|
| 1932 | @@ -30,7 +30,6 @@
|
|---|
| 1933 | #include <string>
|
|---|
| 1934 |
|
|---|
| 1935 | #include "timetracker.h"
|
|---|
| 1936 | -#include "gpsd.h"
|
|---|
| 1937 | #include "packetsource.h"
|
|---|
| 1938 |
|
|---|
| 1939 | // Sentinel for starting a new packet
|
|---|
| 1940 | @@ -144,9 +143,6 @@
|
|---|
| 1941 | // Register a timer event handler for us to use
|
|---|
| 1942 | void AddTimetracker(Timetracker *in_tracker) { timetracker = in_tracker; }
|
|---|
| 1943 |
|
|---|
| 1944 | - // Register the GPS server for us to use
|
|---|
| 1945 | - void AddGpstracker(GPSD *in_gpsd) { gpsd = in_gpsd; }
|
|---|
| 1946 | -
|
|---|
| 1947 | // Register a packet prototype source... Card type string, root binding requirement,
|
|---|
| 1948 | // function to generate an instance of the source, and function to change channel
|
|---|
| 1949 | // for this card type. This fills out the prototype. Sources that don't hop
|
|---|
| 1950 | @@ -221,7 +217,6 @@
|
|---|
| 1951 | uint16_t channel;
|
|---|
| 1952 | } chanchild_changepacket;
|
|---|
| 1953 |
|
|---|
| 1954 | - GPSD *gpsd;
|
|---|
| 1955 | Timetracker *timetracker;
|
|---|
| 1956 |
|
|---|
| 1957 | char errstr[1024];
|
|---|
| 1958 | diff -urN kismet.dev/panelfront.cc kismet.dev2/panelfront.cc
|
|---|
| 1959 | --- kismet.dev/panelfront.cc 2005-06-29 20:04:43.000000000 +0200
|
|---|
| 1960 | +++ kismet.dev2/panelfront.cc 2006-04-14 19:31:55.000000000 +0200
|
|---|
| 1961 | @@ -37,7 +37,6 @@
|
|---|
| 1962 | " Key Action",
|
|---|
| 1963 | " e List Kismet servers",
|
|---|
| 1964 | " z Toggle fullscreen zoom of network view",
|
|---|
| 1965 | - " m Toggle muting of sound and speech",
|
|---|
| 1966 | " t Tag (or untag) selected network",
|
|---|
| 1967 | " g Group tagged networks",
|
|---|
| 1968 | " u Ungroup current group",
|
|---|
| 1969 | @@ -121,7 +120,6 @@
|
|---|
| 1970 | "Key Action",
|
|---|
| 1971 | " e List Kismet servers",
|
|---|
| 1972 | " z Toggle fullscreen net list",
|
|---|
| 1973 | - " m Toggle muting",
|
|---|
| 1974 | " t Tag (or untag) selected",
|
|---|
| 1975 | " g Group tagged networks",
|
|---|
| 1976 | " u Ungroup current group",
|
|---|
| 1977 | @@ -237,19 +235,6 @@
|
|---|
| 1978 | };
|
|---|
| 1979 |
|
|---|
| 1980 |
|
|---|
| 1981 | -char *KismetHelpGps[] = {
|
|---|
| 1982 | - "KISMET NETWORK FOLLOW",
|
|---|
| 1983 | - "This panel estimates the center of a network, the current",
|
|---|
| 1984 | - "direction of travel, and the direction of the network center",
|
|---|
| 1985 | - "and distance relative to the current direction of movement.",
|
|---|
| 1986 | - " Key Action",
|
|---|
| 1987 | - " s Follow location of strongest packet",
|
|---|
| 1988 | - " c Follow location of estimated network center",
|
|---|
| 1989 | - " q Close popup",
|
|---|
| 1990 | - NULL
|
|---|
| 1991 | -};
|
|---|
| 1992 | -
|
|---|
| 1993 | -
|
|---|
| 1994 | char *KismetHelpStats[] = {
|
|---|
| 1995 | "KISMET NETWORK STATISTICS",
|
|---|
| 1996 | "This panel displays overall statistics about the wireless",
|
|---|
| 1997 | @@ -678,7 +663,6 @@
|
|---|
| 1998 | }
|
|---|
| 1999 |
|
|---|
| 2000 | // Enable all the protocols we handle
|
|---|
| 2001 | - in_client->EnableProtocol("GPS");
|
|---|
| 2002 | in_client->EnableProtocol("INFO");
|
|---|
| 2003 | in_client->EnableProtocol("REMOVE");
|
|---|
| 2004 | in_client->EnableProtocol("NETWORK");
|
|---|
| 2005 | @@ -1282,27 +1266,6 @@
|
|---|
| 2006 | if (con->client == NULL)
|
|---|
| 2007 | continue;
|
|---|
| 2008 |
|
|---|
| 2009 | - // Update GPS
|
|---|
| 2010 | - float newlat, newlon, newalt, newspd, newheading;
|
|---|
| 2011 | - int newfix;
|
|---|
| 2012 | - con->client->FetchLoc(&newlat, &newlon, &newalt, &newspd, &newheading, &newfix);
|
|---|
| 2013 | -
|
|---|
| 2014 | - if (GPSD::EarthDistance(newlat, newlon, last_lat, last_lon) > 10) {
|
|---|
| 2015 | - con->last_lat = con->lat;
|
|---|
| 2016 | - con->last_lon = con->lon;
|
|---|
| 2017 | - con->last_spd = con->spd;
|
|---|
| 2018 | - con->last_alt = con->alt;
|
|---|
| 2019 | - con->last_fix = con->fix;
|
|---|
| 2020 | - con->last_heading = con->heading;
|
|---|
| 2021 | - }
|
|---|
| 2022 | -
|
|---|
| 2023 | - con->lat = newlat;
|
|---|
| 2024 | - con->lon = newlon;
|
|---|
| 2025 | - con->alt = newalt;
|
|---|
| 2026 | - con->spd = newspd;
|
|---|
| 2027 | - con->heading = newheading;
|
|---|
| 2028 | - con->fix = newfix;
|
|---|
| 2029 | -
|
|---|
| 2030 | // Update quality
|
|---|
| 2031 | con->quality = con->client->FetchQuality();
|
|---|
| 2032 | con->power = con->client->FetchPower();
|
|---|
| 2033 | diff -urN kismet.dev/panelfront_display.cc kismet.dev2/panelfront_display.cc
|
|---|
| 2034 | --- kismet.dev/panelfront_display.cc 2005-08-15 17:52:16.000000000 +0200
|
|---|
| 2035 | +++ kismet.dev2/panelfront_display.cc 2006-04-14 19:31:55.000000000 +0200
|
|---|
| 2036 | @@ -727,7 +727,7 @@
|
|---|
| 2037 | mvwaddstr(netwin, netwin->_maxy, netwin->_maxx - 14, ptxt);
|
|---|
| 2038 | }
|
|---|
| 2039 |
|
|---|
| 2040 | -#ifdef HAVE_GPS
|
|---|
| 2041 | +#if 0
|
|---|
| 2042 |
|
|---|
| 2043 |
|
|---|
| 2044 | if (!(lat == 0 && lon == 0 && alt == 0 && spd == 0 && fix == 0)) {
|
|---|
| 2045 | @@ -1496,51 +1496,6 @@
|
|---|
| 2046 | snprintf(output, print_width, "Networks: %d", (int) details_network->networks.size());
|
|---|
| 2047 | kwin->text.push_back(output);
|
|---|
| 2048 |
|
|---|
| 2049 | - if (details_network->virtnet->gps_fixed != -1) {
|
|---|
| 2050 | - if ((details_network->virtnet->min_lat == 90) && (details_network->virtnet->min_lon == 180) &&
|
|---|
| 2051 | - (details_network->virtnet->max_lat == -90) && (details_network->virtnet->max_lon == -180)) {
|
|---|
| 2052 | - snprintf(output, print_width, "Min Loc : N/A");
|
|---|
| 2053 | - kwin->text.push_back(output);
|
|---|
| 2054 | - snprintf(output, print_width, "Max Loc : N/A");
|
|---|
| 2055 | - kwin->text.push_back(output);
|
|---|
| 2056 | - snprintf(output, print_width, "Range : N/A");
|
|---|
| 2057 | - kwin->text.push_back(output);
|
|---|
| 2058 | - }
|
|---|
| 2059 | - else {
|
|---|
| 2060 | - snprintf(output, print_width, "Min Loc : Lat %f Lon %f Alt %f Spd %f",
|
|---|
| 2061 | - details_network->virtnet->min_lat, details_network->virtnet->min_lon,
|
|---|
| 2062 | - metric ? details_network->virtnet->min_alt / 3.3 : details_network->virtnet->min_alt,
|
|---|
| 2063 | - metric ? details_network->virtnet->min_spd * 1.6093 : details_network->virtnet->min_spd);
|
|---|
| 2064 | - kwin->text.push_back(output);
|
|---|
| 2065 | - snprintf(output, print_width, "Max Loc : Lat %f Lon %f Alt %f Spd %f",
|
|---|
| 2066 | - details_network->virtnet->max_lat, details_network->virtnet->max_lon,
|
|---|
| 2067 | - metric ? details_network->virtnet->max_alt / 3.3 : details_network->virtnet->max_alt,
|
|---|
| 2068 | - metric ? details_network->virtnet->max_spd * 1.6093 : details_network->virtnet->max_spd);
|
|---|
| 2069 | - kwin->text.push_back(output);
|
|---|
| 2070 | -
|
|---|
| 2071 | - double diagdist = GPSD::EarthDistance(details_network->virtnet->min_lat,
|
|---|
| 2072 | - details_network->virtnet->min_lon,
|
|---|
| 2073 | - details_network->virtnet->max_lat,
|
|---|
| 2074 | - details_network->virtnet->max_lon);
|
|---|
| 2075 | -
|
|---|
| 2076 | - if (finite(diagdist)) {
|
|---|
| 2077 | - if (metric) {
|
|---|
| 2078 | - if (diagdist < 1000)
|
|---|
| 2079 | - snprintf(output, print_width, "Range : %.3f meters", diagdist);
|
|---|
| 2080 | - else
|
|---|
| 2081 | - snprintf(output, print_width, "Range : %.3f kilometers", diagdist / 1000);
|
|---|
| 2082 | - } else {
|
|---|
| 2083 | - diagdist *= 3.3;
|
|---|
| 2084 | - if (diagdist < 5280)
|
|---|
| 2085 | - snprintf(output, print_width, "Range : %.3f feet", diagdist);
|
|---|
| 2086 | - else
|
|---|
| 2087 | - snprintf(output, print_width, "Range : %.3f miles", diagdist / 5280);
|
|---|
| 2088 | - }
|
|---|
| 2089 | - kwin->text.push_back(output);
|
|---|
| 2090 | - }
|
|---|
| 2091 | - }
|
|---|
| 2092 | - }
|
|---|
| 2093 | -
|
|---|
| 2094 | if (details_network->virtnet->carrier_set & (1 << (int) carrier_80211b)) {
|
|---|
| 2095 | snprintf(output, print_width, "Carrier : IEEE 802.11b");
|
|---|
| 2096 | kwin->text.push_back(output);
|
|---|
| 2097 | @@ -1853,49 +1808,6 @@
|
|---|
| 2098 | dnet->ipdata.range_ip[2], dnet->ipdata.range_ip[3]);
|
|---|
| 2099 | kwin->text.push_back(output);
|
|---|
| 2100 | }
|
|---|
| 2101 | -
|
|---|
| 2102 | - if (dnet->gps_fixed != -1) {
|
|---|
| 2103 | - if ((dnet->min_lat == 90) && (dnet->min_lon == 180) &&
|
|---|
| 2104 | - (dnet->max_lat == -90) && (dnet->max_lon == -180)) {
|
|---|
| 2105 | - snprintf(output, print_width, "Min Loc : N/A");
|
|---|
| 2106 | - kwin->text.push_back(output);
|
|---|
| 2107 | - snprintf(output, print_width, "Max Loc : N/A");
|
|---|
| 2108 | - kwin->text.push_back(output);
|
|---|
| 2109 | - snprintf(output, print_width, "Range : N/A");
|
|---|
| 2110 | - kwin->text.push_back(output);
|
|---|
| 2111 | - }
|
|---|
| 2112 | - else {
|
|---|
| 2113 | - snprintf(output, print_width, "Min Loc : Lat %f Lon %f Alt %f Spd %f",
|
|---|
| 2114 | - dnet->min_lat, dnet->min_lon,
|
|---|
| 2115 | - metric ? dnet->min_alt / 3.3 : dnet->min_alt,
|
|---|
| 2116 | - metric ? dnet->min_spd * 1.6093 : dnet->min_spd);
|
|---|
| 2117 | - kwin->text.push_back(output);
|
|---|
| 2118 | - snprintf(output, print_width, "Max Loc : Lat %f Lon %f Alt %f Spd %f",
|
|---|
| 2119 | - dnet->max_lat, dnet->max_lon,
|
|---|
| 2120 | - metric ? dnet->max_alt / 3.3 : dnet->max_alt,
|
|---|
| 2121 | - metric ? dnet->max_spd * 1.6093 : dnet->max_spd);
|
|---|
| 2122 | - kwin->text.push_back(output);
|
|---|
| 2123 | -
|
|---|
| 2124 | - double diagdist = GPSD::EarthDistance(dnet->min_lat, dnet->min_lon,
|
|---|
| 2125 | - dnet->max_lat, dnet->max_lon);
|
|---|
| 2126 | -
|
|---|
| 2127 | - if (finite(diagdist)) {
|
|---|
| 2128 | - if (metric) {
|
|---|
| 2129 | - if (diagdist < 1000)
|
|---|
| 2130 | - snprintf(output, print_width, "Range : %f meters", diagdist);
|
|---|
| 2131 | - else
|
|---|
| 2132 | - snprintf(output, print_width, "Range : %f kilometers", diagdist / 1000);
|
|---|
| 2133 | - } else {
|
|---|
| 2134 | - diagdist *= 3.3;
|
|---|
| 2135 | - if (diagdist < 5280)
|
|---|
| 2136 | - snprintf(output, print_width, "Range : %f feet", diagdist);
|
|---|
| 2137 | - else
|
|---|
| 2138 | - snprintf(output, print_width, "Range : %f miles", diagdist / 5280);
|
|---|
| 2139 | - }
|
|---|
| 2140 | - kwin->text.push_back(output);
|
|---|
| 2141 | - }
|
|---|
| 2142 | - }
|
|---|
| 2143 | - }
|
|---|
| 2144 | }
|
|---|
| 2145 |
|
|---|
| 2146 | // Now we just use the text printer to handle the rest for us
|
|---|
| 2147 | @@ -1903,184 +1815,6 @@
|
|---|
| 2148 | return TextPrinter(in_window);
|
|---|
| 2149 | }
|
|---|
| 2150 |
|
|---|
| 2151 | -int PanelFront::GpsPrinter(void *in_window) {
|
|---|
| 2152 | - kis_window *kwin = (kis_window *) in_window;
|
|---|
| 2153 | -
|
|---|
| 2154 | - char output[1024];
|
|---|
| 2155 | - kwin->text.clear();
|
|---|
| 2156 | -
|
|---|
| 2157 | - if (details_network == NULL) {
|
|---|
| 2158 | - kwin->text.push_back("The network or group being displayed");
|
|---|
| 2159 | - kwin->text.push_back("has been deleted. Please select a ");
|
|---|
| 2160 | - kwin->text.push_back("different network.");
|
|---|
| 2161 | - return TextPrinter(in_window);
|
|---|
| 2162 | - }
|
|---|
| 2163 | -
|
|---|
| 2164 | - wireless_network *dnet = details_network->virtnet;
|
|---|
| 2165 | -
|
|---|
| 2166 | - int print_width = kwin->print_width;
|
|---|
| 2167 | - if (print_width > 1024)
|
|---|
| 2168 | - print_width = 1023;
|
|---|
| 2169 | -
|
|---|
| 2170 | - if (print_width < 32) {
|
|---|
| 2171 | - kwin->text.push_back("Display not wide enough");
|
|---|
| 2172 | - return TextPrinter(in_window);
|
|---|
| 2173 | - }
|
|---|
| 2174 | -
|
|---|
| 2175 | - if (dnet->aggregate_points == 0) {
|
|---|
| 2176 | - kwin->text.push_back("No GPS data.");
|
|---|
| 2177 | - return TextPrinter(in_window);
|
|---|
| 2178 | - }
|
|---|
| 2179 | -
|
|---|
| 2180 | - float center_lat, center_lon;
|
|---|
| 2181 | -
|
|---|
| 2182 | - // We hijack the "selected" field as a toggle
|
|---|
| 2183 | - if (kwin->selected == 1) {
|
|---|
| 2184 | - center_lat = dnet->best_lat;
|
|---|
| 2185 | - center_lon = dnet->best_lon;
|
|---|
| 2186 | - } else {
|
|---|
| 2187 | - center_lat = dnet->aggregate_lat / dnet->aggregate_points;
|
|---|
| 2188 | - center_lon = dnet->aggregate_lon / dnet->aggregate_points;
|
|---|
| 2189 | - }
|
|---|
| 2190 | -
|
|---|
| 2191 | - // Get bearing to the center
|
|---|
| 2192 | - float center_angle = GPSD::CalcHeading(center_lat, center_lon, lat, lon);
|
|---|
| 2193 | -
|
|---|
| 2194 | - float difference_angle = heading - center_angle;
|
|---|
| 2195 | - if (difference_angle < 0)
|
|---|
| 2196 | - difference_angle += 360;
|
|---|
| 2197 | -
|
|---|
| 2198 | - double diagdist = GPSD::EarthDistance(lat, lon, center_lat, center_lon);
|
|---|
| 2199 | -
|
|---|
| 2200 | - // Now we know everything - where we are, where we are headed, where we SHOULD be headed
|
|---|
| 2201 | - // to get to the supposed center of the network, how far it is, and the orientation on our
|
|---|
| 2202 | - // compass to get to it. Time to start drawing our output.
|
|---|
| 2203 | -
|
|---|
| 2204 | - char compass[5][10];
|
|---|
| 2205 | - memset(compass, 0, sizeof(char) * 5 * 10);
|
|---|
| 2206 | -
|
|---|
| 2207 | - // | 41.12345x-74.12345 .-|-/ |
|
|---|
| 2208 | - // | Bearing: / |/ \ |
|
|---|
| 2209 | - // | 123.23 degrees | O | |
|
|---|
| 2210 | - // | \ \ / |
|
|---|
| 2211 | - // | Estimated center: '---\ |
|
|---|
| 2212 | -
|
|---|
| 2213 | -
|
|---|
| 2214 | - // Find the orientation on our compass:
|
|---|
| 2215 | - if (difference_angle > 330 || difference_angle <= 22) {
|
|---|
| 2216 | - snprintf(compass[0], 10, " .-|-. ");
|
|---|
| 2217 | - snprintf(compass[1], 10, " / | \\ ");
|
|---|
| 2218 | - snprintf(compass[2], 10, "| O |");
|
|---|
| 2219 | - snprintf(compass[3], 10, " \\ / ");
|
|---|
| 2220 | - snprintf(compass[4], 10, " '---' ");
|
|---|
| 2221 | - } else if (difference_angle > 22 && difference_angle <= 66) {
|
|---|
| 2222 | - snprintf(compass[0], 10, " .---/ ");
|
|---|
| 2223 | - snprintf(compass[1], 10, " / / \\ ");
|
|---|
| 2224 | - snprintf(compass[2], 10, "| O |");
|
|---|
| 2225 | - snprintf(compass[3], 10, " \\ / ");
|
|---|
| 2226 | - snprintf(compass[4], 10, " '---' ");
|
|---|
| 2227 | - } else if (difference_angle > 66 && difference_angle <= 110) {
|
|---|
| 2228 | - snprintf(compass[0], 10, " .---. ");
|
|---|
| 2229 | - snprintf(compass[1], 10, " / \\ ");
|
|---|
| 2230 | - snprintf(compass[2], 10, "| O----");
|
|---|
| 2231 | - snprintf(compass[3], 10, " \\ / ");
|
|---|
| 2232 | - snprintf(compass[4], 10, " '---' ");
|
|---|
| 2233 | - } else if (difference_angle > 110 && difference_angle <= 154) {
|
|---|
| 2234 | - snprintf(compass[0], 10, " .---. ");
|
|---|
| 2235 | - snprintf(compass[1], 10, " / \\ ");
|
|---|
| 2236 | - snprintf(compass[2], 10, "| O |");
|
|---|
| 2237 | - snprintf(compass[3], 10, " \\ \\ / ");
|
|---|
| 2238 | - snprintf(compass[4], 10, " '---\\ ");
|
|---|
| 2239 | - } else if (difference_angle > 154 && difference_angle <= 198) {
|
|---|
| 2240 | - snprintf(compass[0], 10, " .---. ");
|
|---|
| 2241 | - snprintf(compass[1], 10, " / \\ ");
|
|---|
| 2242 | - snprintf(compass[2], 10, "| O |");
|
|---|
| 2243 | - snprintf(compass[3], 10, " \\ | / ");
|
|---|
| 2244 | - snprintf(compass[4], 10, " '-|-' ");
|
|---|
| 2245 | - } else if (difference_angle > 198 && difference_angle <= 242) {
|
|---|
| 2246 | - snprintf(compass[0], 10, " .---. ");
|
|---|
| 2247 | - snprintf(compass[1], 10, " / \\ ");
|
|---|
| 2248 | - snprintf(compass[2], 10, "| O |");
|
|---|
| 2249 | - snprintf(compass[3], 10, " \\ / / ");
|
|---|
| 2250 | - snprintf(compass[4], 10, " /---' ");
|
|---|
| 2251 | - } else if (difference_angle > 242 && difference_angle <= 286) {
|
|---|
| 2252 | - snprintf(compass[0], 10, " .---. ");
|
|---|
| 2253 | - snprintf(compass[1], 10, " / \\ ");
|
|---|
| 2254 | - snprintf(compass[2], 10, "----O |");
|
|---|
| 2255 | - snprintf(compass[3], 10, " \\ / ");
|
|---|
| 2256 | - snprintf(compass[4], 10, " '---' ");
|
|---|
| 2257 | - } else if (difference_angle > 286 && difference_angle <= 330) {
|
|---|
| 2258 | - snprintf(compass[0], 10, " \\---. ");
|
|---|
| 2259 | - snprintf(compass[1], 10, " / \\ \\ ");
|
|---|
| 2260 | - snprintf(compass[2], 10, "| O |");
|
|---|
| 2261 | - snprintf(compass[3], 10, " \\ / ");
|
|---|
| 2262 | - snprintf(compass[4], 10, " '---' ");
|
|---|
| 2263 | - } else {
|
|---|
| 2264 | - snprintf(compass[0], 10, "%f\n", difference_angle);
|
|---|
| 2265 | - }
|
|---|
| 2266 | -
|
|---|
| 2267 | -
|
|---|
| 2268 | - // - Network GPS ---------------------|
|
|---|
| 2269 | - // | Current: |
|
|---|
| 2270 | - // | 41.12345x-74.12345 .-|-. |
|
|---|
| 2271 | - // | Bearing: / | \ |
|
|---|
| 2272 | - // | 123.23 degrees | O | |
|
|---|
| 2273 | - // | \ \ / |
|
|---|
| 2274 | - // | Estimated center: '---\ |
|
|---|
| 2275 | - // | -73.12345x43.12345 |
|
|---|
| 2276 | - // | 120 feet |
|
|---|
| 2277 | - // ------------------------------------
|
|---|
| 2278 | - char textfrag[23];
|
|---|
| 2279 | -
|
|---|
| 2280 | - snprintf(output, print_width, "Current:");
|
|---|
| 2281 | - kwin->text.push_back(output);
|
|---|
| 2282 | -
|
|---|
| 2283 | - snprintf(textfrag, 23, "%.3f x %.3f", lat, lon);
|
|---|
| 2284 | - snprintf(output, print_width, "%-22s%s", textfrag, compass[0]);
|
|---|
| 2285 | - kwin->text.push_back(output);
|
|---|
| 2286 | -
|
|---|
| 2287 | - snprintf(textfrag, 23, " Bearing:");
|
|---|
| 2288 | - snprintf(output, print_width, "%-22s%s", textfrag, compass[1]);
|
|---|
| 2289 | - kwin->text.push_back(output);
|
|---|
| 2290 | -
|
|---|
| 2291 | - snprintf(textfrag, 23, " %.2f*", heading);
|
|---|
| 2292 | - snprintf(output, print_width, "%-22s%s", textfrag, compass[2]);
|
|---|
| 2293 | - kwin->text.push_back(output);
|
|---|
| 2294 | -
|
|---|
| 2295 | - snprintf(textfrag, 23, " ");
|
|---|
| 2296 | - snprintf(output, print_width, "%-22s%s", textfrag, compass[3]);
|
|---|
| 2297 | - kwin->text.push_back(output);
|
|---|
| 2298 | -
|
|---|
| 2299 | - if (kwin->selected == 1)
|
|---|
| 2300 | - snprintf(textfrag, 23, "Strongest signal:");
|
|---|
| 2301 | - else
|
|---|
| 2302 | - snprintf(textfrag, 23, "Estimated Center:");
|
|---|
| 2303 | - snprintf(output, print_width, "%-22s%s", textfrag, compass[4]);
|
|---|
| 2304 | - kwin->text.push_back(output);
|
|---|
| 2305 | -
|
|---|
| 2306 | - snprintf(textfrag, 23, "%.3f x %.3f", center_lat, center_lon);
|
|---|
| 2307 | - snprintf(output, print_width, "%-22s%.2f*", textfrag, difference_angle);
|
|---|
| 2308 | - kwin->text.push_back(output);
|
|---|
| 2309 | -
|
|---|
| 2310 | - if (metric) {
|
|---|
| 2311 | - if (diagdist < 1000)
|
|---|
| 2312 | - snprintf(textfrag, 23, "%.2f m", diagdist);
|
|---|
| 2313 | - else
|
|---|
| 2314 | - snprintf(textfrag, 23, "%.2f km", diagdist / 1000);
|
|---|
| 2315 | - } else {
|
|---|
| 2316 | - diagdist *= 3.3;
|
|---|
| 2317 | - if (diagdist < 5280)
|
|---|
| 2318 | - snprintf(textfrag, 23, "%.2f ft", diagdist);
|
|---|
| 2319 | - else
|
|---|
| 2320 | - snprintf(textfrag, 23, "%.2f mi", diagdist / 5280);
|
|---|
| 2321 | - }
|
|---|
| 2322 | -
|
|---|
| 2323 | - snprintf(output, print_width, "%-22s%s", "", textfrag);
|
|---|
| 2324 | - kwin->text.push_back(output);
|
|---|
| 2325 | -
|
|---|
| 2326 | - return TextPrinter(in_window);
|
|---|
| 2327 | -}
|
|---|
| 2328 | -
|
|---|
| 2329 | int PanelFront::PackPrinter(void *in_window) {
|
|---|
| 2330 | kis_window *kwin = (kis_window *) in_window;
|
|---|
| 2331 |
|
|---|
| 2332 | @@ -3049,53 +2783,6 @@
|
|---|
| 2333 | details_client->ipdata.ip[2], details_client->ipdata.ip[3]);
|
|---|
| 2334 | kwin->text.push_back(output);
|
|---|
| 2335 |
|
|---|
| 2336 | - if (details_client->gps_fixed != -1) {
|
|---|
| 2337 | - kwin->text.push_back("");
|
|---|
| 2338 | -
|
|---|
| 2339 | - if ((details_client->min_lat == 90) && (details_client->min_lon == 180) &&
|
|---|
| 2340 | - (details_client->max_lat == -90) && (details_client->max_lon == -180)) {
|
|---|
| 2341 | - snprintf(output, print_width, "Min Loc : N/A");
|
|---|
| 2342 | - kwin->text.push_back(output);
|
|---|
| 2343 | - snprintf(output, print_width, "Max Loc : N/A");
|
|---|
| 2344 | - kwin->text.push_back(output);
|
|---|
| 2345 | - snprintf(output, print_width, "Range : N/A");
|
|---|
| 2346 | - kwin->text.push_back(output);
|
|---|
| 2347 | - }
|
|---|
| 2348 | - else {
|
|---|
| 2349 | - snprintf(output, print_width, "Min Loc : Lat %f Lon %f Alt %f Spd %f",
|
|---|
| 2350 | - details_client->min_lat, details_client->min_lon,
|
|---|
| 2351 | - metric ? details_client->min_alt / 3.3 : details_client->min_alt,
|
|---|
| 2352 | - metric ? details_client->min_spd * 1.6093 : details_client->min_spd);
|
|---|
| 2353 | - kwin->text.push_back(output);
|
|---|
| 2354 | - snprintf(output, print_width, "Max Loc : Lat %f Lon %f Alt %f Spd %f",
|
|---|
| 2355 | - details_client->max_lat, details_client->max_lon,
|
|---|
| 2356 | - metric ? details_client->max_alt / 3.3 : details_client->max_alt,
|
|---|
| 2357 | - metric ? details_client->max_spd * 1.6093 : details_client->max_spd);
|
|---|
| 2358 | - kwin->text.push_back(output);
|
|---|
| 2359 | -
|
|---|
| 2360 | - double diagdist = GPSD::EarthDistance(details_client->min_lat,
|
|---|
| 2361 | - details_client->min_lon,
|
|---|
| 2362 | - details_client->max_lat,
|
|---|
| 2363 | - details_client->max_lon);
|
|---|
| 2364 | -
|
|---|
| 2365 | - if (finite(diagdist)) {
|
|---|
| 2366 | - if (metric) {
|
|---|
| 2367 | - if (diagdist < 1000)
|
|---|
| 2368 | - snprintf(output, print_width, "Range : %f meters", diagdist);
|
|---|
| 2369 | - else
|
|---|
| 2370 | - snprintf(output, print_width, "Range : %f kilometers", diagdist / 1000);
|
|---|
| 2371 | - } else {
|
|---|
| 2372 | - diagdist *= 3.3;
|
|---|
| 2373 | - if (diagdist < 5280)
|
|---|
| 2374 | - snprintf(output, print_width, "Range : %f feet", diagdist);
|
|---|
| 2375 | - else
|
|---|
| 2376 | - snprintf(output, print_width, "Range : %f miles", diagdist / 5280);
|
|---|
| 2377 | - }
|
|---|
| 2378 | - kwin->text.push_back(output);
|
|---|
| 2379 | - }
|
|---|
| 2380 | - }
|
|---|
| 2381 | - kwin->text.push_back("");
|
|---|
| 2382 | - }
|
|---|
| 2383 |
|
|---|
| 2384 | snprintf(output, print_width, "Packets :");
|
|---|
| 2385 | kwin->text.push_back(output);
|
|---|
| 2386 | diff -urN kismet.dev/panelfront.h kismet.dev2/panelfront.h
|
|---|
| 2387 | --- kismet.dev/panelfront.h 2005-06-29 14:50:09.000000000 +0200
|
|---|
| 2388 | +++ kismet.dev2/panelfront.h 2006-04-14 19:31:55.000000000 +0200
|
|---|
| 2389 | @@ -65,7 +65,6 @@
|
|---|
| 2390 | #define SORT_SIZE 10
|
|---|
| 2391 | extern char *KismetHelpPower[];
|
|---|
| 2392 | extern char *KismetHelpRate[];
|
|---|
| 2393 | -extern char *KismetHelpGps[];
|
|---|
| 2394 | extern char *KismetHelpStats[];
|
|---|
| 2395 | extern char *KismetHelpDump[];
|
|---|
| 2396 | extern char *KismetHelpPack[];
|
|---|
| 2397 | @@ -269,7 +268,6 @@
|
|---|
| 2398 | int RatePrinter(void *in_window);
|
|---|
| 2399 | int StatsPrinter(void *in_window);
|
|---|
| 2400 | int PackPrinter(void *in_window);
|
|---|
| 2401 | - int GpsPrinter(void *in_window);
|
|---|
| 2402 | int AlertPrinter(void *in_window);
|
|---|
| 2403 |
|
|---|
| 2404 | int MainClientPrinter(void *in_window);
|
|---|
| 2405 | @@ -298,7 +296,6 @@
|
|---|
| 2406 | int PackInput(void *in_window, int in_chr);
|
|---|
| 2407 | // Help has a generic handler
|
|---|
| 2408 | int TextInput(void *in_window, int in_chr);
|
|---|
| 2409 | - int GpsInput(void *in_window, int in_chr);
|
|---|
| 2410 | int AlertInput(void *in_window, int in_chr);
|
|---|
| 2411 |
|
|---|
| 2412 | int MainClientInput(void *in_window, int in_chr);
|
|---|
| 2413 | diff -urN kismet.dev/panelfront_input.cc kismet.dev2/panelfront_input.cc
|
|---|
| 2414 | --- kismet.dev/panelfront_input.cc 2005-06-29 14:50:09.000000000 +0200
|
|---|
| 2415 | +++ kismet.dev2/panelfront_input.cc 2006-04-14 19:31:56.000000000 +0200
|
|---|
| 2416 | @@ -300,16 +300,9 @@
|
|---|
| 2417 | break;
|
|---|
| 2418 | case 'f':
|
|---|
| 2419 | case 'F':
|
|---|
| 2420 | - if (sortby != sort_auto && last_displayed.size() > 0) {
|
|---|
| 2421 | - details_network = last_displayed[kwin->selected];
|
|---|
| 2422 | - SpawnWindow("Network Location", &PanelFront::GpsPrinter, &PanelFront::GpsInput, 8, 34);
|
|---|
| 2423 | - } else {
|
|---|
| 2424 | - WriteStatus("Cannot view network GPS info in autofit sort mode. Sort by a different method.");
|
|---|
| 2425 | - }
|
|---|
| 2426 | break;
|
|---|
| 2427 | case 'm':
|
|---|
| 2428 | case 'M':
|
|---|
| 2429 | - MuteToggle();
|
|---|
| 2430 | break;
|
|---|
| 2431 | case 'e':
|
|---|
| 2432 | case 'E':
|
|---|
| 2433 | @@ -447,7 +440,6 @@
|
|---|
| 2434 | switch(in_chr) {
|
|---|
| 2435 | case 'm':
|
|---|
| 2436 | case 'M':
|
|---|
| 2437 | - MuteToggle();
|
|---|
| 2438 | break;
|
|---|
| 2439 | case 'p':
|
|---|
| 2440 | case 'P':
|
|---|
| 2441 | @@ -546,33 +538,6 @@
|
|---|
| 2442 | return 1;
|
|---|
| 2443 | }
|
|---|
| 2444 |
|
|---|
| 2445 | -int PanelFront::GpsInput(void *in_window, int in_chr) {
|
|---|
| 2446 | - kis_window *kwin = (kis_window *) in_window;
|
|---|
| 2447 | -
|
|---|
| 2448 | - switch (in_chr) {
|
|---|
| 2449 | - case 's':
|
|---|
| 2450 | - case 'S':
|
|---|
| 2451 | - kwin->selected = 1;
|
|---|
| 2452 | - break;
|
|---|
| 2453 | - case 'c':
|
|---|
| 2454 | - case 'C':
|
|---|
| 2455 | - kwin->selected = 0;
|
|---|
| 2456 | - break;
|
|---|
| 2457 | - case 'h':
|
|---|
| 2458 | - case 'H':
|
|---|
| 2459 | - SpawnHelp(KismetHelpGps);
|
|---|
| 2460 | - break;
|
|---|
| 2461 | - case 'x':
|
|---|
| 2462 | - case 'X':
|
|---|
| 2463 | - case 'q':
|
|---|
| 2464 | - case 'Q':
|
|---|
| 2465 | - return 0;
|
|---|
| 2466 | - break;
|
|---|
| 2467 | - }
|
|---|
| 2468 | -
|
|---|
| 2469 | - return 1;
|
|---|
| 2470 | -}
|
|---|
| 2471 | -
|
|---|
| 2472 | int PanelFront::RateInput(void *in_window, int in_chr) {
|
|---|
| 2473 | switch (in_chr) {
|
|---|
| 2474 | case 'h':
|
|---|
| 2475 | @@ -645,24 +610,6 @@
|
|---|
| 2476 | return 1;
|
|---|
| 2477 | }
|
|---|
| 2478 |
|
|---|
| 2479 | -void PanelFront::MuteToggle() {
|
|---|
| 2480 | - if (muted) {
|
|---|
| 2481 | - speech = old_speech;
|
|---|
| 2482 | - sound = old_sound;
|
|---|
| 2483 | - muted = 0;
|
|---|
| 2484 | - WriteStatus("Restoring sound");
|
|---|
| 2485 | - } else if (sound != 0 || speech != 0) {
|
|---|
| 2486 | - old_speech = speech;
|
|---|
| 2487 | - old_sound = sound;
|
|---|
| 2488 | - sound = 0;
|
|---|
| 2489 | - speech = 0;
|
|---|
| 2490 | - muted = 1;
|
|---|
| 2491 | - WriteStatus("Muting sound");
|
|---|
| 2492 | - } else if (sound == 0 && speech == 0) {
|
|---|
| 2493 | - WriteStatus("Sound not enabled.");
|
|---|
| 2494 | - }
|
|---|
| 2495 | -}
|
|---|
| 2496 | -
|
|---|
| 2497 | int PanelFront::AlertInput(void *in_window, int in_chr) {
|
|---|
| 2498 | kis_window *kwin = (kis_window *) in_window;
|
|---|
| 2499 |
|
|---|
| 2500 | diff -urN kismet.dev/pcapsource.cc kismet.dev2/pcapsource.cc
|
|---|
| 2501 | --- kismet.dev/pcapsource.cc 2006-04-14 23:43:01.697817483 +0200
|
|---|
| 2502 | +++ kismet.dev2/pcapsource.cc 2006-04-14 20:25:06.000000000 +0200
|
|---|
| 2503 | @@ -343,11 +343,6 @@
|
|---|
| 2504 | packet->moddata = moddata;
|
|---|
| 2505 | packet->modified = 0;
|
|---|
| 2506 |
|
|---|
| 2507 | - if (gpsd != NULL) {
|
|---|
| 2508 | - gpsd->FetchLoc(&packet->gps_lat, &packet->gps_lon, &packet->gps_alt,
|
|---|
| 2509 | - &packet->gps_spd, &packet->gps_heading, &packet->gps_fix);
|
|---|
| 2510 | - }
|
|---|
| 2511 | -
|
|---|
| 2512 | if (datalink_type == DLT_PRISM_HEADER) {
|
|---|
| 2513 | ret = Prism2KisPack(packet, data, moddata);
|
|---|
| 2514 | } else if (datalink_type == KDLT_BSD802_11) {
|
|---|
| 2515 | @@ -1157,133 +1152,6 @@
|
|---|
| 2516 |
|
|---|
| 2517 | // Monitor commands
|
|---|
| 2518 | #ifdef HAVE_LINUX_WIRELESS
|
|---|
| 2519 | -// Cisco uses its own config file in /proc to control modes
|
|---|
| 2520 | -int monitor_cisco(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
|
|---|
| 2521 | - FILE *cisco_config;
|
|---|
| 2522 | - char cisco_path[128];
|
|---|
| 2523 | -
|
|---|
| 2524 | - linux_ifparm *ifparm = (linux_ifparm *) malloc(sizeof(linux_ifparm));
|
|---|
| 2525 | - (*in_if) = ifparm;
|
|---|
| 2526 | -
|
|---|
| 2527 | - if (Ifconfig_Get_Flags(in_dev, in_err, &ifparm->flags) < 0) {
|
|---|
| 2528 | - return -1;
|
|---|
| 2529 | - }
|
|---|
| 2530 | -
|
|---|
| 2531 | - if (Iwconfig_Get_SSID(in_dev, in_err, ifparm->essid) < 0)
|
|---|
| 2532 | - return -1;
|
|---|
| 2533 | -
|
|---|
| 2534 | - if ((ifparm->channel = Iwconfig_Get_Channel(in_dev, in_err)) < 0)
|
|---|
| 2535 | - return -1;
|
|---|
| 2536 | -
|
|---|
| 2537 | - if (Iwconfig_Get_Mode(in_dev, in_err, &ifparm->mode) < 0)
|
|---|
| 2538 | - return -1;
|
|---|
| 2539 | -
|
|---|
| 2540 | - if (Ifconfig_Delta_Flags(in_dev, in_err, IFF_UP | IFF_RUNNING | IFF_PROMISC) < 0)
|
|---|
| 2541 | - return -1;
|
|---|
| 2542 | -
|
|---|
| 2543 | - // Try the iwpriv
|
|---|
| 2544 | - if (Iwconfig_Set_IntPriv(in_dev, "setRFMonitor", 1, 0, in_err) >= 0) {
|
|---|
| 2545 | - return 0;
|
|---|
| 2546 | - }
|
|---|
| 2547 | -
|
|---|
| 2548 | - // Zero the ssid - nonfatal
|
|---|
| 2549 | - Iwconfig_Set_SSID(in_dev, in_err, NULL);
|
|---|
| 2550 | -
|
|---|
| 2551 | - // Build the proc control path
|
|---|
| 2552 | - snprintf(cisco_path, 128, "/proc/driver/aironet/%s/Config", in_dev);
|
|---|
| 2553 | -
|
|---|
| 2554 | - if ((cisco_config = fopen(cisco_path, "w")) == NULL) {
|
|---|
| 2555 | - snprintf(in_err, STATUS_MAX, "Unable to open cisco control file '%s' %d:%s",
|
|---|
| 2556 | - cisco_path, errno, strerror(errno));
|
|---|
| 2557 | - return -1;
|
|---|
| 2558 | - }
|
|---|
| 2559 | -
|
|---|
| 2560 | - fprintf(cisco_config, "Mode: r\n");
|
|---|
| 2561 | - fprintf(cisco_config, "Mode: y\n");
|
|---|
| 2562 | - fprintf(cisco_config, "XmitPower: 1\n");
|
|---|
| 2563 | -
|
|---|
| 2564 | - fclose(cisco_config);
|
|---|
| 2565 | -
|
|---|
| 2566 | - // Channel can't be set on cisco with these drivers.
|
|---|
| 2567 | -
|
|---|
| 2568 | - return 0;
|
|---|
| 2569 | -}
|
|---|
| 2570 | -
|
|---|
| 2571 | -int unmonitor_cisco(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
|
|---|
| 2572 | - linux_ifparm *ifparm = (linux_ifparm *) (*in_if);
|
|---|
| 2573 | - int ret = -1;
|
|---|
| 2574 | -
|
|---|
| 2575 | - // Try the iwpriv
|
|---|
| 2576 | - if (Iwconfig_Set_IntPriv(in_dev, "setRFMonitor", 0, 0, in_err) >= 0) {
|
|---|
| 2577 | - // If we're the new drivers, unmonitor
|
|---|
| 2578 | - if (Ifconfig_Set_Flags(in_dev, in_err, ifparm->flags) < 0) {
|
|---|
| 2579 | - return -1;
|
|---|
| 2580 | - }
|
|---|
| 2581 | -
|
|---|
| 2582 | - // Reset the SSID since monitor mode nukes it
|
|---|
| 2583 | - if (Iwconfig_Set_SSID(in_dev, in_err, ifparm->essid) < 0)
|
|---|
| 2584 | - return -1;
|
|---|
| 2585 | -
|
|---|
| 2586 | - if (ifparm->channel > 0) {
|
|---|
| 2587 | - if (Iwconfig_Set_Channel(in_dev, ifparm->channel, in_err) < 0)
|
|---|
| 2588 | - return -1;
|
|---|
| 2589 | - }
|
|---|
| 2590 | -
|
|---|
| 2591 | - ret = 1;
|
|---|
| 2592 | - }
|
|---|
| 2593 | -
|
|---|
| 2594 | - free(ifparm);
|
|---|
| 2595 | -
|
|---|
| 2596 | - return ret;
|
|---|
| 2597 | -}
|
|---|
| 2598 | -
|
|---|
| 2599 | -// Cisco uses its own config file in /proc to control modes
|
|---|
| 2600 | -//
|
|---|
| 2601 | -// I was doing this with ioctls but that seems to cause lockups while
|
|---|
| 2602 | -// this method doesn't. I don't think I like these drivers.
|
|---|
| 2603 | -int monitor_cisco_wifix(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
|
|---|
| 2604 | - FILE *cisco_config;
|
|---|
| 2605 | - char cisco_path[128];
|
|---|
| 2606 | - vector<string> devbits = StrTokenize(in_dev, ":");
|
|---|
| 2607 | -
|
|---|
| 2608 | - if (devbits.size() < 2) {
|
|---|
| 2609 | - snprintf(in_err, STATUS_MAX, "Invalid device pair '%s'. Proper device "
|
|---|
| 2610 | - "for cisco_wifix is eth?:wifi?.", in_dev);
|
|---|
| 2611 | - return -1;
|
|---|
| 2612 | - }
|
|---|
| 2613 | -
|
|---|
| 2614 | - // Bring the device up, zero its ip, and set promisc
|
|---|
| 2615 | - if (Ifconfig_Delta_Flags(devbits[0].c_str(), in_err,
|
|---|
| 2616 | - IFF_UP | IFF_RUNNING | IFF_PROMISC) < 0)
|
|---|
| 2617 | - return -1;
|
|---|
| 2618 | - if (Ifconfig_Delta_Flags(devbits[1].c_str(), in_err,
|
|---|
| 2619 | - IFF_UP | IFF_RUNNING | IFF_PROMISC) < 0)
|
|---|
| 2620 | - return -1;
|
|---|
| 2621 | -
|
|---|
| 2622 | - // Zero the ssid, nonfatally
|
|---|
| 2623 | - Iwconfig_Set_SSID(devbits[0].c_str(), in_err, NULL);
|
|---|
| 2624 | - Iwconfig_Set_SSID(devbits[1].c_str(), in_err, NULL);
|
|---|
| 2625 | -
|
|---|
| 2626 | - // Build the proc control path
|
|---|
| 2627 | - snprintf(cisco_path, 128, "/proc/driver/aironet/%s/Config", devbits[0].c_str());
|
|---|
| 2628 | -
|
|---|
| 2629 | - if ((cisco_config = fopen(cisco_path, "w")) == NULL) {
|
|---|
| 2630 | - snprintf(in_err, STATUS_MAX, "Unable to open cisco control file '%s' %d:%s",
|
|---|
| 2631 | - cisco_path, errno, strerror(errno));
|
|---|
| 2632 | - return -1;
|
|---|
| 2633 | - }
|
|---|
| 2634 | -
|
|---|
| 2635 | - fprintf(cisco_config, "Mode: r\n");
|
|---|
| 2636 | - fprintf(cisco_config, "Mode: y\n");
|
|---|
| 2637 | - fprintf(cisco_config, "XmitPower: 1\n");
|
|---|
| 2638 | -
|
|---|
| 2639 | - fclose(cisco_config);
|
|---|
| 2640 | -
|
|---|
| 2641 | - // Channel can't be set on cisco with these drivers.
|
|---|
| 2642 | -
|
|---|
| 2643 | - return 0;
|
|---|
| 2644 | -}
|
|---|
| 2645 | -
|
|---|
| 2646 | // Hostap uses iwpriv and iwcontrol settings to control monitor mode
|
|---|
| 2647 | int monitor_hostap(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
|
|---|
| 2648 | int ret;
|
|---|
| 2649 | @@ -1433,132 +1301,6 @@
|
|---|
| 2650 |
|
|---|
| 2651 | }
|
|---|
| 2652 |
|
|---|
| 2653 | -// Acx100 uses the packhdr iwpriv control to set link state, rest is normal
|
|---|
| 2654 | -int monitor_acx100(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
|
|---|
| 2655 | - int ret;
|
|---|
| 2656 | -
|
|---|
| 2657 | - // Allocate a tracking record for the interface settings and remember our
|
|---|
| 2658 | - // setup
|
|---|
| 2659 | - linux_ifparm *ifparm = (linux_ifparm *) malloc(sizeof(linux_ifparm));
|
|---|
| 2660 | - (*in_if) = ifparm;
|
|---|
| 2661 | -
|
|---|
| 2662 | - if (Ifconfig_Get_Flags(in_dev, in_err, &ifparm->flags) < 0) {
|
|---|
| 2663 | - return -1;
|
|---|
| 2664 | - }
|
|---|
| 2665 | -
|
|---|
| 2666 | - if (Iwconfig_Get_SSID(in_dev, in_err, ifparm->essid) < 0)
|
|---|
| 2667 | - return -1;
|
|---|
| 2668 | -
|
|---|
| 2669 | - if ((ifparm->channel = Iwconfig_Get_Channel(in_dev, in_err)) < 0)
|
|---|
| 2670 | - return -1;
|
|---|
| 2671 | -
|
|---|
| 2672 | - if (Iwconfig_Get_Mode(in_dev, in_err, &ifparm->mode) < 0)
|
|---|
| 2673 | - return -1;
|
|---|
| 2674 | -
|
|---|
| 2675 | - // it looks like an orinoco now, apparently
|
|---|
| 2676 | - if ((ret = Iwconfig_Set_IntPriv(in_dev, "monitor", 1, initch, in_err)) < 0) {
|
|---|
| 2677 | - if (ret == -2)
|
|---|
| 2678 | - snprintf(in_err, 1024, "Could not find 'monitor' private ioctl "
|
|---|
| 2679 | - "Make sure you have the latest ACX100 development release.");
|
|---|
| 2680 | - return -1;
|
|---|
| 2681 | - }
|
|---|
| 2682 | -
|
|---|
| 2683 | - if (chancontrol_wext(in_dev, initch, in_err, NULL) < 0)
|
|---|
| 2684 | - return -1;
|
|---|
| 2685 | -
|
|---|
| 2686 | - return 0;
|
|---|
| 2687 | -}
|
|---|
| 2688 | -
|
|---|
| 2689 | -int unmonitor_acx100(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
|
|---|
| 2690 | - // Restore the IP settings
|
|---|
| 2691 | - linux_ifparm *ifparm = (linux_ifparm *) (*in_if);
|
|---|
| 2692 | -
|
|---|
| 2693 | - if (Ifconfig_Set_Flags(in_dev, in_err, ifparm->flags) < 0) {
|
|---|
| 2694 | - return -1;
|
|---|
| 2695 | - }
|
|---|
| 2696 | -
|
|---|
| 2697 | - Iwconfig_Set_IntPriv(in_dev, "monitor", 0, ifparm->channel, in_err);
|
|---|
| 2698 | - Iwconfig_Set_Mode(in_dev, in_err, ifparm->mode);
|
|---|
| 2699 | -
|
|---|
| 2700 | - if (Iwconfig_Set_SSID(in_dev, in_err, ifparm->essid) < 0)
|
|---|
| 2701 | - return -1;
|
|---|
| 2702 | -
|
|---|
| 2703 | - free(ifparm);
|
|---|
| 2704 | -
|
|---|
| 2705 | - return 1;
|
|---|
| 2706 | -}
|
|---|
| 2707 | -
|
|---|
| 2708 | -int monitor_admtek(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
|
|---|
| 2709 | - // Allocate a tracking record for the interface settings and remember our
|
|---|
| 2710 | - // setup
|
|---|
| 2711 | - linux_ifparm *ifparm = (linux_ifparm *) malloc(sizeof(linux_ifparm));
|
|---|
| 2712 | - (*in_if) = ifparm;
|
|---|
| 2713 | -
|
|---|
| 2714 | - // Try to figure out the name so we know if we have fcs bytes or not
|
|---|
| 2715 | - char iwname[IFNAMSIZ+1];
|
|---|
| 2716 | - if (Iwconfig_Get_Name(in_dev, in_err, iwname) < 0)
|
|---|
| 2717 | - return -1;
|
|---|
| 2718 | -
|
|---|
| 2719 | - if (strncmp(iwname, "IEEE 802.11b", IFNAMSIZ) == 0) {
|
|---|
| 2720 | - // Looks like the GPL driver, we need to adjust the fcsbytes
|
|---|
| 2721 | - PcapSource *psrc = (PcapSource *) in_ext;
|
|---|
| 2722 | - psrc->fcsbytes = 4;
|
|---|
| 2723 | - }
|
|---|
| 2724 | -
|
|---|
| 2725 | - if (Ifconfig_Get_Flags(in_dev, in_err, &ifparm->flags) < 0) {
|
|---|
| 2726 | - return -1;
|
|---|
| 2727 | - }
|
|---|
| 2728 | -
|
|---|
| 2729 | - if ((ifparm->flags & IFF_UP)) {
|
|---|
| 2730 | - if ((ifparm->channel = Iwconfig_Get_Channel(in_dev, in_err)) < 0)
|
|---|
| 2731 | - return -1;
|
|---|
| 2732 | -
|
|---|
| 2733 | - if (Iwconfig_Get_Mode(in_dev, in_err, &ifparm->mode) < 0)
|
|---|
| 2734 | - return -1;
|
|---|
| 2735 | -
|
|---|
| 2736 | - if (Iwconfig_Get_SSID(in_dev, in_err, ifparm->essid) < 0)
|
|---|
| 2737 | - return -1;
|
|---|
| 2738 | -
|
|---|
| 2739 | - } else {
|
|---|
| 2740 | - ifparm->channel = -1;
|
|---|
| 2741 | - ifparm->mode = -1;
|
|---|
| 2742 | - }
|
|---|
| 2743 | -
|
|---|
| 2744 | - int ret = monitor_wext(in_dev, initch, in_err, in_if, in_ext);
|
|---|
| 2745 | -
|
|---|
| 2746 | - if (ret < 0 && ret != -2)
|
|---|
| 2747 | - return ret;
|
|---|
| 2748 | -
|
|---|
| 2749 | - if (Iwconfig_Set_SSID(in_dev, in_err, "") < 0)
|
|---|
| 2750 | - return -1;
|
|---|
| 2751 | -
|
|---|
| 2752 | - return 0;
|
|---|
| 2753 | -}
|
|---|
| 2754 | -
|
|---|
| 2755 | -int unmonitor_admtek(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
|
|---|
| 2756 | - linux_ifparm *ifparm = (linux_ifparm *) (*in_if);
|
|---|
| 2757 | -
|
|---|
| 2758 | - if (unmonitor_wext(in_dev, initch, in_err, in_if, in_ext))
|
|---|
| 2759 | - return -1;
|
|---|
| 2760 | -
|
|---|
| 2761 | - if (Iwconfig_Set_SSID(in_dev, in_err, ifparm->essid) < 0)
|
|---|
| 2762 | - return -1;
|
|---|
| 2763 | -
|
|---|
| 2764 | - return 1;
|
|---|
| 2765 | -}
|
|---|
| 2766 | -// vtar5k iwpriv control to set link state, rest is normal
|
|---|
| 2767 | -int monitor_vtar5k(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
|
|---|
| 2768 | - // Set the prism iwpriv control to 1
|
|---|
| 2769 | - if (Iwconfig_Set_IntPriv(in_dev, "prism", 1, 0, in_err) < 0) {
|
|---|
| 2770 | - return -1;
|
|---|
| 2771 | - }
|
|---|
| 2772 | -
|
|---|
| 2773 | - // The rest is standard wireless extensions
|
|---|
| 2774 | - if (monitor_wext(in_dev, initch, in_err, in_if, in_ext) < 0)
|
|---|
| 2775 | - return -1;
|
|---|
| 2776 | -
|
|---|
| 2777 | - return 0;
|
|---|
| 2778 | -}
|
|---|
| 2779 |
|
|---|
| 2780 | /* Madwifi NG ioctls from net80211 */
|
|---|
| 2781 | #define SIOC80211IFCREATE (SIOCDEVPRIVATE+7)
|
|---|
| 2782 | @@ -1927,249 +1669,6 @@
|
|---|
| 2783 | return unmonitor_wext(in_dev, initch, in_err, in_if, in_ext);
|
|---|
| 2784 | }
|
|---|
| 2785 |
|
|---|
| 2786 | -int monitor_ipw2100(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
|
|---|
| 2787 | - // Allocate a tracking record for the interface settings and remember our
|
|---|
| 2788 | - // setup
|
|---|
| 2789 | - linux_ifparm *ifparm = (linux_ifparm *) malloc(sizeof(linux_ifparm));
|
|---|
| 2790 | - (*in_if) = ifparm;
|
|---|
| 2791 | -
|
|---|
| 2792 | - if (Ifconfig_Get_Flags(in_dev, in_err, &ifparm->flags) < 0) {
|
|---|
| 2793 | - return -1;
|
|---|
| 2794 | - }
|
|---|
| 2795 | -
|
|---|
| 2796 | - if ((ifparm->channel = Iwconfig_Get_Channel(in_dev, in_err)) < 0)
|
|---|
| 2797 | - return -1;
|
|---|
| 2798 | -
|
|---|
| 2799 | - if (Iwconfig_Get_Mode(in_dev, in_err, &ifparm->mode) < 0)
|
|---|
| 2800 | - return -1;
|
|---|
| 2801 | -
|
|---|
| 2802 | - // Call the normal monitor mode
|
|---|
| 2803 | - return (monitor_wext(in_dev, initch, in_err, in_if, in_ext));
|
|---|
| 2804 | -}
|
|---|
| 2805 | -
|
|---|
| 2806 | -int unmonitor_ipw2100(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
|
|---|
| 2807 | - // Restore initial monitor header
|
|---|
| 2808 | - // linux_ifparm *ifparm = (linux_ifparm *) (*in_if);
|
|---|
| 2809 | -
|
|---|
| 2810 | - linux_ifparm *ifparm = (linux_ifparm *) (*in_if);
|
|---|
| 2811 | -
|
|---|
| 2812 | - if (Ifconfig_Set_Flags(in_dev, in_err, ifparm->flags) < 0) {
|
|---|
| 2813 | - return -1;
|
|---|
| 2814 | - }
|
|---|
| 2815 | -
|
|---|
| 2816 | - if (Iwconfig_Set_Mode(in_dev, in_err, ifparm->mode) < 0)
|
|---|
| 2817 | - return -1;
|
|---|
| 2818 | -
|
|---|
| 2819 | - free(ifparm);
|
|---|
| 2820 | -
|
|---|
| 2821 | - return 1;
|
|---|
| 2822 | -}
|
|---|
| 2823 | -
|
|---|
| 2824 | -int monitor_ipw2200(const char *in_dev, int initch, char *in_err,
|
|---|
| 2825 | - void **in_if, void *in_ext) {
|
|---|
| 2826 | - // Allocate a tracking record for the interface settings and remember our
|
|---|
| 2827 | - // setup
|
|---|
| 2828 | - linux_ifparm *ifparm = (linux_ifparm *) malloc(sizeof(linux_ifparm));
|
|---|
| 2829 | - (*in_if) = ifparm;
|
|---|
| 2830 | -
|
|---|
| 2831 | - if (Ifconfig_Get_Flags(in_dev, in_err, &ifparm->flags) < 0) {
|
|---|
| 2832 | - return -1;
|
|---|
| 2833 | - }
|
|---|
| 2834 | -
|
|---|
| 2835 | - if ((ifparm->channel = Iwconfig_Get_Channel(in_dev, in_err)) < 0)
|
|---|
| 2836 | - return -1;
|
|---|
| 2837 | -
|
|---|
| 2838 | - if (Iwconfig_Get_Mode(in_dev, in_err, &ifparm->mode) < 0)
|
|---|
| 2839 | - return -1;
|
|---|
| 2840 | -
|
|---|
| 2841 | - // Call the normal monitor mode
|
|---|
| 2842 | - return (monitor_wext(in_dev, initch, in_err, in_if, in_ext));
|
|---|
| 2843 | -}
|
|---|
| 2844 | -
|
|---|
| 2845 | -int unmonitor_ipw2200(const char *in_dev, int initch, char *in_err,
|
|---|
| 2846 | - void **in_if, void *in_ext) {
|
|---|
| 2847 | - // Restore initial monitor header
|
|---|
| 2848 | - // linux_ifparm *ifparm = (linux_ifparm *) (*in_if);
|
|---|
| 2849 | -
|
|---|
| 2850 | - linux_ifparm *ifparm = (linux_ifparm *) (*in_if);
|
|---|
| 2851 | -
|
|---|
| 2852 | - if (Ifconfig_Set_Flags(in_dev, in_err, ifparm->flags) < 0) {
|
|---|
| 2853 | - return -1;
|
|---|
| 2854 | - }
|
|---|
| 2855 | -
|
|---|
| 2856 | - if (Iwconfig_Set_Mode(in_dev, in_err, ifparm->mode) < 0)
|
|---|
| 2857 | - return -1;
|
|---|
| 2858 | -
|
|---|
| 2859 | - // James says this wants to be set to channel 0 for proper scanning operation
|
|---|
| 2860 | - if (Iwconfig_Set_Channel(in_dev, 0, in_err) < 0)
|
|---|
| 2861 | - return -1;
|
|---|
| 2862 | -
|
|---|
| 2863 | - free(ifparm);
|
|---|
| 2864 | -
|
|---|
| 2865 | - return 1;
|
|---|
| 2866 | -}
|
|---|
| 2867 | -
|
|---|
| 2868 | -// (Unless we learn different) the 3945 in full rfmon acts the same as
|
|---|
| 2869 | -// an ipw2200, so we'll use the same control mechanisms
|
|---|
| 2870 | -int monitor_ipw3945(const char *in_dev, int initch, char *in_err,
|
|---|
| 2871 | - void **in_if, void *in_ext) {
|
|---|
| 2872 | - // Allocate a tracking record for the interface settings and remember our
|
|---|
| 2873 | - // setup
|
|---|
| 2874 | - linux_ifparm *ifparm = (linux_ifparm *) malloc(sizeof(linux_ifparm));
|
|---|
| 2875 | - (*in_if) = ifparm;
|
|---|
| 2876 | -
|
|---|
| 2877 | - if (Ifconfig_Get_Flags(in_dev, in_err, &ifparm->flags) < 0) {
|
|---|
| 2878 | - return -1;
|
|---|
| 2879 | - }
|
|---|
| 2880 | -
|
|---|
| 2881 | - if ((ifparm->channel = Iwconfig_Get_Channel(in_dev, in_err)) < 0)
|
|---|
| 2882 | - return -1;
|
|---|
| 2883 | -
|
|---|
| 2884 | - if (Iwconfig_Get_Mode(in_dev, in_err, &ifparm->mode) < 0)
|
|---|
| 2885 | - return -1;
|
|---|
| 2886 | -
|
|---|
| 2887 | - // Call the normal monitor mode
|
|---|
| 2888 | - return (monitor_wext(in_dev, initch, in_err, in_if, in_ext));
|
|---|
| 2889 | -}
|
|---|
| 2890 | -
|
|---|
| 2891 | -int unmonitor_ipw3945(const char *in_dev, int initch, char *in_err,
|
|---|
| 2892 | - void **in_if, void *in_ext) {
|
|---|
| 2893 | - // Restore initial monitor header
|
|---|
| 2894 | - // linux_ifparm *ifparm = (linux_ifparm *) (*in_if);
|
|---|
| 2895 | -
|
|---|
| 2896 | - linux_ifparm *ifparm = (linux_ifparm *) (*in_if);
|
|---|
| 2897 | -
|
|---|
| 2898 | - if (Ifconfig_Set_Flags(in_dev, in_err, ifparm->flags) < 0) {
|
|---|
| 2899 | - return -1;
|
|---|
| 2900 | - }
|
|---|
| 2901 | -
|
|---|
| 2902 | - if (Iwconfig_Set_Mode(in_dev, in_err, ifparm->mode) < 0)
|
|---|
| 2903 | - return -1;
|
|---|
| 2904 | -
|
|---|
| 2905 | - // James says this wants to be set to channel 0 for proper scanning operation
|
|---|
| 2906 | - if (Iwconfig_Set_Channel(in_dev, 0, in_err) < 0)
|
|---|
| 2907 | - return -1;
|
|---|
| 2908 | -
|
|---|
| 2909 | - free(ifparm);
|
|---|
| 2910 | -
|
|---|
| 2911 | - return 1;
|
|---|
| 2912 | -}
|
|---|
| 2913 | -
|
|---|
| 2914 | -// The 3945 in "parasite" mode (until James names it) is a different
|
|---|
| 2915 | -// beast entirely. It uses a dynamically added tap interface to give us
|
|---|
| 2916 | -// realtime rtap formatted frames off the interface, so we need to
|
|---|
| 2917 | -// turn it on via sysfs and then push the new rtapX interface into the source
|
|---|
| 2918 | -// before the open happens
|
|---|
| 2919 | -int monitor_ipwlivetap(const char *in_dev, int initch, char *in_err,
|
|---|
| 2920 | - void **in_if, void *in_ext) {
|
|---|
| 2921 | - // We don't try to remember settings because we aren't going to do
|
|---|
| 2922 | - // anything with them, we're leeching off a dynamic interface made
|
|---|
| 2923 | - // just for us.
|
|---|
| 2924 | - char dynif[32];
|
|---|
| 2925 | - FILE *sysf;
|
|---|
| 2926 | - char path[1024];
|
|---|
| 2927 | - short int ifflags;
|
|---|
| 2928 | -
|
|---|
| 2929 | - // Try to get the flags off the master interface
|
|---|
| 2930 | - if (Ifconfig_Get_Flags(in_dev, in_err, &ifflags) < 0) {
|
|---|
| 2931 | - return -1;
|
|---|
| 2932 | - }
|
|---|
| 2933 | -
|
|---|
| 2934 | - // If the master interface isn't even up, blow up.
|
|---|
| 2935 | - if ((ifflags & IFF_UP) == 0) {
|
|---|
| 2936 | - snprintf(in_err, 1024, "The ipw control interface (%s) is not "
|
|---|
| 2937 | - "configured as 'up'. The ipwlivetap mode reports "
|
|---|
| 2938 | - "traffic from a currently running interface. For pure "
|
|---|
| 2939 | - "rfmon monitor mode, use ipwXXXX instead.", in_dev);
|
|---|
| 2940 | - return -1;
|
|---|
| 2941 | - }
|
|---|
| 2942 | -
|
|---|
| 2943 | - // Use the .../net/foo/device symlink into the .../bus/pci/drivers/
|
|---|
| 2944 | - // ipw3945/foo/ pci bus interface
|
|---|
| 2945 | - snprintf(path, 1024, "/sys/class/net/%s/device/rtap_iface",
|
|---|
| 2946 | - in_dev);
|
|---|
| 2947 | -
|
|---|
| 2948 | - // Open it in RO mode first and get the current state. I'm not sure
|
|---|
| 2949 | - // how well frewind works on a dynamic system file so we'll just
|
|---|
| 2950 | - // close it off and re-open it when we go to set modes, if we need
|
|---|
| 2951 | - // to.
|
|---|
| 2952 | - if ((sysf = fopen(path, "r")) == NULL) {
|
|---|
| 2953 | - snprintf(in_err, 1024, "Failed to open ipw sysfs tap control file, "
|
|---|
| 2954 | - "check that the version of the ipw drivers you are running "
|
|---|
| 2955 | - "is recent enough, and that your system has sysfs properly "
|
|---|
| 2956 | - "set up.");
|
|---|
| 2957 | - return -1;
|
|---|
| 2958 | - }
|
|---|
| 2959 | -
|
|---|
| 2960 | - fgets(dynif, 32, sysf);
|
|---|
| 2961 | -
|
|---|
| 2962 | - // We're done with the RO
|
|---|
| 2963 | - fclose(sysf);
|
|---|
| 2964 | -
|
|---|
| 2965 | - // If it's -1, we aren't turned on and we need to.
|
|---|
| 2966 | - if (strncmp(dynif, "-1", 32) == 0) {
|
|---|
| 2967 | - if ((sysf = fopen(path, "w")) == NULL) {
|
|---|
| 2968 | - snprintf(in_err, 1024, "Failed to open the ipw sysfs tap control "
|
|---|
| 2969 | - "file for writing (%s). Check that Kismet has the proper "
|
|---|
| 2970 | - "privilege levels and that you are running a version of the "
|
|---|
| 2971 | - "ipw drivers which supports associated rfmon.", strerror(errno));
|
|---|
| 2972 | - return -1;
|
|---|
| 2973 | - }
|
|---|
| 2974 | -
|
|---|
| 2975 | - fprintf(sysf, "1\n");
|
|---|
| 2976 | - fclose(sysf);
|
|---|
| 2977 | -
|
|---|
| 2978 | - // Reopen it again for reading for the last time, and get the
|
|---|
| 2979 | - // interface we changed to. Do some minor error checking to make
|
|---|
| 2980 | - // sure the new interface isn't called -1, 0, or 1, which I'm going
|
|---|
| 2981 | - // to guess would imply an older driver
|
|---|
| 2982 | - if ((sysf = fopen(path, "r")) == NULL) {
|
|---|
| 2983 | - snprintf(in_err, 1024, "Failed to open the ipw sysfs tap "
|
|---|
| 2984 | - "control to find the interface allocated. Something strange "
|
|---|
| 2985 | - "has happened, because the control file was available "
|
|---|
| 2986 | - "previously for setting. Check your system messages.");
|
|---|
| 2987 | - return -1;
|
|---|
| 2988 | - }
|
|---|
| 2989 | -
|
|---|
| 2990 | - fgets(dynif, 32, sysf);
|
|---|
| 2991 | -
|
|---|
| 2992 | - fclose(sysf);
|
|---|
| 2993 | -
|
|---|
| 2994 | - // Wait for the distro to settle if its going to rename an interface
|
|---|
| 2995 | - sleep(1);
|
|---|
| 2996 | - }
|
|---|
| 2997 | -
|
|---|
| 2998 | - // Sanity check the interface we were told to use. A 0, 1, -1 probably
|
|---|
| 2999 | - // means a bad driver version.
|
|---|
| 3000 | - if (strncmp(dynif, "-1", 32) == 0 || strncmp(dynif, "0", 32) == 0 ||
|
|---|
| 3001 | - strncmp(dynif, "1", 32) == 0) {
|
|---|
| 3002 | - snprintf(in_err, 1024, "Got a nonsense interface from the ipw "
|
|---|
| 3003 | - "sysfs tap control file. This probably means your ipw "
|
|---|
| 3004 | - "drivers are out of date, or that there is something strange "
|
|---|
| 3005 | - "happening in the drivers. Check your system messages.");
|
|---|
| 3006 | - return -1;
|
|---|
| 3007 | - }
|
|---|
| 3008 | -
|
|---|
| 3009 | - // Now that we've gone through that nonsense, make sure the
|
|---|
| 3010 | - // dynamic rtap interface is up
|
|---|
| 3011 | - if (Ifconfig_Delta_Flags(dynif, in_err, IFF_UP | IFF_RUNNING | IFF_PROMISC) < 0)
|
|---|
| 3012 | - return -1;
|
|---|
| 3013 | -
|
|---|
| 3014 | - // And push the config into the packetsoure
|
|---|
| 3015 | - ((KisPacketSource *) in_ext)->SetInterface(dynif);
|
|---|
| 3016 | -
|
|---|
| 3017 | - return 1;
|
|---|
| 3018 | -}
|
|---|
| 3019 | -
|
|---|
| 3020 | -int unmonitor_ipwlivetap(const char *in_dev, int initch, char *in_err,
|
|---|
| 3021 | - void **in_if, void *in_ext) {
|
|---|
| 3022 | - // Actually there isn't anything to do here. Right now, I don't
|
|---|
| 3023 | - // think I care if we leave the parasite rtap interface hanging around.
|
|---|
| 3024 | - // Newcore might do this better, but this isn't newcore.
|
|---|
| 3025 | -
|
|---|
| 3026 | - return 1;
|
|---|
| 3027 | -}
|
|---|
| 3028 | -
|
|---|
| 3029 | // "standard" wireless extension monitor mode
|
|---|
| 3030 | int monitor_wext(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
|
|---|
| 3031 | int mode;
|
|---|
| 3032 | @@ -2231,108 +1730,6 @@
|
|---|
| 3033 | #endif
|
|---|
| 3034 |
|
|---|
| 3035 | #ifdef SYS_LINUX
|
|---|
| 3036 | -// wlan-ng modern standard
|
|---|
| 3037 | -int monitor_wlanng(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
|
|---|
| 3038 | - // I really didn't want to do this...
|
|---|
| 3039 | - char cmdline[2048];
|
|---|
| 3040 | -
|
|---|
| 3041 | - // Sanitize the device just to be safe. The ifconfig should fail if
|
|---|
| 3042 | - // the device is invalid, but why take risks
|
|---|
| 3043 | - for (unsigned int x = 0; x < strlen(in_dev); x++) {
|
|---|
| 3044 | - if (!isalnum(in_dev[x])) {
|
|---|
| 3045 | - snprintf(in_err, STATUS_MAX, "Invalid device '%s'", in_dev);
|
|---|
| 3046 | - return -1;
|
|---|
| 3047 | - }
|
|---|
| 3048 | - }
|
|---|
| 3049 | -
|
|---|
| 3050 | - if (Ifconfig_Delta_Flags(in_dev, in_err, IFF_UP | IFF_RUNNING | IFF_PROMISC) < 0)
|
|---|
| 3051 | - return -1;
|
|---|
| 3052 | -
|
|---|
| 3053 | - // Enable the interface
|
|---|
| 3054 | - snprintf(cmdline, 2048, "wlanctl-ng %s lnxreq_ifstate ifstate=enable >/dev/null 2>/dev/null", in_dev);
|
|---|
| 3055 | - if (RunSysCmd(cmdline) < 0) {
|
|---|
| 3056 | - snprintf(in_err, 1024, "Unable to execute '%s'", cmdline);
|
|---|
| 3057 | - return -1;
|
|---|
| 3058 | - }
|
|---|
| 3059 | -
|
|---|
| 3060 | - // Turn off WEP
|
|---|
| 3061 | - snprintf(cmdline, 2048, "wlanctl-ng %s dot11req_mibset "
|
|---|
| 3062 | - "mibattribute=dot11PrivacyInvoked=false >/dev/null 2>/dev/null", in_dev);
|
|---|
| 3063 | - if (RunSysCmd(cmdline) < 0) {
|
|---|
| 3064 | - snprintf(in_err, 1024, "Unable to execute '%s'", cmdline);
|
|---|
| 3065 | - return -1;
|
|---|
| 3066 | - }
|
|---|
| 3067 | -
|
|---|
| 3068 | - // Don't exclude packets
|
|---|
| 3069 | - snprintf(cmdline, 2048, "wlanctl-ng %s dot11req_mibset "
|
|---|
| 3070 | - "mibattribute=dot11ExcludeUnencrypted=false >/dev/null 2>/dev/null", in_dev);
|
|---|
| 3071 | - if (RunSysCmd(cmdline) < 0) {
|
|---|
| 3072 | - snprintf(in_err, 1024, "Unable to execute '%s'", cmdline);
|
|---|
| 3073 | - return -1;
|
|---|
| 3074 | - }
|
|---|
| 3075 | -
|
|---|
| 3076 | - // Turn on rfmon on the initial channel
|
|---|
| 3077 | - snprintf(cmdline, 2048, "wlanctl-ng %s lnxreq_wlansniff channel=%d "
|
|---|
| 3078 | - "enable=true prismheader=true >/dev/null 2>/dev/null", in_dev, initch);
|
|---|
| 3079 | - if (RunSysCmd(cmdline) < 0) {
|
|---|
| 3080 | - snprintf(in_err, 1024, "Unable to execute '%s'", cmdline);
|
|---|
| 3081 | - return -1;
|
|---|
| 3082 | - }
|
|---|
| 3083 | -
|
|---|
| 3084 | - return 0;
|
|---|
| 3085 | -}
|
|---|
| 3086 | -
|
|---|
| 3087 | -// wlan-ng avs
|
|---|
| 3088 | -int monitor_wlanng_avs(const char *in_dev, int initch, char *in_err, void **in_if, void *in_ext) {
|
|---|
| 3089 | - // I really didn't want to do this...
|
|---|
| 3090 | - char cmdline[2048];
|
|---|
| 3091 | -
|
|---|
| 3092 | - // Sanitize the device just to be safe. The ifconfig should fail if
|
|---|
| 3093 | - // the device is invalid, but why take risks
|
|---|
| 3094 | - for (unsigned int x = 0; x < strlen(in_dev); x++) {
|
|---|
| 3095 | - if (!isalnum(in_dev[x])) {
|
|---|
| 3096 | - snprintf(in_err, STATUS_MAX, "Invalid device '%s'", in_dev);
|
|---|
| 3097 | - return -1;
|
|---|
| 3098 | - }
|
|---|
| 3099 | - }
|
|---|
| 3100 | -
|
|---|
| 3101 | - if (Ifconfig_Delta_Flags(in_dev, in_err, IFF_UP | IFF_RUNNING | IFF_PROMISC) < 0)
|
|---|
| 3102 | - return -1;
|
|---|
| 3103 | -
|
|---|
| 3104 | - // Enable the interface
|
|---|
| 3105 | - snprintf(cmdline, 2048, "wlanctl-ng %s lnxreq_ifstate ifstate=enable >/dev/null 2>/dev/null", in_dev);
|
|---|
| 3106 | - if (RunSysCmd(cmdline) < 0) {
|
|---|
| 3107 | - snprintf(in_err, 1024, "Unable to execute '%s'", cmdline);
|
|---|
| 3108 | - return -1;
|
|---|
| 3109 | - }
|
|---|
| 3110 | -
|
|---|
| 3111 | - // Turn off WEP
|
|---|
| 3112 | - snprintf(cmdline, 2048, "wlanctl-ng %s dot11req_mibset "
|
|---|
| 3113 | - "mibattribute=dot11PrivacyInvoked=false >/dev/null 2>/dev/null", in_dev);
|
|---|
| 3114 | - if (RunSysCmd(cmdline) < 0) {
|
|---|
| 3115 | - snprintf(in_err, 1024, "Unable to execute '%s'", cmdline);
|
|---|
| 3116 | - return -1;
|
|---|
| 3117 | - }
|
|---|
| 3118 | -
|
|---|
| 3119 | - // Don't exclude packets
|
|---|
| 3120 | - snprintf(cmdline, 2048, "wlanctl-ng %s dot11req_mibset "
|
|---|
| 3121 | - "mibattribute=dot11ExcludeUnencrypted=false >/dev/null 2>/dev/null", in_dev);
|
|---|
| 3122 | - if (RunSysCmd(cmdline) < 0) {
|
|---|
| 3123 | - snprintf(in_err, 1024, "Unable to execute '%s'", cmdline);
|
|---|
| 3124 | - return -1;
|
|---|
| 3125 | - }
|
|---|
| 3126 | -
|
|---|
| 3127 | - // Turn on rfmon on the initial channel
|
|---|
| 3128 | - snprintf(cmdline, 2048, "wlanctl-ng %s lnxreq_wlansniff channel=%d prismheader=false "
|
|---|
| 3129 | - "wlanheader=true stripfcs=false keepwepflags=false enable=true >/dev/null 2>/dev/null", in_dev, initch);
|
|---|
| 3130 | - if (RunSysCmd(cmdline) < 0) {
|
|---|
| 3131 | - snprintf(in_err, 1024, "Unable to execute '%s'", cmdline);
|
|---|
| 3132 | - return -1;
|
|---|
| 3133 | - }
|
|---|
| 3134 | -
|
|---|
| 3135 | - return 0;
|
|---|
| 3136 | -}
|
|---|
| 3137 | -
|
|---|
| 3138 | int monitor_wrt54g(const char *in_dev, int initch, char *in_err, void **in_if,
|
|---|
| 3139 | void *in_ext) {
|
|---|
| 3140 | char cmdline[2048];
|
|---|
| 3141 | @@ -2342,7 +1739,7 @@
|
|---|
| 3142 | snprintf(in_err, 1024, "Unable to set mode using 'iwpriv %s set_monitor 1'. "
|
|---|
| 3143 | "Some custom firmware images require you to specify the origial "
|
|---|
| 3144 | "device and a new dynamic device and use the iwconfig controls. "
|
|---|
| 3145 | - "see the README for how to configure your capture source.");
|
|---|
| 3146 | + "see the README for how to configure your capture source.", in_dev);
|
|---|
| 3147 | return -1;
|
|---|
| 3148 | }
|
|---|
| 3149 |
|
|---|
| 3150 | @@ -2359,7 +1756,7 @@
|
|---|
| 3151 | snprintf(in_err, 1024, "Unable to set mode using 'iwpriv %s set_monitor 0'. "
|
|---|
| 3152 | "Some custom firmware images require you to specify the origial "
|
|---|
| 3153 | "device and a new dynamic device and use the iwconfig controls. "
|
|---|
| 3154 | - "see the README for how to configure your capture source.");
|
|---|
| 3155 | + "see the README for how to configure your capture source.", in_dev);
|
|---|
| 3156 | return -1;
|
|---|
| 3157 | }
|
|---|
| 3158 |
|
|---|
| 3159 | @@ -2607,75 +2004,6 @@
|
|---|
| 3160 | return 0;
|
|---|
| 3161 | }
|
|---|
| 3162 |
|
|---|
| 3163 | -int chancontrol_ipw2100(const char *in_dev, int in_ch, char *in_err, void *in_ext) {
|
|---|
| 3164 | - // Introduce a slight delay to let the driver settle, a la orinoco. I don't
|
|---|
| 3165 | - // like doing this at all since it introduces hiccups into the channel control
|
|---|
| 3166 | - // process, but....
|
|---|
| 3167 | -
|
|---|
| 3168 | - int ret = 0;
|
|---|
| 3169 | -
|
|---|
| 3170 | - ret = chancontrol_wext(in_dev, in_ch, in_err, in_ext);
|
|---|
| 3171 | - usleep(5000);
|
|---|
| 3172 | -
|
|---|
| 3173 | - return ret;
|
|---|
| 3174 | -}
|
|---|
| 3175 | -
|
|---|
| 3176 | -int chancontrol_ipw2200(const char *in_dev, int in_ch, char *in_err, void *in_ext) {
|
|---|
| 3177 | - // Lets see if this really needs the channel change delay like the 2100 did
|
|---|
| 3178 | - int ret = 0;
|
|---|
| 3179 | -
|
|---|
| 3180 | - ret = chancontrol_wext(in_dev, in_ch, in_err, in_ext);
|
|---|
| 3181 | - // Drop a tiny sleep in here to let the channel set settle, otherwise we
|
|---|
| 3182 | - // run the risk of the card freaking out
|
|---|
| 3183 | - usleep(7000);
|
|---|
| 3184 | -
|
|---|
| 3185 | - return ret;
|
|---|
| 3186 | -}
|
|---|
| 3187 | -
|
|---|
| 3188 | -#endif
|
|---|
| 3189 | -
|
|---|
| 3190 | -#ifdef SYS_LINUX
|
|---|
| 3191 | -int chancontrol_wlanng(const char *in_dev, int in_ch, char *in_err, void *in_ext) {
|
|---|
| 3192 | - // I really didn't want to do this...
|
|---|
| 3193 | - char cmdline[2048];
|
|---|
| 3194 | -
|
|---|
| 3195 | - // Turn on rfmon on the initial channel
|
|---|
| 3196 | - snprintf(cmdline, 2048, "wlanctl-ng %s lnxreq_wlansniff channel=%d enable=true "
|
|---|
| 3197 | - "prismheader=true >/dev/null 2>&1", in_dev, in_ch);
|
|---|
| 3198 | - if (RunSysCmd(cmdline) < 0) {
|
|---|
| 3199 | - snprintf(in_err, 1024, "Unable to execute '%s'", cmdline);
|
|---|
| 3200 | - return -1;
|
|---|
| 3201 | - }
|
|---|
| 3202 | -
|
|---|
| 3203 | - if (in_ext != NULL) {
|
|---|
| 3204 | - PcapSourceWlanng *src = (PcapSourceWlanng *) in_ext;
|
|---|
| 3205 | - src->last_channel = in_ch;
|
|---|
| 3206 | - }
|
|---|
| 3207 | -
|
|---|
| 3208 | - return 0;
|
|---|
| 3209 | -}
|
|---|
| 3210 | -
|
|---|
| 3211 | -int chancontrol_wlanng_avs(const char *in_dev, int in_ch, char *in_err, void *in_ext) {
|
|---|
| 3212 | - // I really didn't want to do this...
|
|---|
| 3213 | - char cmdline[2048];
|
|---|
| 3214 | -
|
|---|
| 3215 | - // Turn on rfmon on the initial channel
|
|---|
| 3216 | - snprintf(cmdline, 2048, "wlanctl-ng %s lnxreq_wlansniff channel=%d "
|
|---|
| 3217 | - "prismheader=false wlanheader=true stripfcs=false keepwepflags=false "
|
|---|
| 3218 | - "enable=true >/dev/null 2>&1", in_dev, in_ch);
|
|---|
| 3219 | -
|
|---|
| 3220 | - if (RunSysCmd(cmdline) < 0) {
|
|---|
| 3221 | - snprintf(in_err, 1024, "Unable to execute '%s'", cmdline);
|
|---|
| 3222 | - return -1;
|
|---|
| 3223 | - }
|
|---|
| 3224 | -
|
|---|
| 3225 | - if (in_ext != NULL) {
|
|---|
| 3226 | - PcapSourceWlanng *src = (PcapSourceWlanng *) in_ext;
|
|---|
| 3227 | - src->last_channel = in_ch;
|
|---|
| 3228 | - }
|
|---|
| 3229 | -
|
|---|
| 3230 | - return 0;
|
|---|
| 3231 | -}
|
|---|
| 3232 | #endif
|
|---|
| 3233 |
|
|---|
| 3234 | #ifdef SYS_OPENBSD
|
|---|
| 3235 | diff -urN kismet.dev/tcpstreamer.cc kismet.dev2/tcpstreamer.cc
|
|---|
| 3236 | --- kismet.dev/tcpstreamer.cc 2005-05-26 16:51:45.000000000 +0200
|
|---|
| 3237 | +++ kismet.dev2/tcpstreamer.cc 2006-04-14 19:31:56.000000000 +0200
|
|---|
| 3238 | @@ -30,8 +30,6 @@
|
|---|
| 3239 | serv_fd = 0;
|
|---|
| 3240 |
|
|---|
| 3241 | max_fd = 0;
|
|---|
| 3242 | -
|
|---|
| 3243 | - gpsd = NULL;
|
|---|
| 3244 | }
|
|---|
| 3245 |
|
|---|
| 3246 | TcpStreamer::~TcpStreamer()
|
|---|
| 3247 | @@ -287,10 +285,6 @@
|
|---|
| 3248 | hdr.frame_len = (uint32_t) htonl(sizeof(struct stream_version_packet));
|
|---|
| 3249 |
|
|---|
| 3250 | vpkt.drone_version = (uint16_t) htons(STREAM_DRONE_VERSION);
|
|---|
| 3251 | - if (gpsd != NULL)
|
|---|
| 3252 | - vpkt.gps_enabled = 1;
|
|---|
| 3253 | - else
|
|---|
| 3254 | - vpkt.gps_enabled = 0;
|
|---|
| 3255 |
|
|---|
| 3256 | if (!FD_ISSET(in_fd, &client_fds))
|
|---|
| 3257 | return -1;
|
|---|
| 3258 | diff -urN kismet.dev/tcpstreamer.h kismet.dev2/tcpstreamer.h
|
|---|
| 3259 | --- kismet.dev/tcpstreamer.h 2005-05-26 16:51:45.000000000 +0200
|
|---|
| 3260 | +++ kismet.dev2/tcpstreamer.h 2006-04-14 19:31:56.000000000 +0200
|
|---|
| 3261 | @@ -42,7 +42,6 @@
|
|---|
| 3262 | #include "ringbuf.h"
|
|---|
| 3263 | #include "packet.h"
|
|---|
| 3264 | #include "packetstream.h"
|
|---|
| 3265 | -#include "gpsd.h"
|
|---|
| 3266 |
|
|---|
| 3267 | // Global in kismet_drone.cc
|
|---|
| 3268 | extern int silent;
|
|---|
| 3269 | @@ -76,9 +75,6 @@
|
|---|
| 3270 |
|
|---|
| 3271 | int FetchDescriptor() { return serv_fd; }
|
|---|
| 3272 |
|
|---|
| 3273 | - // Register the GPS server for us to use
|
|---|
| 3274 | - void AddGpstracker(GPSD *in_gpsd) { gpsd = in_gpsd; }
|
|---|
| 3275 | -
|
|---|
| 3276 | void Kill(int in_fd);
|
|---|
| 3277 |
|
|---|
| 3278 | int Poll(fd_set& in_rset, fd_set& in_wset);
|
|---|
| 3279 | @@ -124,8 +120,6 @@
|
|---|
| 3280 | fd_set client_fds;
|
|---|
| 3281 |
|
|---|
| 3282 | unsigned int max_fd;
|
|---|
| 3283 | -
|
|---|
| 3284 | - GPSD *gpsd;
|
|---|
| 3285 | };
|
|---|
| 3286 |
|
|---|
| 3287 | #endif
|
|---|