ec_curses_mitm.c (ettercap-0.8.3) | : | ec_curses_mitm.c (ettercap-0.8.3.1) | ||
---|---|---|---|---|
skipping to change at line 80 | skipping to change at line 80 | |||
{NULL, 0, NULL, NULL}, | {NULL, 0, NULL, NULL}, | |||
}; | }; | |||
static wdg_t *wdg_redirect = NULL; | static wdg_t *wdg_redirect = NULL; | |||
static struct wdg_list *wdg_redirect_elements = NULL; | static struct wdg_list *wdg_redirect_elements = NULL; | |||
static struct wdg_list *wdg_redirect_services = NULL; | static struct wdg_list *wdg_redirect_services = NULL; | |||
static size_t n_redir = 0; | static size_t n_redir = 0; | |||
static size_t n_serv = 0; | static size_t n_serv = 0; | |||
static char redir_proto[5] = "ipv4"; | static char redir_proto[5] = "ipv4"; | |||
static char redir_name[50] = "ftps"; | static char redir_name[50] = "ftps"; | |||
static char redir_source[MAX_ASCII_ADDR_LEN] = "0.0.0.0/0"; | ||||
static char redir_destination[MAX_ASCII_ADDR_LEN] = "0.0.0.0/0"; | static char redir_destination[MAX_ASCII_ADDR_LEN] = "0.0.0.0/0"; | |||
/*******************************************/ | /*******************************************/ | |||
static void curses_arp_poisoning(void) | static void curses_arp_poisoning(void) | |||
{ | { | |||
char *method = "arp:"; | char *method = "arp:"; | |||
char *default_param = "remote"; | char *default_param = "remote"; | |||
size_t len = strlen(method); | size_t len = strlen(method); | |||
skipping to change at line 275 | skipping to change at line 274 | |||
wdg_create_object(&wdg_input, WDG_INPUT, | wdg_create_object(&wdg_input, WDG_INPUT, | |||
WDG_OBJ_WANT_FOCUS | WDG_OBJ_FOCUS_MODAL); | WDG_OBJ_WANT_FOCUS | WDG_OBJ_FOCUS_MODAL); | |||
wdg_set_color(wdg_input, WDG_COLOR_SCREEN, EC_COLOR); | wdg_set_color(wdg_input, WDG_COLOR_SCREEN, EC_COLOR); | |||
wdg_set_color(wdg_input, WDG_COLOR_WINDOW, EC_COLOR); | wdg_set_color(wdg_input, WDG_COLOR_WINDOW, EC_COLOR); | |||
wdg_set_color(wdg_input, WDG_COLOR_FOCUS, EC_COLOR_FOCUS); | wdg_set_color(wdg_input, WDG_COLOR_FOCUS, EC_COLOR_FOCUS); | |||
wdg_set_color(wdg_input, WDG_COLOR_TITLE, EC_COLOR_MENU); | wdg_set_color(wdg_input, WDG_COLOR_TITLE, EC_COLOR_MENU); | |||
wdg_input_size(wdg_input, strlen("Destination: ") + | wdg_input_size(wdg_input, strlen("Destination: ") + | |||
MAX_ASCII_ADDR_LEN, 6); | MAX_ASCII_ADDR_LEN, 6); | |||
wdg_input_add(wdg_input, 1, 1, "IP Version: ", redir_proto, 5, 1); | wdg_input_add(wdg_input, 1, 1, "IP Version: ", redir_proto, 5, 1); | |||
wdg_input_add(wdg_input, 1, 2, "Source: ", redir_source, | wdg_input_add(wdg_input, 1, 3, "Server IP: ", redir_destination, | |||
MAX_ASCII_ADDR_LEN, 1); | ||||
wdg_input_add(wdg_input, 1, 3, "Destination: ", redir_destination, | ||||
MAX_ASCII_ADDR_LEN, 1); | MAX_ASCII_ADDR_LEN, 1); | |||
wdg_input_add(wdg_input, 1, 4, "Service: ", redir_name, 10, 1); | wdg_input_add(wdg_input, 1, 4, "Service: ", redir_name, 10, 1); | |||
wdg_input_set_callback(wdg_input, curses_sslredir_add_rule); | wdg_input_set_callback(wdg_input, curses_sslredir_add_rule); | |||
wdg_draw_object(wdg_input); | wdg_draw_object(wdg_input); | |||
wdg_set_focus(wdg_input); | wdg_set_focus(wdg_input); | |||
} | } | |||
skipping to change at line 353 | skipping to change at line 350 | |||
snprintf(services_available+len, new_len, " * %s\n", | snprintf(services_available+len, new_len, " * %s\n", | |||
wdg_redirect_services[i].desc); | wdg_redirect_services[i].desc); | |||
} | } | |||
curses_message(services_available); | curses_message(services_available); | |||
SAFE_FREE(services_available); | SAFE_FREE(services_available); | |||
return; | return; | |||
} | } | |||
/* do the actual redirect insertion */ | /* do the actual redirect insertion */ | |||
ret = ec_redirect(EC_REDIR_ACTION_INSERT, se->name, proto, | ret = ec_redirect(EC_REDIR_ACTION_INSERT, se->name, proto, | |||
redir_source, redir_destination, se->from_port, se->to_port); | redir_destination, se->from_port, se->to_port); | |||
/* inform user if redirect insertion wasn't successful */ | /* inform user if redirect insertion wasn't successful */ | |||
if (ret != E_SUCCESS) { | if (ret != E_SUCCESS) { | |||
DEBUG_MSG("calling ec_redirect('%s', '%s', '%s', '%s', '%s', '%d', '%d'" | DEBUG_MSG("calling ec_redirect('%s', '%s', '%s', '%s', '%d', '%d'" | |||
" failed", "insert", se->name, redir_proto, | " failed", "insert", se->name, redir_proto, | |||
redir_source, redir_destination, se->from_port, se->to_port); | redir_destination, se->from_port, se->to_port); | |||
INSTANT_USER_MSG("Inserting redirect for %s/%s failed!\n", | INSTANT_USER_MSG("Inserting redirect for %s/%s failed!\n", | |||
redir_proto, redir_name); | redir_proto, redir_name); | |||
} | } | |||
/* update redirect list */ | /* update redirect list */ | |||
curses_sslredir_update(); | curses_sslredir_update(); | |||
} | } | |||
/* | /* | |||
* callback to delete a certain redirect rule | * callback to delete a certain redirect rule | |||
skipping to change at line 385 | skipping to change at line 382 | |||
DEBUG_MSG("curses_sslredir_del()"); | DEBUG_MSG("curses_sslredir_del()"); | |||
/* prevent the selection when the list is empty */ | /* prevent the selection when the list is empty */ | |||
if (dummy == NULL) | if (dummy == NULL) | |||
return; | return; | |||
/* remove the redirect */ | /* remove the redirect */ | |||
re = (struct redir_entry *)dummy; | re = (struct redir_entry *)dummy; | |||
ret = ec_redirect(EC_REDIR_ACTION_REMOVE, re->name, re->proto, | ret = ec_redirect(EC_REDIR_ACTION_REMOVE, re->name, re->proto, | |||
re->source, re->destination, re->from_port, re->to_port); | re->destination, re->from_port, re->to_port); | |||
if (ret != E_SUCCESS) { | if (ret != E_SUCCESS) { | |||
DEBUG_MSG("calling ec_redirect('%s', '%s', '%s', '%s', '%s', '%d', '%d'" | DEBUG_MSG("calling ec_redirect('%s', '%s', '%s', '%s', '%d', '%d'" | |||
" failed", "remove", re->name, | " failed", "remove", re->name, | |||
(re->proto == EC_REDIR_PROTO_IPV4 ? "ipv4" : "ipv6"), | (re->proto == EC_REDIR_PROTO_IPV4 ? "ipv4" : "ipv6"), | |||
re->source, re->destination, re->from_port, re->to_port); | re->destination, re->from_port, re->to_port); | |||
INSTANT_USER_MSG("Removing redirect for %s/%s failed!\n", | INSTANT_USER_MSG("Removing redirect for %s/%s failed!\n", | |||
(re->proto == EC_REDIR_PROTO_IPV4 ? "ipv4" : "ipv6"), re->name); | (re->proto == EC_REDIR_PROTO_IPV4 ? "ipv4" : "ipv6"), re->name); | |||
return; | return; | |||
} | } | |||
curses_sslredir_update(); | curses_sslredir_update(); | |||
} | } | |||
skipping to change at line 429 | skipping to change at line 426 | |||
/* services are only gathered once */ | /* services are only gathered once */ | |||
if (wdg_redirect_services != NULL) | if (wdg_redirect_services != NULL) | |||
return; | return; | |||
/* walk through the registered services */ | /* walk through the registered services */ | |||
res = ec_walk_redirect_services(&curses_sslredir_add_service); | res = ec_walk_redirect_services(&curses_sslredir_add_service); | |||
if (res == -E_NOTFOUND) { | if (res == -E_NOTFOUND) { | |||
SAFE_CALLOC(wdg_redirect_elements, 1, sizeof(struct wdg_list)); | SAFE_CALLOC(wdg_redirect_elements, 1, sizeof(struct wdg_list)); | |||
wdg_redirect_elements->desc = "No rules found. " | wdg_redirect_elements->desc = "No rules found. " | |||
"Redirects may be not enalbed in etter.conf?"; | "Redirects may be not enabled in etter.conf?"; | |||
} | } | |||
} | } | |||
static void curses_sslredir_add_list(struct redir_entry *re) | static void curses_sslredir_add_list(struct redir_entry *re) | |||
{ | { | |||
/* enlarge the array */ | /* enlarge the array */ | |||
SAFE_REALLOC(wdg_redirect_elements, (n_redir+1) * sizeof(struct wdg_list)); | SAFE_REALLOC(wdg_redirect_elements, (n_redir+1) * sizeof(struct wdg_list)); | |||
/* fill the element */ | /* fill the element */ | |||
SAFE_CALLOC(wdg_redirect_elements[n_redir].desc, MAX_DESC_LEN, | SAFE_CALLOC(wdg_redirect_elements[n_redir].desc, MAX_DESC_LEN, | |||
sizeof(char)); | sizeof(char)); | |||
snprintf(wdg_redirect_elements[n_redir].desc, MAX_DESC_LEN, | snprintf(wdg_redirect_elements[n_redir].desc, MAX_DESC_LEN, | |||
"%s %30s %30s %s", | "%s %30s %s", | |||
(re->proto == EC_REDIR_PROTO_IPV4 ? "ipv4" : "ipv6"), | (re->proto == EC_REDIR_PROTO_IPV4 ? "ipv4" : "ipv6"), | |||
re->source, | ||||
re->destination, | re->destination, | |||
re->name); | re->name); | |||
wdg_redirect_elements[n_redir].value = re; | wdg_redirect_elements[n_redir].value = re; | |||
n_redir++; | n_redir++; | |||
/* allocate new entry in list to move the NULL element */ | /* allocate new entry in list to move the NULL element */ | |||
SAFE_REALLOC(wdg_redirect_elements, (n_redir+1) * sizeof(struct wdg_list)); | SAFE_REALLOC(wdg_redirect_elements, (n_redir+1) * sizeof(struct wdg_list)); | |||
wdg_redirect_elements[n_redir].desc = NULL; | wdg_redirect_elements[n_redir].desc = NULL; | |||
End of changes. 11 change blocks. | ||||
13 lines changed or deleted | 9 lines changed or added |