/* * stop all the mitm attack(s) */ static void curses_mitm_stop(void) { wdg_t *dlg; DEBUG_MSG("curses_mitm_stop"); /* create the dialog */ wdg_create_object(&dlg, WDG_DIALOG, WDG_OBJ_WANT_FOCUS); wdg_set_color(dlg, WDG_COLOR_SCREEN, EC_COLOR); wdg_set_color(dlg, WDG_COLOR_WINDOW, EC_COLOR); wdg_set_color(dlg, WDG_COLOR_FOCUS, EC_COLOR_FOCUS); wdg_set_color(dlg, WDG_COLOR_TITLE, EC_COLOR_TITLE); wdg_dialog_text(dlg, WDG_NO_BUTTONS, "Stopping the mitm attack..."); wdg_draw_object(dlg); wdg_set_focus(dlg); wdg_update_screen(); /* stop the mitm process */ mitm_stop(); wdg_destroy_object(&dlg); curses_message("MITM attack(s) stopped"); }
/* * implement the progress bar */ static int curses_progress(char *title, int value, int max) { static wdg_t *per = NULL; int ret; /* the first time, create the object */ if (per == NULL) { wdg_create_object(&per, WDG_PERCENTAGE, WDG_OBJ_WANT_FOCUS | WDG_OBJ_FOCUS_MODAL); wdg_set_title(per, title, WDG_ALIGN_CENTER); wdg_set_color(per, WDG_COLOR_SCREEN, EC_COLOR); wdg_set_color(per, WDG_COLOR_WINDOW, EC_COLOR); wdg_set_color(per, WDG_COLOR_FOCUS, EC_COLOR_FOCUS); wdg_set_color(per, WDG_COLOR_TITLE, EC_COLOR_MENU); wdg_draw_object(per); wdg_set_focus(per); } /* the subsequent calls have to only update the object */ ret = wdg_percentage_set(per, value, max); wdg_update_screen(); switch (ret) { case WDG_PERCENTAGE_FINISHED: /* * the object is self-destructing... * so we have only to set the pointer to null */ per = NULL; return UI_PROGRESS_FINISHED; break; case WDG_PERCENTAGE_INTERRUPTED: /* * the user has requested to stop the current task. * the percentage was self-destructed, we have to * set the pointer to null and return the proper value */ per = NULL; return UI_PROGRESS_INTERRUPTED; break; case WDG_PERCENTAGE_UPDATED: return UI_PROGRESS_UPDATED; break; } return UI_PROGRESS_UPDATED; }