static void hostmonhelp(void) { move(LINES - 1, 1); scrollkeyhelp(); sortkeyhelp(); stdexitkeyhelp(); }
static void initiftab(struct iftab *table) { table->borderwin = newwin(LINES - 2, COLS, 1, 0); table->borderpanel = new_panel(table->borderwin); move(LINES - 1, 1); scrollkeyhelp(); stdexitkeyhelp(); wattrset(table->borderwin, BOXATTR); tx_box(table->borderwin, ACS_VLINE, ACS_HLINE); labelstats(table->borderwin); table->statwin = newwin(LINES - 4, COLS - 2, 2, 1); table->statpanel = new_panel(table->statwin); tx_stdwinset(table->statwin); wtimeout(table->statwin, -1); wattrset(table->statwin, STDATTR); tx_colorwin(table->statwin); wattrset(table->statwin, BOXATTR); wmove(table->borderwin, LINES - 3, 32 * COLS / 80); wprintw(table->borderwin, " Total, IP, NonIP, and BadIP are packet counts "); }
int start_tcp_analysis_mon(struct SETTINGS* mySettings) { WINDOW * statwin; WINDOW * msgwin; WINDOW * scanwin; WINDOW * breakwin; WINDOW * listwin; WINDOW * capturewin; PANEL * statpanel; PANEL * msgpanel; PANEL * scanpanel; PANEL * breakpanel; PANEL * listpanel; PANEL * capturepanel; int exitloop; int first_instance = 1; int paused = 0; // used to pause screen int ch; int break_pos = 0; // used to mark breakdown position int list_pos = 1; // used to mark list position int nodelist_win = 1; int curr_view = 0; int select_node = 0; int node_count = 0; // tracks whether there's change char elapsed[10]; struct timeval tv_start; struct timeval tv_curr; struct timeval tv_old; struct timeval tv_new; print_tcp_stat_screen(&statwin,&statpanel, mySettings->card_type, mySettings->interface); print_tcp_activity_overview_labels(&scanwin,&scanpanel, curr_view); print_tcp_breakdown_labels(&breakwin,&breakpanel, curr_view); print_tcp_nodelist_labels(&listwin,&listpanel); if (mySettings->capture_mode == CAPTURE_MODE_PLAYBACK) make_capture_controls(&capturewin, &capturepanel); update_panels(); doupdate(); move(LINES - 1, 1); pausekeyhelp(); viewkeyhelp(); changewinkeyhelp(); scrollkeyhelp(); stdexitkeyhelp(); update_panels(); doupdate(); leaveok(statwin, TRUE); exitloop = 0; /** initialize listwin to have ACTIVE key focus **/ reset_active_win(listwin, 1); gettimeofday(&tv_start,NULL); tv_old = tv_start; /* * Data Display Loop */ while ((!exitloop) && (!sysexit)) { ch = ERR; if (check_for_keystroke() != ERR) ch = wgetch(statwin); if (ch != ERR) { switch (ch) { case KEY_UP: if (!nodelist_win) scrollbreakdownwin(SCROLLUP, select_node, &break_pos); else{ scrollnodelistwin(listwin, SCROLLUP, &select_node, &list_pos); /**after changing wireless node, reset the breakdown window **/ del_panel(breakpanel); delwin(breakwin); update_panels(); doupdate(); print_tcp_breakdown_labels(&breakwin,&breakpanel, curr_view); if (nodelist_win){ reset_active_win(breakwin,0); reset_active_win(listwin,1); } else{ reset_active_win(listwin,0); reset_active_win(breakwin,1); } break_pos = 0; } break; case KEY_DOWN: if (!nodelist_win) scrollbreakdownwin(SCROLLDOWN, select_node, &break_pos); else{ scrollnodelistwin(listwin, SCROLLDOWN, &select_node, &list_pos); /**after changing wireless node, reset the breakdown window **/ del_panel(breakpanel); delwin(breakwin); update_panels(); doupdate(); print_tcp_breakdown_labels(&breakwin,&breakpanel, curr_view); if (nodelist_win){ reset_active_win(breakwin,0); reset_active_win(listwin,1); } else{ reset_active_win(listwin,0); reset_active_win(breakwin,1); } break_pos = 0; } break; case 12: case 'l': case 'L': refresh_screen(); break; case 'p': case 'P': if (mySettings->capture_mode == CAPTURE_MODE_PLAYBACK){ parse_capture_key(mySettings, ch); break; } switch (paused) { case 0: show_paused_win(&msgwin,&msgpanel, "Analysis PAUSED...", "P-continue | X-Exit"); update_panels(); doupdate(); paused = 1; break; case 1: del_panel(msgpanel); delwin(msgwin); update_panels(); doupdate(); refresh_screen(); paused = 0; break; } break; case 'v': case 'V': del_panel(breakpanel); delwin(breakwin); if (curr_view == PERF_BANDWIDTH){ curr_view = CONNECTIONS; } else{ curr_view++; } print_tcp_breakdown_labels(&breakwin,&breakpanel, curr_view); if (nodelist_win){ reset_active_win(breakwin,0); reset_active_win(listwin,1); } else{ reset_active_win(listwin,0); reset_active_win(breakwin,1); } update_panels(); doupdate(); break; case 'w': case 'W': if (nodelist_win){ nodelist_win = 0; reset_active_win(listwin,0); reset_active_win(breakwin,1); } else{ nodelist_win = 1; reset_active_win(breakwin,0); reset_active_win(listwin,1); } break; case 'Q': case 'q': case 'X': case 'x': case 24: case 27: if (paused){ del_panel(msgpanel); delwin(msgwin); } exitloop = 1; break; default: if (mySettings->capture_mode == CAPTURE_MODE_PLAYBACK){ parse_capture_key(mySettings, ch); } break; } } if(!paused){ gettimeofday(&tv_new, NULL); if (GUI_DEBUG) fprintf(stderr,"doing packet stuff\n"); /** * if it is first instance, and we haven't found a base * station yet, then just loop on, waiting for perhaps some * keystroke that will find a base channel for us... **/ if (first_instance){ if (get_detailed_snapshot()->bss_list_top != NULL){ first_instance = 0; } else{ continue; } } print_tcp_activity_overview_results(scanwin, select_node, curr_view); print_tcp_breakdown_results(breakwin, curr_view, select_node, break_pos); print_tcp_nodelist_results(listwin, &select_node, list_pos); if (get_detailed_snapshot()->bss_list_top->num != node_count){ del_panel(breakpanel); delwin(breakwin); del_panel(listpanel); delwin(listwin); if (mySettings->capture_mode == CAPTURE_MODE_PLAYBACK){ del_panel(capturepanel); delwin(capturewin); } update_panels(); doupdate(); print_tcp_breakdown_labels(&breakwin,&breakpanel, curr_view); print_tcp_nodelist_labels(&listwin,&listpanel); if (nodelist_win){ reset_active_win(breakwin,0); reset_active_win(listwin,1); } else{ reset_active_win(listwin,0); reset_active_win(breakwin,1); } if (mySettings->capture_mode == CAPTURE_MODE_PLAYBACK) make_capture_controls(&capturewin, &capturepanel); node_count = get_detailed_snapshot()->bss_list_top->num; if (node_count == 1){ del_panel(scanpanel); delwin(scanwin); update_panels(); doupdate(); print_tcp_activity_overview_labels(&scanwin,&scanpanel, curr_view); select_node = 0; } } if (mySettings->capture_mode == CAPTURE_MODE_PLAYBACK) print_capture_update(capturewin, mySettings); wattrset(scanwin, HIGHATTR); gettimeofday(&tv_curr, NULL); get_elapsed_time(&tv_curr, &tv_start, elapsed); mvwprintw(scanwin, LINES - 7, 15, "%s", elapsed); } } // end loop del_panel(statpanel); delwin(statwin); del_panel(scanpanel); delwin(scanwin); del_panel(breakpanel); delwin(breakwin); del_panel(listpanel); delwin(listwin); if (mySettings->capture_mode == CAPTURE_MODE_PLAYBACK){ del_panel(capturepanel); delwin(capturewin); } update_panels(); doupdate(); if (sysexit){ if (paused){ del_panel(msgpanel); delwin(msgwin); } sysexit = 0; return (0); } else{ return (1); } }
void start_ids_mon(char *iface) { WINDOW *statwin; PANEL *statpanel; WINDOW *overallwin; PANEL *overallpanel; WINDOW *helpwin; PANEL *helppanel; /** stat display information **/ int stat_page = 0; int ch; int exitloop; int paused = 0; ids_t *ids_info = NULL; MAX_STAT_ROW = LINES * 0.6 - 2; overallwin = newwin(LINES -2, COLS, 1, 0); overallpanel = new_panel(overallwin); stdwinset(overallwin); wtimeout(overallwin, -1); wattrset(overallwin, BOXATTR); colorwin(overallwin); box(overallwin, ACS_VLINE, ACS_HLINE); /** make the ids list based on mac addresses **/ statwin = newwin(LINES * 0.6, COLS, 1, 0); statpanel = new_panel(statwin); stdwinset(statwin); wtimeout(statwin, -1); wattrset(statwin, BOXATTR); colorwin(statwin); box(statwin, ACS_VLINE, ACS_HLINE); wmove(statwin, 0, 1); wprintw(statwin, " IDS Statistics for %s ", iface); print_ids_labels(statwin); print_ids_details(statwin, NULL, 0); /** make ids help window **/ helpwin = newwin(LINES * 0.4 - 1, COLS, LINES * 0.6 + 1, 0); helppanel = new_panel(helpwin); wattrset(helpwin, BOXATTR); colorwin(helpwin); box(helpwin, ACS_VLINE, ACS_HLINE); print_help_win(helpwin); /** make the bottom key binding panel **/ move(LINES - 1, 1); scrollkeyhelp(); stdexitkeyhelp(); update_panels(); doupdate(); leaveok(statwin, TRUE); exitloop = 1; /** * Data-gathering loop */ while(!exitloop){ ch = ERR; if (check_for_keystroke() != ERR) ch = wgetch(statwin); if (ch != ERR) { switch (ch) { case KEY_UP: if (stat_page > 0){ stat_page --; colorwin(statwin); } break; case KEY_DOWN: if (((stat_page +1) * MAX_STAT_ROW) < ids_info->node_count){ stat_page ++; colorwin(statwin); } break; case KEY_PPAGE: case '-': //scroll_nodewin(nodewin, SCROLLDOWN); // pageethwin(nodewin, SCROLLDOWN); break; case KEY_NPAGE: case ' ': //scroll_nodewin(nodewin, SCROLLUP); // pageethwin(nodewin, SCROLLUP); break; case 'p': case 'P': switch (paused) { case 0: paused = 1; break; case 1: paused = 0; break; } // markactive(curwin, nodeborder, paused); update_panels(); doupdate(); break; case 12: case 'l': case 'L': refresh_screen(); break; case 'Q': case 'q': case 'X': case 'x': case 24: case 27: exitloop = 1; break; default: break; } } if (!paused){ // blah do stuff print_ids_details(statwin, ids_info, stat_page); } } // end loop del_panel(statpanel); delwin(statwin); del_panel(helppanel); delwin(helpwin); del_panel(overallpanel); delwin(overallwin); update_panels(); doupdate(); }