ec_curses.c (ettercap-0.8.3) | : | ec_curses.c (ettercap-0.8.3.1) | ||
---|---|---|---|---|
skipping to change at line 341 | skipping to change at line 341 | |||
wdg_set_focus(dlg); | wdg_set_focus(dlg); | |||
} | } | |||
/* the interface */ | /* the interface */ | |||
void curses_interface(void) | void curses_interface(void) | |||
{ | { | |||
DEBUG_MSG("curses_interface"); | DEBUG_MSG("curses_interface"); | |||
/* if we have to activate a plugin */ | ||||
curses_autostart_plugins(); | ||||
/* which interface do we have to display ? */ | /* which interface do we have to display ? */ | |||
if (EC_GBL_OPTIONS->read) | if (EC_GBL_OPTIONS->read) | |||
curses_sniff_offline(); | curses_sniff_offline(); | |||
else | else | |||
curses_sniff_live(); | curses_sniff_live(); | |||
/* destroy the previously allocated object */ | /* destroy the previously allocated object */ | |||
wdg_destroy_object(&sysmsg_win); | wdg_destroy_object(&sysmsg_win); | |||
} | } | |||
skipping to change at line 551 | skipping to change at line 554 | |||
/* set the options for writing to a file */ | /* set the options for writing to a file */ | |||
EC_GBL_OPTIONS->write = 1; | EC_GBL_OPTIONS->write = 1; | |||
EC_GBL_OPTIONS->read = 0; | EC_GBL_OPTIONS->read = 0; | |||
} | } | |||
/* | /* | |||
* display the interface selection dialog | * display the interface selection dialog | |||
*/ | */ | |||
static void curses_unified_sniff(void) | static void curses_unified_sniff(void) | |||
{ | { | |||
char err[PCAP_ERRBUF_SIZE]; | ||||
#define IFACE_LEN 50 | #define IFACE_LEN 50 | |||
DEBUG_MSG("curses_unified_sniff"); | DEBUG_MSG("curses_unified_sniff"); | |||
/* if the user has not specified an interface, get the first one */ | /* if the user has not specified an interface, get the first one */ | |||
if (EC_GBL_OPTIONS->iface == NULL) { | if (EC_GBL_OPTIONS->iface == NULL) { | |||
char *iface; | char *iface; | |||
SAFE_CALLOC(EC_GBL_OPTIONS->iface, IFACE_LEN, sizeof(char)); | SAFE_CALLOC(EC_GBL_OPTIONS->iface, IFACE_LEN, sizeof(char)); | |||
iface = pcap_lookupdev(err); | iface = capture_default_if(); | |||
ON_ERROR(iface, NULL, "pcap_lookupdev: %s", err); | ON_ERROR(iface, NULL, "No suitable interface found..."); | |||
strncpy(EC_GBL_OPTIONS->iface, iface, IFACE_LEN - 1); | strncpy(EC_GBL_OPTIONS->iface, iface, IFACE_LEN - 1); | |||
} | } | |||
/* calling wdg_exit will go to the next interface :) */ | /* calling wdg_exit will go to the next interface :) */ | |||
curses_input("Network interface :", EC_GBL_OPTIONS->iface, IFACE_LEN, wdg_exi t); | curses_input("Network interface :", EC_GBL_OPTIONS->iface, IFACE_LEN, wdg_exi t); | |||
} | } | |||
/* | /* | |||
* display the interface selection for bridged sniffing | * display the interface selection for bridged sniffing | |||
*/ | */ | |||
static void curses_bridged_sniff(void) | static void curses_bridged_sniff(void) | |||
{ | { | |||
wdg_t *in; | wdg_t *in; | |||
char err[PCAP_ERRBUF_SIZE]; | char *iface; | |||
DEBUG_MSG("curses_bridged_sniff"); | DEBUG_MSG("curses_bridged_sniff"); | |||
/* if the user has not specified an interface, get the first one */ | /* if the user has not specified an interface, get the first one */ | |||
if (EC_GBL_OPTIONS->iface == NULL) { | if (EC_GBL_OPTIONS->iface == NULL) { | |||
SAFE_CALLOC(EC_GBL_OPTIONS->iface, IFACE_LEN, sizeof(char)); | SAFE_CALLOC(EC_GBL_OPTIONS->iface, IFACE_LEN, sizeof(char)); | |||
/* if ettercap is started with a non root account pcap_lookupdev(err) == NULL | ||||
(Fedora bug 783675) */ | ||||
if(pcap_lookupdev(err) != NULL) | ||||
strncpy(EC_GBL_OPTIONS->iface, pcap_lookupdev(err), IFACE_LEN - 1); | ||||
/* else | ||||
here we have to gracefully exit, since we don't have any available interf | ||||
ace | ||||
*/ | ||||
iface = capture_default_if(); | ||||
ON_ERROR(iface, NULL, "No suitable interface found...."); | ||||
strncpy(EC_GBL_OPTIONS->iface, iface, IFACE_LEN - 1); | ||||
} | } | |||
SAFE_CALLOC(EC_GBL_OPTIONS->iface_bridge, IFACE_LEN, sizeof(char)); | SAFE_CALLOC(EC_GBL_OPTIONS->iface_bridge, IFACE_LEN, sizeof(char)); | |||
wdg_create_object(&in, WDG_INPUT, WDG_OBJ_WANT_FOCUS | WDG_OBJ_FOCUS_MODAL); | wdg_create_object(&in, WDG_INPUT, WDG_OBJ_WANT_FOCUS | WDG_OBJ_FOCUS_MODAL); | |||
wdg_set_color(in, WDG_COLOR_SCREEN, EC_COLOR); | wdg_set_color(in, WDG_COLOR_SCREEN, EC_COLOR); | |||
wdg_set_color(in, WDG_COLOR_WINDOW, EC_COLOR); | wdg_set_color(in, WDG_COLOR_WINDOW, EC_COLOR); | |||
wdg_set_color(in, WDG_COLOR_FOCUS, EC_COLOR_FOCUS); | wdg_set_color(in, WDG_COLOR_FOCUS, EC_COLOR_FOCUS); | |||
wdg_set_color(in, WDG_COLOR_TITLE, EC_COLOR_MENU); | wdg_set_color(in, WDG_COLOR_TITLE, EC_COLOR_MENU); | |||
wdg_input_size(in, strlen("Second network interface :") + IFACE_LEN, 4); | wdg_input_size(in, strlen("Second network interface :") + IFACE_LEN, 4); | |||
End of changes. 6 change blocks. | ||||
12 lines changed or deleted | 9 lines changed or added |