/* * display the statistics windows */ static void curses_show_stats(void) { DEBUG_MSG("curses_show_stats"); /* if the object already exist, set the focus to it */ if (wdg_stats) { wdg_set_focus(wdg_stats); return; } wdg_create_object(&wdg_stats, WDG_WINDOW, WDG_OBJ_WANT_FOCUS); wdg_set_title(wdg_stats, "Statistics:", WDG_ALIGN_LEFT); wdg_set_size(wdg_stats, 1, 2, 70, 21); wdg_set_color(wdg_stats, WDG_COLOR_SCREEN, EC_COLOR); wdg_set_color(wdg_stats, WDG_COLOR_WINDOW, EC_COLOR); wdg_set_color(wdg_stats, WDG_COLOR_BORDER, EC_COLOR_BORDER); wdg_set_color(wdg_stats, WDG_COLOR_FOCUS, EC_COLOR_FOCUS); wdg_set_color(wdg_stats, WDG_COLOR_TITLE, EC_COLOR_TITLE); wdg_draw_object(wdg_stats); wdg_set_focus(wdg_stats); /* display the stats */ refresh_stats(); /* add the callback on idle to refresh the stats */ wdg_add_idle_callback(refresh_stats); /* add the destroy callback */ wdg_add_destroy_key(wdg_stats, CTRL('Q'), curses_stop_stats); }
void curses_sniff_live(void) { wdg_t *menu; DEBUG_MSG("curses_sniff_live"); wdg_create_object(&menu, WDG_MENU, WDG_OBJ_WANT_FOCUS | WDG_OBJ_ROOT_OBJECT); wdg_set_title(menu, GBL_VERSION, WDG_ALIGN_RIGHT); wdg_set_color(menu, WDG_COLOR_SCREEN, EC_COLOR); wdg_set_color(menu, WDG_COLOR_WINDOW, EC_COLOR_MENU); wdg_set_color(menu, WDG_COLOR_FOCUS, EC_COLOR_FOCUS); wdg_set_color(menu, WDG_COLOR_TITLE, EC_COLOR_TITLE); /* add the menu from external files */ wdg_menu_add(menu, menu_start); wdg_menu_add(menu, menu_targets); if (GBL_SNIFF->type != SM_BRIDGED) wdg_menu_add(menu, menu_hosts); wdg_menu_add(menu, menu_view); if (GBL_SNIFF->type != SM_BRIDGED) wdg_menu_add(menu, menu_mitm); wdg_menu_add(menu, menu_filters); wdg_menu_add(menu, menu_logging); #ifdef HAVE_PLUGINS wdg_menu_add(menu, menu_plugins); #endif wdg_menu_add(menu, menu_help); wdg_draw_object(menu); /* repaint the whole screen */ wdg_redraw_all(); wdg_set_focus(menu); /* add the message flush callback */ wdg_add_idle_callback(curses_flush_msg); /* * give the control to the event dispatcher * with the emergency exit key 'Q' */ wdg_events_handler(CTRL('X')); wdg_destroy_object(&menu); }
/* * the auto-refreshing list of connections */ void curses_show_connections(void) { DEBUG_MSG("curses_show_connections"); /* if the object already exist, set the focus to it */ if (wdg_connections) { wdg_set_focus(wdg_connections); return; } wdg_create_object(&wdg_connections, WDG_DYNLIST, WDG_OBJ_WANT_FOCUS); wdg_set_title(wdg_connections, "Live connections:", WDG_ALIGN_LEFT); wdg_set_size(wdg_connections, 1, 2, -1, SYSMSG_WIN_SIZE - 1); wdg_set_color(wdg_connections, WDG_COLOR_SCREEN, EC_COLOR); wdg_set_color(wdg_connections, WDG_COLOR_WINDOW, EC_COLOR); wdg_set_color(wdg_connections, WDG_COLOR_BORDER, EC_COLOR_BORDER); wdg_set_color(wdg_connections, WDG_COLOR_FOCUS, EC_COLOR_FOCUS); wdg_set_color(wdg_connections, WDG_COLOR_TITLE, EC_COLOR_TITLE); wdg_draw_object(wdg_connections); wdg_set_focus(wdg_connections); /* set the list print callback */ wdg_dynlist_print_callback(wdg_connections, conntrack_print); /* set the select callback */ wdg_dynlist_select_callback(wdg_connections, curses_connection_data); /* add the callback on idle to refresh the profile list */ wdg_add_idle_callback(refresh_connections); /* add the destroy callback */ wdg_add_destroy_key(wdg_connections, CTRL('Q'), curses_kill_connections); wdg_dynlist_add_callback(wdg_connections, 'd', curses_connection_detail); wdg_dynlist_add_callback(wdg_connections, 'k', curses_connection_kill); wdg_dynlist_add_callback(wdg_connections, 'x', curses_connection_purge); wdg_dynlist_add_callback(wdg_connections, ' ', curses_connection_help); }