sslstrip.c (ettercap-0.8.3) | : | sslstrip.c (ettercap-0.8.3.1) | ||
---|---|---|---|---|
skipping to change at line 229 | skipping to change at line 229 | |||
if (http_bind_wrapper() != E_SUCCESS) { | if (http_bind_wrapper() != E_SUCCESS) { | |||
USER_MSG("SSLStrip: plugin load failed: Could not set up HTTP redirect\n") ; | USER_MSG("SSLStrip: plugin load failed: Could not set up HTTP redirect\n") ; | |||
return PLUGIN_FINISHED; | return PLUGIN_FINISHED; | |||
} | } | |||
https_url_pcre = pcre_compile(URL_PATTERN, PCRE_MULTILINE|PCRE_CASELESS, &err or, &erroroffset, NULL); | https_url_pcre = pcre_compile(URL_PATTERN, PCRE_MULTILINE|PCRE_CASELESS, &err or, &erroroffset, NULL); | |||
if (!https_url_pcre) { | if (!https_url_pcre) { | |||
USER_MSG("SSLStrip: plugin load failed: pcre_compile failed (offset: %d), %s\n", erroroffset, error); | USER_MSG("SSLStrip: plugin load failed: pcre_compile failed (offset: %d), %s\n", erroroffset, error); | |||
ec_redirect(EC_REDIR_ACTION_REMOVE, "http", EC_REDIR_PROTO_IPV4, | ec_redirect(EC_REDIR_ACTION_REMOVE, "http", EC_REDIR_PROTO_IPV4, | |||
NULL, NULL, 80, bind_port); | NULL, 80, bind_port); | |||
#ifdef WITH_IPV6 | #ifdef WITH_IPV6 | |||
ec_redirect(EC_REDIR_ACTION_REMOVE, "http", EC_REDIR_PROTO_IPV6, | ec_redirect(EC_REDIR_ACTION_REMOVE, "http", EC_REDIR_PROTO_IPV6, | |||
NULL, NULL, 80, bind_port); | NULL, 80, bind_port); | |||
#endif | #endif | |||
return PLUGIN_FINISHED; | return PLUGIN_FINISHED; | |||
} | } | |||
err = regcomp(&find_cookie_re, COOKIE_PATTERN, REG_EXTENDED | REG_NEWLINE | R EG_ICASE); | err = regcomp(&find_cookie_re, COOKIE_PATTERN, REG_EXTENDED | REG_NEWLINE | R EG_ICASE); | |||
if (err) { | if (err) { | |||
regerror(err, &find_cookie_re, errbuf, sizeof(errbuf)); | regerror(err, &find_cookie_re, errbuf, sizeof(errbuf)); | |||
USER_MSG("SSLStrip: plugin load failed: Could not compile find_cookie rege x: %s (%d)\n", errbuf, err); | USER_MSG("SSLStrip: plugin load failed: Could not compile find_cookie rege x: %s (%d)\n", errbuf, err); | |||
pcre_free(https_url_pcre); | pcre_free(https_url_pcre); | |||
ec_redirect(EC_REDIR_ACTION_REMOVE, "http" , EC_REDIR_PROTO_IPV4, | ec_redirect(EC_REDIR_ACTION_REMOVE, "http" , EC_REDIR_PROTO_IPV4, | |||
NULL, NULL, 80, bind_port); | NULL, 80, bind_port); | |||
#ifdef WITH_IPV6 | #ifdef WITH_IPV6 | |||
ec_redirect(EC_REDIR_ACTION_REMOVE, "http" , EC_REDIR_PROTO_IPV6, | ec_redirect(EC_REDIR_ACTION_REMOVE, "http" , EC_REDIR_PROTO_IPV6, | |||
NULL, NULL, 80, bind_port); | NULL, 80, bind_port); | |||
#endif | #endif | |||
return PLUGIN_FINISHED; | return PLUGIN_FINISHED; | |||
} | } | |||
hook_add(HOOK_HANDLED, &sslstrip); | hook_add(HOOK_HANDLED, &sslstrip); | |||
/* start HTTP accept thread */ | /* start HTTP accept thread */ | |||
ec_thread_new_detached("http_accept_thread", "HTTP Accept thread", &http_acce pt_thread, NULL, 1); | ec_thread_new_detached("http_accept_thread", "HTTP Accept thread", &http_acce pt_thread, NULL, 1); | |||
skipping to change at line 271 | skipping to change at line 271 | |||
} | } | |||
static int sslstrip_fini(void *dummy) | static int sslstrip_fini(void *dummy) | |||
{ | { | |||
/* variable not used */ | /* variable not used */ | |||
(void) dummy; | (void) dummy; | |||
DEBUG_MSG("SSLStrip: Removing redirect\n"); | DEBUG_MSG("SSLStrip: Removing redirect\n"); | |||
if (ec_redirect(EC_REDIR_ACTION_REMOVE, "http", EC_REDIR_PROTO_IPV4, | if (ec_redirect(EC_REDIR_ACTION_REMOVE, "http", EC_REDIR_PROTO_IPV4, | |||
NULL, NULL, 80, bind_port) != E_SUCCESS) { | NULL, 80, bind_port) != E_SUCCESS) { | |||
USER_MSG("SSLStrip: Unable to remove HTTP redirect, please do so " | USER_MSG("SSLStrip: Unable to remove HTTP redirect, please do so " | |||
"manually.\n"); | "manually.\n"); | |||
} | } | |||
#ifdef WITH_IPV6 | #ifdef WITH_IPV6 | |||
if (ec_redirect(EC_REDIR_ACTION_REMOVE, "http", EC_REDIR_PROTO_IPV6, | if (ec_redirect(EC_REDIR_ACTION_REMOVE, "http", EC_REDIR_PROTO_IPV6, | |||
NULL, NULL, 80, bind_port) != E_SUCCESS) { | NULL, 80, bind_port) != E_SUCCESS) { | |||
USER_MSG("SSLStrip: Unable to remove HTTP redirect, please do so " | USER_MSG("SSLStrip: Unable to remove HTTP redirect, please do so " | |||
"manually.\n"); | "manually.\n"); | |||
} | } | |||
#endif | #endif | |||
// Free regexes. | // Free regexes. | |||
if (https_url_pcre) | if (https_url_pcre) | |||
pcre_free(https_url_pcre); | pcre_free(https_url_pcre); | |||
regfree(&find_cookie_re); | regfree(&find_cookie_re); | |||
/* stop accept wrapper */ | /* stop accept wrapper */ | |||
pthread_t pid = ec_thread_getpid("http_accept_thread"); | pthread_t pid = ec_thread_getpid("http_accept_thread"); | |||
if (!pthread_equal(pid, EC_PTHREAD_NULL)) | if (!pthread_equal(pid, ec_thread_getpid(NULL))) | |||
ec_thread_destroy(pid); | ec_thread_destroy(pid); | |||
/* now destroy all http_child_thread */ | /* now destroy all http_child_thread */ | |||
do { | do { | |||
pid = ec_thread_getpid("http_child_thread"); | pid = ec_thread_getpid("http_child_thread"); | |||
if(!pthread_equal(pid, EC_PTHREAD_NULL)) | if(!pthread_equal(pid, ec_thread_getpid(NULL))) | |||
ec_thread_destroy(pid); | ec_thread_destroy(pid); | |||
} while (!pthread_equal(pid, EC_PTHREAD_NULL)); | } while (!pthread_equal(pid, ec_thread_getpid(NULL))); | |||
close(main_fd); | close(main_fd); | |||
#ifdef WITH_IPV6 | #ifdef WITH_IPV6 | |||
close(main_fd6); | close(main_fd6); | |||
#endif | #endif | |||
/* Remove hook point */ | /* Remove hook point */ | |||
hook_del(HOOK_HANDLED, &sslstrip); | hook_del(HOOK_HANDLED, &sslstrip); | |||
return PLUGIN_FINISHED; | return PLUGIN_FINISHED; | |||
skipping to change at line 1310 | skipping to change at line 1310 | |||
return -E_FATAL; | return -E_FATAL; | |||
} | } | |||
#else | #else | |||
/* properly init fd even when not used - necessary for select call */ | /* properly init fd even when not used - necessary for select call */ | |||
main_fd6 = 0; | main_fd6 = 0; | |||
#endif | #endif | |||
USER_MSG("SSLStrip plugin: bind 80 on %d\n", bind_port); | USER_MSG("SSLStrip plugin: bind 80 on %d\n", bind_port); | |||
if (ec_redirect(EC_REDIR_ACTION_INSERT, "http", EC_REDIR_PROTO_IPV4, | if (ec_redirect(EC_REDIR_ACTION_INSERT, "http", EC_REDIR_PROTO_IPV4, | |||
NULL, NULL, 80, bind_port) != E_SUCCESS) | NULL, 80, bind_port) != E_SUCCESS) | |||
return -E_FATAL; | return -E_FATAL; | |||
#ifdef WITH_IPV6 | #ifdef WITH_IPV6 | |||
if (ec_redirect(EC_REDIR_ACTION_INSERT, "http", EC_REDIR_PROTO_IPV6, | if (ec_redirect(EC_REDIR_ACTION_INSERT, "http", EC_REDIR_PROTO_IPV6, | |||
NULL, NULL, 80, bind_port) != E_SUCCESS) | NULL, 80, bind_port) != E_SUCCESS) | |||
return -E_FATAL; | return -E_FATAL; | |||
#endif | #endif | |||
return E_SUCCESS; | return E_SUCCESS; | |||
} | } | |||
static void http_wipe_connection(struct http_connection *connection) | static void http_wipe_connection(struct http_connection *connection) | |||
{ | { | |||
DEBUG_MSG("SSLStrip: http_wipe_connection"); | DEBUG_MSG("SSLStrip: http_wipe_connection"); | |||
End of changes. 11 change blocks. | ||||
11 lines changed or deleted | 11 lines changed or added |