diff options
author | Felix Fietkau <nbd@openwrt.org> | 2005-05-05 09:37:29 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2005-05-05 09:37:29 +0000 |
commit | 8e4eb8b1d6f7d3b79db731b78ed6701611e5791b (patch) | |
tree | b69241e94d159a783595e1d364b9f6139d980166 /openwrt/package/kismet/patches | |
parent | af5080ef5d5b326d535b858a9c4a22bd68f4e170 (diff) | |
download | mtk-20170518-8e4eb8b1d6f7d3b79db731b78ed6701611e5791b.zip mtk-20170518-8e4eb8b1d6f7d3b79db731b78ed6701611e5791b.tar.gz mtk-20170518-8e4eb8b1d6f7d3b79db731b78ed6701611e5791b.tar.bz2 |
add more config files to kismet, remove sound and speech features
SVN-Revision: 803
Diffstat (limited to 'openwrt/package/kismet/patches')
-rw-r--r-- | openwrt/package/kismet/patches/100-remove_sources.patch (renamed from openwrt/package/kismet/patches/remove-sources.patch) | 0 | ||||
-rw-r--r-- | openwrt/package/kismet/patches/110-uclibc++_fixes.patch (renamed from openwrt/package/kismet/patches/uclibc++-fixes.patch) | 1 | ||||
-rw-r--r-- | openwrt/package/kismet/patches/120-remove_sound.patch | 1051 |
3 files changed, 1051 insertions, 1 deletions
diff --git a/openwrt/package/kismet/patches/remove-sources.patch b/openwrt/package/kismet/patches/100-remove_sources.patch index 8bae67b..8bae67b 100644 --- a/openwrt/package/kismet/patches/remove-sources.patch +++ b/openwrt/package/kismet/patches/100-remove_sources.patch diff --git a/openwrt/package/kismet/patches/uclibc++-fixes.patch b/openwrt/package/kismet/patches/110-uclibc++_fixes.patch index 995d5ef..4cf5a7b 100644 --- a/openwrt/package/kismet/patches/uclibc++-fixes.patch +++ b/openwrt/package/kismet/patches/110-uclibc++_fixes.patch @@ -27,4 +27,3 @@ diff -urN kismet-2005-04-R1.old/macaddr.h kismet-2005-04-R1.dev/macaddr.h return (singleton_itr != op.singleton_itr) || (vector_itr != op.vector_itr); } -Binary files kismet-2005-04-R1.old/.macaddr.h.swp and kismet-2005-04-R1.dev/.macaddr.h.swp differ diff --git a/openwrt/package/kismet/patches/120-remove_sound.patch b/openwrt/package/kismet/patches/120-remove_sound.patch new file mode 100644 index 0000000..ca2737c --- /dev/null +++ b/openwrt/package/kismet/patches/120-remove_sound.patch @@ -0,0 +1,1051 @@ +diff -urN kismet-2005-04-R1.old/Makefile.in kismet-2005-04-R1.dev/Makefile.in +--- kismet-2005-04-R1.old/Makefile.in 2005-05-04 21:09:18.000000000 +0200 ++++ kismet-2005-04-R1.dev/Makefile.in 2005-05-04 21:19:26.000000000 +0200 +@@ -39,7 +39,7 @@ + DEPEND = .depend + + # Objects +-PSO = util.o ringbuf.o configfile.o speech.o ifcontrol.o iwcontrol.o packet.o \ ++PSO = util.o ringbuf.o configfile.o ifcontrol.o iwcontrol.o packet.o \ + pcapsource.o wtapfilesource.o \ + dronesource.o packetsourcetracker.o kis_packsources.o \ + wtapdump.o wtaplocaldump.o gpsdump.o airsnortdump.o fifodump.o \ +@@ -55,7 +55,7 @@ + timetracker.o gpsd.o server_globals.o kismet_drone.o + DRONE = kismet_drone + +-NCO = util.o configfile.o speech.o manuf.o tcpclient.o \ ++NCO = util.o configfile.o manuf.o tcpclient.o \ + frontend.o cursesfront.o \ + panelfront.o panelfront_display.o panelfront_input.o \ + gpsd.o getopt.o kismet_client.o +diff -urN kismet-2005-04-R1.old/kismet_client.cc kismet-2005-04-R1.dev/kismet_client.cc +--- kismet-2005-04-R1.old/kismet_client.cc 2005-04-03 07:33:42.000000000 +0200 ++++ kismet-2005-04-R1.dev/kismet_client.cc 2005-05-04 21:23:14.000000000 +0200 +@@ -28,7 +28,6 @@ + #include "cursesfront.h" + #include "panelfront.h" + #include "configfile.h" +-#include "speech.h" + + #ifndef exec_name + char *exec_name; +@@ -47,10 +46,6 @@ + char *configfile; + char *uiconfigfile; + char *server = NULL; +-int sound = -1; +-int speech = -1; +-int speech_encoding = 0; +-string speech_sentence_encrypted, speech_sentence_unencrypted; + unsigned int metric = 0; + unsigned int reconnect = 0; + +@@ -58,20 +53,9 @@ + string configdir, groupfile; + FILE *group_file = NULL; + +-// Pipe file descriptor pairs and fd's +-int soundpair[2]; +-int speechpair[2]; +-pid_t soundpid = -1, speechpid = -1; +- + // Catch our interrupt + void CatchShutdown(int sig) { + +- // Kill our sound players +- if (soundpid > 0) +- kill(soundpid, 9); +- if (speechpid > 0) +- kill(speechpid, 9); +- + if (group_track) { + if ((group_file = fopen(groupfile.c_str(), "w")) == NULL) { + fprintf(stderr, "WARNING: Unable to open '%s' for writing, groups will not be saved.\n", +@@ -115,215 +99,6 @@ + exit(0); + } + +-// Subprocess sound handler +-void SoundHandler(int *fds, const char *player, map<string, string> soundmap) { +- int read_sock = fds[0]; +- +- close(fds[1]); +- +- signal(SIGPIPE, PipeHandler); +- +- fd_set rset; +- +- char data[1024]; +- +- pid_t sndpid = -1; +- int harvested = 1; +- +- while (1) { +- FD_ZERO(&rset); +- FD_SET(read_sock, &rset); +- char *end; +- +- memset(data, 0, 1024); +- +- if (harvested == 0) { +- // We consider a wait error to be a sign that the child pid died +- // so we flag it as harvested and keep on going +- pid_t harvestpid = waitpid(sndpid, NULL, WNOHANG); +- if (harvestpid == -1 || harvestpid == sndpid) +- harvested = 1; +- } +- +- struct timeval tim; +- tim.tv_sec = 1; +- tim.tv_usec = 0; +- +- if (select(read_sock + 1, &rset, NULL, NULL, &tim) < 0) { +- if (errno != EINTR) { +- exit(1); +- } +- } +- +- if (FD_ISSET(read_sock, &rset)) { +- int ret; +- ret = read(read_sock, data, 1024); +- +- // We'll die off if we get a read error, and we'll let kismet on the +- // other side detact that it died +- if (ret <= 0 && (errno != EAGAIN && errno != EPIPE)) +- exit(1); +- +- if ((end = strstr(data, "\n")) == NULL) +- continue; +- +- end[0] = '\0'; +- } +- +- if (data[0] == '\0') +- continue; +- +- // If we've harvested the process, spawn a new one and watch it +- // instead. Otherwise, we just let go of the data we read +- if (harvested == 1) { +- // Only take the first line +- char *nl; +- if ((nl = strchr(data, '\n')) != NULL) +- *nl = '\0'; +- +- char snd[1024]; +- +- if (soundmap.size() == 0) +- snprintf(snd, 1024, "%s", data); +- if (soundmap.find(data) != soundmap.end()) +- snprintf(snd, 1024, "%s", soundmap[data].c_str()); +- else +- continue; +- +- char plr[1024]; +- snprintf(plr, 1024, "%s", player); +- +- harvested = 0; +- if ((sndpid = fork()) == 0) { +- // Suppress errors +- int nulfd = open("/dev/null", O_RDWR); +- dup2(nulfd, 1); +- dup2(nulfd, 2); +- +- char * const echoarg[] = { plr, snd, NULL }; +- execve(echoarg[0], echoarg, NULL); +- } +- } +- +- data[0] = '\0'; +- } +-} +- +-// Subprocess speech handler +-void SpeechHandler(int *fds, const char *player) { +- int read_sock = fds[0]; +- close(fds[1]); +- +- fd_set rset; +- +- char data[1024]; +- +- pid_t sndpid = -1; +- int harvested = 1; +- +- while (1) { +- FD_ZERO(&rset); +- FD_SET(read_sock, &rset); +- //char *end; +- +- memset(data, 0, 1024); +- +- struct timeval tim; +- tim.tv_sec = 1; +- tim.tv_usec = 0; +- +- if (select(read_sock + 1, &rset, NULL, NULL, &tim) < 0) { +- if (errno != EINTR) { +- exit(1); +- } +- } +- +- if (harvested == 0) { +- // We consider a wait error to be a sign that the child pid died +- // so we flag it as harvested and keep on going +- pid_t harvestpid = waitpid(sndpid, NULL, WNOHANG); +- if (harvestpid == -1 || harvestpid == sndpid) +- harvested = 1; +- } +- +- if (FD_ISSET(read_sock, &rset)) { +- int ret; +- ret = read(read_sock, data, 1024); +- +- // We'll die off if we get a read error, and we'll let kismet on the +- // other side detact that it died +- if (ret <= 0 && (errno != EAGAIN && errno != EPIPE)) +- exit(1); +- +- data[ret] = '\0'; +- +- } +- +- if (data[0] == '\0') +- continue; +- +- // If we've harvested the process, spawn a new one and watch it +- // instead. Otherwise, we just let go of the data we read +- if (harvested == 1) { +- harvested = 0; +- if ((sndpid = fork()) == 0) { +- // Only take the first line +- char *nl; +- if ((nl = strchr(data, '\n')) != NULL) +- *nl = '\0'; +- +- // Make sure it's shell-clean +- MungeToShell(data, strlen(data)); +- char spk_call[1024]; +- snprintf(spk_call, 1024, "echo \"(SayText \\\"%s\\\")\" | %s >/dev/null 2>/dev/null", +- data, player); +- +- system(spk_call); +- +- exit(0); +- } +- } +- +- data[0] = '\0'; +- } +-} +- +- +-int PlaySound(string in_sound) { +- +- char snd[1024]; +- +- snprintf(snd, 1024, "%s\n", in_sound.c_str()); +- +- if (write(soundpair[1], snd, strlen(snd)) < 0) { +- char status[STATUS_MAX]; +- snprintf(status, STATUS_MAX, +- "ERROR: Could not write to sound pipe. Stopping sound."); +- gui->WriteStatus(status); +- +- return 0; +- } +- +- return 1; +-} +- +-int SayText(string in_text) { +- char snd[1024]; +- +- snprintf(snd, 1024, "%s\n", in_text.c_str()); +- +- if (write(speechpair[1], snd, strlen(snd)) < 0) { +- char status[STATUS_MAX]; +- snprintf(status, STATUS_MAX, +- "ERROR: Could not write to speech pipe. Stopping speech."); +- gui->WriteStatus(status); +- +- return 0; +- } +- +- return 1; +-} +- + int main(int argc, char *argv[]) { + exec_name = argv[0]; + +@@ -332,9 +107,6 @@ + + char *reqgui = NULL; + +- string sndplay; +- const char *festival = NULL; +- + char *columns = NULL; + char *clientcolumns = NULL; + +@@ -389,7 +161,6 @@ + fprintf(stderr, "Using alternate UI config file: %s\n", uiconfigfile); + break; + case 'q': +- sound = 0; + break; + case 'g': + reqgui = strdup(optarg); +@@ -513,67 +284,6 @@ + server = strdup(gui_conf->FetchOpt("host").c_str()); + } + +- if (gui_conf->FetchOpt("sound") == "true" && sound == -1) { +- if (gui_conf->FetchOpt("soundplay") != "") { +- sndplay = gui_conf->FetchOpt("soundplay"); +- sound = 1; +- +- if (gui_conf->FetchOpt("soundopts") != "") +- sndplay += " " + gui_conf->FetchOpt("soundopts"); +- +- if (gui_conf->FetchOpt("sound_new") != "") +- wav_map["new"] = gui_conf->FetchOpt("sound_new"); +- if (gui_conf->FetchOpt("sound_new_wep") != "") +- wav_map["new_wep"] = gui_conf->FetchOpt("sound_new_wep"); +- if (gui_conf->FetchOpt("sound_traffic") != "") +- wav_map["traffic"] = gui_conf->FetchOpt("sound_traffic"); +- if (gui_conf->FetchOpt("sound_junktraffic") != "") +- wav_map["junktraffic"] = gui_conf->FetchOpt("sound_junktraffic"); +- if (gui_conf->FetchOpt("sound_gpslock") != "") +- wav_map["gpslock"] = gui_conf->FetchOpt("sound_gpslock"); +- if (gui_conf->FetchOpt("sound_gpslost") != "") +- wav_map["gpslost"] = gui_conf->FetchOpt("sound_gpslost"); +- if (gui_conf->FetchOpt("sound_alert") != "") +- wav_map["alert"] = gui_conf->FetchOpt("sound_alert"); +- +- } else { +- fprintf(stderr, "ERROR: Sound alerts enabled but no sound playing binary specified.\n"); +- sound = 0; +- } +- } else if (sound == -1) +- sound = 0; +- +- /* Added by Shaw Innes 17/2/02 */ +- if (gui_conf->FetchOpt("speech") == "true" && speech == -1) { +- if (gui_conf->FetchOpt("festival") != "") { +- festival = strdup(gui_conf->FetchOpt("festival").c_str()); +- speech = 1; +- +- string speechtype = gui_conf->FetchOpt("speech_type"); +- +- if (!strcasecmp(speechtype.c_str(), "nato")) +- speech_encoding = SPEECH_ENCODING_NATO; +- else if (!strcasecmp(speechtype.c_str(), "spell")) +- speech_encoding = SPEECH_ENCODING_SPELL; +- else +- speech_encoding = SPEECH_ENCODING_NORMAL; +- +- // Make sure we have encrypted text lines +- if (gui_conf->FetchOpt("speech_encrypted") == "" || gui_conf->FetchOpt("speech_unencrypted") == "") { +- fprintf(stderr, "ERROR: Speech request but speech_encrypted or speech_unencrypted line missing.\n"); +- speech = 0; +- } +- +- speech_sentence_encrypted = gui_conf->FetchOpt("speech_encrypted"); +- speech_sentence_unencrypted = gui_conf->FetchOpt("speech_unencrypted"); +- +- } else { +- fprintf(stderr, "ERROR: Speech alerts enabled but no path to festival has been specified.\n"); +- speech = 0; +- } +- } else if (speech == -1) +- speech = 0; +- + if (gui_conf->FetchOpt("decay") != "") { + if (sscanf(gui_conf->FetchOpt("decay").c_str(), "%d", &decay) != 1) { + fprintf(stderr, "FATAL: Illegal config file value for decay.\n"); +@@ -631,45 +341,6 @@ + } + } + +- // Fork and find the sound options +- if (sound) { +- if (pipe(soundpair) == -1) { +- fprintf(stderr, "WARNING: Unable to create pipe for audio. Disabling sound.\n"); +- sound = 0; +- } else { +- soundpid = fork(); +- +- if (soundpid < 0) { +- fprintf(stderr, "WARNING: Unable to fork for audio. Disabling sound.\n"); +- sound = 0; +- } else if (soundpid == 0) { +- SoundHandler(soundpair, sndplay.c_str(), wav_map); +- exit(0); +- } +- +- close(soundpair[0]); +- } +- } +- +- if (speech) { +- if (pipe(speechpair) == -1) { +- fprintf(stderr, "WARNING: Unable to create pipe for speech. Disabling speech.\n"); +- speech = 0; +- } else { +- speechpid = fork(); +- +- if (speechpid < 0) { +- fprintf(stderr, "WARNING: Unable to fork for speech. Disabling speech.\n"); +- speech = 0; +- } else if (speechpid == 0) { +- SpeechHandler(speechpair, festival); +- exit(0); +- } +- +- close(speechpair[0]); +- } +- } +- + if (kismet_serv.Connect(guiport, guihost) < 0) { + fprintf(stderr, "FATAL: Could not connect to %s:%d.\n", guihost, guiport); + CatchShutdown(-1); +@@ -793,8 +464,6 @@ + + int num_networks = 0, num_packets = 0, num_noise = 0, num_dropped = 0; + +- time_t last_click = time(0); +- + fd_set read_set; + FD_ZERO(&read_set); + +@@ -876,10 +545,6 @@ + } + + if (pollret != 0) { +- if (pollret == CLIENT_ALERT) +- if (sound == 1) +- sound = PlaySound("alert"); +- + if (strlen(tcpcli->FetchStatus()) != 0) { + gui->WriteStatus(tcpcli->FetchStatus()); + // gui->DrawDisplay(); +@@ -888,12 +553,8 @@ + // The GPS only gets updated for the primary client + if (tcpcli == primary_client) { + if (tcpcli->FetchMode() == 0 && gpsmode != 0) { +- if (sound == 1 && gpsmode != -1) +- sound = PlaySound("gpslost"); + gpsmode = 0; + } else if (tcpcli->FetchMode() != 0 && gpsmode == 0) { +- if (sound == 1 && gpsmode != -1) +- sound = PlaySound("gpslock"); + gpsmode = 1; + } + } +@@ -901,28 +562,6 @@ + if (tcpcli->FetchDeltaNumNetworks() > 0) { + wireless_network *newnet = tcpcli->FetchLastNewNetwork(); + +- if (sound == 1 && newnet != lastspoken) { +- if (newnet->crypt_set && +- wav_map.find("new_wep") != wav_map.end()) +- sound = PlaySound("new_wep"); +- else +- sound = PlaySound("new"); +- } +- +- if (speech == 1 && newnet != lastspoken) { +- string text; +- +- if (newnet != NULL) { +- if (newnet->crypt_set) +- text = ExpandSpeechString(speech_sentence_encrypted, newnet, speech_encoding); +- else +- text = ExpandSpeechString(speech_sentence_unencrypted, newnet, speech_encoding); +- +- speech = SayText(text.c_str()); +- } +- } +- +- lastspoken = newnet; + } + + num_networks += tcpcli->FetchNumNetworks(); +@@ -930,17 +569,6 @@ + num_noise += tcpcli->FetchNumNoise(); + num_dropped += tcpcli->FetchNumDropped(); + +- if (tcpcli->FetchDeltaNumPackets() != 0) { +- if (time(0) - last_click >= decay && sound == 1) { +- if (tcpcli->FetchDeltaNumPackets() > tcpcli->FetchDeltaNumDropped()) { +- sound = PlaySound("traffic"); +- } else { +- sound = PlaySound("junktraffic"); +- } +- +- last_click = time(0); +- } +- } + } + } + } else { +diff -urN kismet-2005-04-R1.old/kismet_server.cc kismet-2005-04-R1.dev/kismet_server.cc +--- kismet-2005-04-R1.old/kismet_server.cc 2005-05-04 21:09:18.000000000 +0200 ++++ kismet-2005-04-R1.dev/kismet_server.cc 2005-05-04 21:23:01.000000000 +0200 +@@ -56,7 +56,6 @@ + #include "timetracker.h" + #include "alertracker.h" + +-#include "speech.h" + #include "tcpserver.h" + #include "server_globals.h" + #include "kismet_server.h" +@@ -98,7 +97,6 @@ + + FifoDumpFile fifodump; + TcpServer ui_server; +-int sound = -1; + packet_info last_info; + int decay; + channel_power channel_graph[CHANNEL_MAX]; +@@ -112,10 +110,8 @@ + macmap<wep_key_info *> bssid_wep_map; + + // Pipe file descriptor pairs and fd's +-int soundpair[2]; +-int speechpair[2]; + int chanpair[2]; +-pid_t soundpid = -1, speechpid = -1, chanpid = -1; ++pid_t chanpid = -1; + + // Past alerts + unsigned int max_alerts = 50; +@@ -177,16 +173,6 @@ + int tcpport = -1; + int tcpmax; + +-//const char *sndplay = NULL; +-string sndplay; +- +-const char *festival = NULL; +-int speech = -1; +-int speech_encoding = 0; +-string speech_sentence_encrypted, speech_sentence_unencrypted; +- +-map<string, string> wav_map; +- + int beacon_log = 1; + int phy_log = 1; + int mangle_log = 0; +@@ -349,12 +335,6 @@ + + #endif + +- // Kill our sound players +- if (soundpid > 0) +- kill(soundpid, 9); +- if (speechpid > 0) +- kill(speechpid, 9); +- + // Shut down the packet sources + sourcetracker.CloseSources(); + +@@ -365,227 +345,10 @@ + exit(0); + } + +-// Subprocess sound handler +-void SoundHandler(int *fds, const char *player, map<string, string> soundmap) { +- int read_sock = fds[0]; +- close(fds[1]); +- +- fd_set rset; +- +- char data[1024]; +- +- pid_t sndpid = -1; +- int harvested = 1; +- +- while (1) { +- FD_ZERO(&rset); +- FD_SET(read_sock, &rset); +- char *end; +- +- memset(data, 0, 1024); +- +- struct timeval tm; +- tm.tv_sec = 1; +- tm.tv_usec = 0; +- +- if (select(read_sock + 1, &rset, NULL, NULL, &tm) < 0) { +- if (errno != EINTR) { +- exit(1); +- } +- } +- +- if (harvested == 0) { +- // We consider a wait error to be a sign that the child pid died +- // so we flag it as harvested and keep on going +- pid_t harvestpid = waitpid(sndpid, NULL, WNOHANG); +- if (harvestpid == -1 || harvestpid == sndpid) +- harvested = 1; +- } +- +- if (FD_ISSET(read_sock, &rset)) { +- int ret; +- ret = read(read_sock, data, 1024); +- +- // We'll die off if we get a read error, and we'll let kismet on the +- // other side detact that it died +- if (ret <= 0 && (errno != EAGAIN && errno != EPIPE)) +- exit(1); +- +- if ((end = strstr(data, "\n")) == NULL) +- continue; +- +- end[0] = '\0'; +- } +- +- if (data[0] == '\0') +- continue; +- +- +- // If we've harvested the process, spawn a new one and watch it +- // instead. Otherwise, we just let go of the data we read +- if (harvested == 1) { +- // Only take the first line +- char *nl; +- if ((nl = strchr(data, '\n')) != NULL) +- *nl = '\0'; +- +- // Make sure it's shell-clean +- +- char snd[1024]; +- +- if (soundmap.size() == 0) +- snprintf(snd, 1024, "%s", data); +- if (soundmap.find(data) != soundmap.end()) +- snprintf(snd, 1024, "%s", soundmap[data].c_str()); +- else +- continue; +- +- char plr[1024]; +- snprintf(plr, 1024, "%s", player); +- +- harvested = 0; +- if ((sndpid = fork()) == 0) { +- // Suppress errors +- if (silent) { +- int nulfd = open("/dev/null", O_RDWR); +- dup2(nulfd, 1); +- dup2(nulfd, 2); +- } +- +- char * const echoarg[] = { plr, snd, NULL }; +- execve(echoarg[0], echoarg, NULL); +- } +- } +- data[0] = '\0'; +- } +-} +- +-// Subprocess speech handler +-void SpeechHandler(int *fds, const char *player) { +- int read_sock = fds[0]; +- close(fds[1]); +- +- fd_set rset; +- +- char data[1024]; +- +- pid_t sndpid = -1; +- int harvested = 1; +- +- while (1) { +- FD_ZERO(&rset); +- FD_SET(read_sock, &rset); +- //char *end; +- +- memset(data, 0, 1024); +- +- if (harvested == 0) { +- // We consider a wait error to be a sign that the child pid died +- // so we flag it as harvested and keep on going +- pid_t harvestpid = waitpid(sndpid, NULL, WNOHANG); +- if (harvestpid == -1 || harvestpid == sndpid) +- harvested = 1; +- } +- +- struct timeval tm; +- tm.tv_sec = 1; +- tm.tv_usec = 0; +- +- if (select(read_sock + 1, &rset, NULL, NULL, &tm) < 0) { +- if (errno != EINTR) { +- exit(1); +- } +- } +- +- if (FD_ISSET(read_sock, &rset)) { +- int ret; +- ret = read(read_sock, data, 1024); +- +- // We'll die off if we get a read error, and we'll let kismet on the +- // other side detact that it died +- if (ret <= 0 && (errno != EAGAIN && errno != EPIPE)) +- exit(1); +- +- data[ret] = '\0'; +- } +- +- if (data[0] == '\0') +- continue; +- +- // If we've harvested the process, spawn a new one and watch it +- // instead. Otherwise, we just let go of the data we read +- if (harvested == 1) { +- harvested = 0; +- if ((sndpid = fork()) == 0) { +- // Only take the first line +- char *nl; +- if ((nl = strchr(data, '\n')) != NULL) +- *nl = '\0'; +- +- // Make sure it's shell-clean +- MungeToShell(data, strlen(data)); +- char spk_call[1024]; +- snprintf(spk_call, 1024, "echo \"(SayText \\\"%s\\\")\" | %s >/dev/null 2>/dev/null", +- data, player); +- system(spk_call); +- +- exit(0); +- } +- } +- +- data[0] = '\0'; +- } +-} +- +- +-// Fork and run a system call to play a sound +-int PlaySound(string in_sound) { +- +- char snd[1024]; +- +- snprintf(snd, 1024, "%s\n", in_sound.c_str()); +- +- if (write(soundpair[1], snd, strlen(snd)) < 0) { +- char status[STATUS_MAX]; +- if (!silent) +- fprintf(stderr, "ERROR: Write error, closing sound pipe.\n"); +- snprintf(status, STATUS_MAX, "ERROR: Write error on sound pipe, closing sound connection"); +- NetWriteStatus(status); +- +- return 0; +- } +- +- return 1; +-} +- +-int SayText(string in_text) { +- +- char snd[1024]; +- +- snprintf(snd, 1024, "%s\n", in_text.c_str()); +- MungeToShell(snd, 1024); +- +- if (write(speechpair[1], snd, strlen(snd)) < 0) { +- char status[STATUS_MAX]; +- if (!silent) +- fprintf(stderr, "ERROR: Write error, closing speech pipe.\n"); +- snprintf(status, STATUS_MAX, "ERROR: Write error on speech pipe, closing speech connection"); +- NetWriteStatus(status); +- +- return 0; +- } +- +- return 1; +-} +- + void KisLocalAlert(const char *in_text) { + time_t now = time(0); + if (!silent) + fprintf(stderr, "ALERT %.24s %s\n", ctime(&now), in_text); +- +- if (sound == 1) +- sound = PlaySound("alert"); +- + } + + void KisLocalStatus(const char *in_status) { +@@ -842,15 +605,11 @@ + if (gpsret == 0 && gpsmode != 0) { + if (!silent || NetWriteStatus("Lost GPS signal.") == 0) + fprintf(stderr, "Lost GPS signal.\n"); +- if (sound == 1) +- sound = PlaySound("gpslost"); + + gpsmode = 0; + } else if (gpsret != 0 && gpsmode == 0) { + if (!silent || NetWriteStatus("Acquired GPS signal.") == 0) + fprintf(stderr, "Acquired GPS signal.\n"); +- if (sound == 1) +- sound = PlaySound("gpslock"); + + gpsmode = 1; + } +@@ -1533,69 +1292,6 @@ + legal_ipblock_vec.push_back(ipb); + } + +- // Process sound stuff +- if (conf->FetchOpt("sound") == "true" && sound == -1) { +- if (conf->FetchOpt("soundplay") != "") { +- sndplay = conf->FetchOpt("soundplay"); +- +- if (conf->FetchOpt("soundopts") != "") +- sndplay += " " + conf->FetchOpt("soundopts"); +- +- sound = 1; +- +- if (conf->FetchOpt("sound_new") != "") +- wav_map["new"] = conf->FetchOpt("sound_new"); +- if (conf->FetchOpt("sound_new_wep") != "") +- wav_map["new_wep"] = conf->FetchOpt("sound_new_wep"); +- if (conf->FetchOpt("sound_traffic") != "") +- wav_map["traffic"] = conf->FetchOpt("sound_traffic"); +- if (conf->FetchOpt("sound_junktraffic") != "") +- wav_map["junktraffic"] = conf->FetchOpt("sound_traffic"); +- if (conf->FetchOpt("sound_gpslock") != "") +- wav_map["gpslock"] = conf->FetchOpt("sound_gpslock"); +- if (conf->FetchOpt("sound_gpslost") != "") +- wav_map["gpslost"] = conf->FetchOpt("sound_gpslost"); +- if (conf->FetchOpt("sound_alert") != "") +- wav_map["alert"] = conf->FetchOpt("sound_alert"); +- +- } else { +- fprintf(stderr, "ERROR: Sound alerts enabled but no sound playing binary specified.\n"); +- sound = 0; +- } +- } else if (sound == -1) +- sound = 0; +- +- /* Added by Shaw Innes 17/2/02 */ +- /* Modified by Andrew Etter 15/9/02 */ +- if (conf->FetchOpt("speech") == "true" && speech == -1) { +- if (conf->FetchOpt("festival") != "") { +- festival = strdup(conf->FetchOpt("festival").c_str()); +- speech = 1; +- +- string speechtype = conf->FetchOpt("speech_type"); +- +- if (!strcasecmp(speechtype.c_str(), "nato")) +- speech_encoding = SPEECH_ENCODING_NATO; +- else if (!strcasecmp(speechtype.c_str(), "spell")) +- speech_encoding = SPEECH_ENCODING_SPELL; +- else +- speech_encoding = SPEECH_ENCODING_NORMAL; +- +- // Make sure we have encrypted text lines +- if (conf->FetchOpt("speech_encrypted") == "" || conf->FetchOpt("speech_unencrypted") == "") { +- fprintf(stderr, "ERROR: Speech request but speech_encrypted or speech_unencrypted line missing.\n"); +- speech = 0; +- } +- +- speech_sentence_encrypted = conf->FetchOpt("speech_encrypted"); +- speech_sentence_unencrypted = conf->FetchOpt("speech_unencrypted"); +- } else { +- fprintf(stderr, "ERROR: Speech alerts enabled but no path to festival has been specified.\n"); +- speech = 0; +- } +- } else if (speech == -1) +- speech = 0; +- + if (conf->FetchOpt("writeinterval") != "") { + if (sscanf(conf->FetchOpt("writeinterval").c_str(), "%d", &datainterval) != 1) { + fprintf(stderr, "FATAL: Illegal config file value for data interval.\n"); +@@ -1615,45 +1311,6 @@ + fprintf(stderr, "WARNING: No client_manuf file specified. Client manufacturers will not be detected.\n"); + } + +- // Fork and find the sound options +- if (sound) { +- if (pipe(soundpair) == -1) { +- fprintf(stderr, "WARNING: Unable to create pipe for audio. Disabling sound.\n"); +- sound = 0; +- } else { +- soundpid = fork(); +- +- if (soundpid < 0) { +- fprintf(stderr, "WARNING: Unable to fork for audio. Disabling sound.\n"); +- sound = 0; +- } else if (soundpid == 0) { +- SoundHandler(soundpair, sndplay.c_str(), wav_map); +- exit(0); +- } +- +- close(soundpair[0]); +- } +- } +- +- if (speech) { +- if (pipe(speechpair) == -1) { +- fprintf(stderr, "WARNING: Unable to create pipe for speech. Disabling speech.\n"); +- speech = 0; +- } else { +- speechpid = fork(); +- +- if (speechpid < 0) { +- fprintf(stderr, "WARNING: Unable to fork for speech. Disabling speech.\n"); +- speech = 0; +- } else if (speechpid == 0) { +- SpeechHandler(speechpair, festival); +- exit(0); +- } +- +- close(speechpair[0]); +- } +- } +- + // Grab the filtering + string filter_bit; + +@@ -2172,7 +1829,6 @@ + break; + case 'q': + // Quiet +- sound = 0; + break; + case 'v': + // version +@@ -2781,7 +2437,6 @@ + snprintf(status, 1024, "%s", TIMESTAMP); + kdata.timestamp = status; + +- time_t last_click = 0; + int num_networks = 0, num_packets = 0, num_noise = 0, num_dropped = 0; + + +@@ -2944,38 +2599,9 @@ + + tracker.ProcessPacket(info); + +- if (tracker.FetchNumNetworks() > num_networks) { +- if (sound == 1) +- if (info.wep && wav_map.find("new_wep") != wav_map.end()) +- sound = PlaySound("new_wep"); +- else +- sound = PlaySound("new"); +- if (speech == 1) { +- string text; +- +- if (info.wep) +- text = ExpandSpeechString(speech_sentence_encrypted, &info, +- speech_encoding); +- else +- text = ExpandSpeechString(speech_sentence_unencrypted, +- &info, speech_encoding); +- +- speech = SayText(MungeToShell(text).c_str()); +- } +- } + num_networks = tracker.FetchNumNetworks(); + + if (tracker.FetchNumPackets() != num_packets) { +- if (cur_time - last_click >= decay && sound == 1) { +- if (tracker.FetchNumPackets() - num_packets > +- tracker.FetchNumDropped() + localdropnum - num_dropped) { +- sound = PlaySound("traffic"); +- } else { +- sound = PlaySound("junktraffic"); +- } +- +- last_click = cur_time; +- } + + num_packets = tracker.FetchNumPackets(); + num_noise = tracker.FetchNumNoise(); +diff -urN kismet-2005-04-R1.old/kismet_server.h kismet-2005-04-R1.dev/kismet_server.h +--- kismet-2005-04-R1.old/kismet_server.h 2005-04-03 07:33:42.000000000 +0200 ++++ kismet-2005-04-R1.dev/kismet_server.h 2005-05-04 21:17:50.000000000 +0200 +@@ -33,10 +33,6 @@ + void handle_command(TcpServer *tcps, client_command *cc); + int NetWriteStatus(const char *in_status); + void NetWriteInfo(); +-int SayText(string in_text); +-int PlaySound(string in_sound); +-void SpeechHandler(int *fds, const char *player); +-void SoundHandler(int *fds, const char *player, map<string, string> soundmap); + void ProtocolAlertEnable(int in_fd); + void ProtocolNetworkEnable(int in_fd); + void ProtocolClientEnable(int in_fd); +diff -urN kismet-2005-04-R1.old/panelfront.cc kismet-2005-04-R1.dev/panelfront.cc +--- kismet-2005-04-R1.old/panelfront.cc 2005-04-03 07:33:42.000000000 +0200 ++++ kismet-2005-04-R1.dev/panelfront.cc 2005-05-04 21:19:03.000000000 +0200 +@@ -420,8 +420,6 @@ + + //cutoff = 0; + +- muted = 0; +- + // Push blanks into the RRD history vector + packet_history.reserve(60 * 5); + for (unsigned int x = 0; x < (60 * 5); x++) +@@ -678,8 +676,6 @@ + + zoomed = 0; + +- muted = 0; +- + if (colorkilled) + WriteStatus("Terminal cannot support colors, turning off color options."); + +diff -urN kismet-2005-04-R1.old/panelfront.h kismet-2005-04-R1.dev/panelfront.h +--- kismet-2005-04-R1.old/panelfront.h 2005-04-03 07:33:42.000000000 +0200 ++++ kismet-2005-04-R1.dev/panelfront.h 2005-05-04 21:18:48.000000000 +0200 +@@ -81,8 +81,6 @@ + extern char *KismetIntroText[]; + + // These are in the kismet_curses.cc main code +-extern int sound; +-extern int speech; + extern unsigned int metric; + + class PanelFront : public Frontend { +@@ -383,10 +381,6 @@ + + int hsize, vsize; + +- int old_sound; +- int old_speech; +- int muted; +- + vector<int> packet_history; + + float lat, lon, spd, alt, heading; +diff -urN kismet-2005-04-R1.old/panelfront_input.cc kismet-2005-04-R1.dev/panelfront_input.cc +--- kismet-2005-04-R1.old/panelfront_input.cc 2005-04-03 07:33:42.000000000 +0200 ++++ kismet-2005-04-R1.dev/panelfront_input.cc 2005-05-04 21:18:19.000000000 +0200 +@@ -639,21 +639,6 @@ + } + + void PanelFront::MuteToggle() { +- if (muted) { +- speech = old_speech; +- sound = old_sound; +- muted = 0; +- WriteStatus("Restoring sound"); +- } else if (sound != 0 || speech != 0) { +- old_speech = speech; +- old_sound = sound; +- sound = 0; +- speech = 0; +- muted = 1; +- WriteStatus("Muting sound"); +- } else if (sound == 0 && speech == 0) { +- WriteStatus("Sound not enabled."); +- } + } + + int PanelFront::AlertInput(void *in_window, int in_chr) { |