"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/interfaces/text/ec_text_redirect.c" between
ettercap-0.8.3.tar.gz and ettercap-0.8.3.1.tar.gz

About: ettercap is a multipurpose sniffer/interceptor/logger for switched LAN.

ec_text_redirect.c  (ettercap-0.8.3):ec_text_redirect.c  (ettercap-0.8.3.1)
skipping to change at line 47 skipping to change at line 47
void text_redirect_print(void) void text_redirect_print(void)
{ {
/* free list of redirects if allocated before */ /* free list of redirects if allocated before */
SAFE_FREE(redirect_list); SAFE_FREE(redirect_list);
SAFE_FREE(service_list); SAFE_FREE(service_list);
n_redir = 0; n_redir = 0;
/* print header */ /* print header */
fprintf(stdout, "SSL Intercepts\n"); fprintf(stdout, "SSL Intercepts\n");
fprintf(stdout, " # proto %30s %30s service\n", fprintf(stdout, " # IP Version %25s Service\n",
"source", "destination"); "Server IP");
/* print rules */ /* print rules */
ec_walk_redirects(text_redirect_print_rule); ec_walk_redirects(text_redirect_print_rule);
} }
/* /*
* delete redirect * delete redirect
*/ */
void text_redirect_del(int num) void text_redirect_del(int num)
skipping to change at line 72 skipping to change at line 72
if (num < 1 || num > n_redir) { if (num < 1 || num > n_redir) {
INSTANT_USER_MSG("Entered number '%d' is not in the range of " INSTANT_USER_MSG("Entered number '%d' is not in the range of "
"registered redirects.\n", num); "registered redirects.\n", num);
return; return;
} }
re = redirect_list[num - 1]; re = redirect_list[num - 1];
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)
INSTANT_USER_MSG("Redirect removed successfully\n", INSTANT_USER_MSG("Redirect removed successfully\n",
(re->proto == EC_REDIR_PROTO_IPV4 ? "ipv4" : "ipv6"), (re->proto == EC_REDIR_PROTO_IPV4 ? "ipv4" : "ipv6"),
re->source, re->destination, re->name); re->destination, re->name);
else else
INSTANT_USER_MSG("Removing redirect [%s] %s -> %s:%s failed!\n", INSTANT_USER_MSG("Removing redirect [%s] %s -> %s:%s failed!\n",
(re->proto == EC_REDIR_PROTO_IPV4 ? "ipv4" : "ipv6"), (re->proto == EC_REDIR_PROTO_IPV4 ? "ipv4" : "ipv6"),
re->source, re->destination, re->name); re->destination, re->name);
} }
/* /*
* add a redirect rule * add a redirect rule
*/ */
void text_redirect_add(void) void text_redirect_add(void)
{ {
char ipver[20], service[20]; char ipver[20], service[20];
char sourcebuf[MAX_ASCII_ADDR_LEN], destinationbuf[MAX_ASCII_ADDR_LEN]; char destinationbuf[MAX_ASCII_ADDR_LEN];
char *p, *source, *destination; char *p, *destination;
int i, ret, found = 0, invalid = 0; int i, ret, found = 0, invalid = 0;
ec_redir_proto_t proto; ec_redir_proto_t proto;
fprintf(stdout, "Interceptable services: \n"); fprintf(stdout, "Interceptable services: \n");
/* print available services */ /* print available services */
SAFE_FREE(service_list); SAFE_FREE(service_list);
n_serv = 0; n_serv = 0;
ec_walk_redirect_services(text_redirect_print_serv); ec_walk_redirect_services(text_redirect_print_serv);
fprintf(stdout, "\n\n"); fprintf(stdout, "\n\n");
fprintf(stdout, "IP version [ipv4]: "); fprintf(stdout, "IP version [ipv4]: ");
fgets(ipver, 20, stdin); fgets(ipver, 20, stdin);
/* remove trailing line feed */ /* remove trailing line feed */
if ((p = strrchr(ipver, '\n')) != NULL) if ((p = strrchr(ipver, '\n')) != NULL)
*p = 0; *p = 0;
fprintf(stdout, "Source [any]: "); fprintf(stdout, "Server IP [any]: ");
fgets(sourcebuf, MAX_ASCII_ADDR_LEN, stdin);
/* remove trailing line feed */
if ((p = strrchr(sourcebuf, '\n')) != NULL)
*p = 0;
fprintf(stdout, "Destination [any]: ");
fgets(destinationbuf, MAX_ASCII_ADDR_LEN, stdin); fgets(destinationbuf, MAX_ASCII_ADDR_LEN, stdin);
/* remove trailing line feed */ /* remove trailing line feed */
if ((p = strrchr(destinationbuf, '\n')) != NULL) if ((p = strrchr(destinationbuf, '\n')) != NULL)
*p = 0; *p = 0;
fprintf(stdout, "Service [ftps]: "); fprintf(stdout, "Service [ftps]: ");
fgets(service, 20, stdin); fgets(service, 20, stdin);
/* remove trailing line feed */ /* remove trailing line feed */
if ((p = strrchr(service, '\n')) != NULL) if ((p = strrchr(service, '\n')) != NULL)
*p = 0; *p = 0;
skipping to change at line 140 skipping to change at line 134
else if (!strcasecmp(ipver, "ipv6")) else if (!strcasecmp(ipver, "ipv6"))
proto = EC_REDIR_PROTO_IPV6; proto = EC_REDIR_PROTO_IPV6;
else { else {
INSTANT_USER_MSG("Invalid IP version entered. " INSTANT_USER_MSG("Invalid IP version entered. "
"Either \"ipv4\" or \"ipv6\"\n"); "Either \"ipv4\" or \"ipv6\"\n");
invalid = 1; invalid = 1;
} }
/* check user input for source and destination */ /* check user input for server IP */
if (!strcmp(sourcebuf, "") || !strcasecmp(sourcebuf, "any"))
source = NULL;
else
source = sourcebuf;
if (!strcmp(destinationbuf, "") || !strcasecmp(destinationbuf, "any")) if (!strcmp(destinationbuf, "") || !strcasecmp(destinationbuf, "any"))
destination = NULL; destination = NULL;
else else
destination = destinationbuf; destination = destinationbuf;
/* check user input for service */ /* check user input for service */
if (!strcmp(service, "")) if (!strcmp(service, ""))
strcpy(service, "ftps"); strcpy(service, "ftps");
for (i = 0; i < n_serv; i++) { for (i = 0; i < n_serv; i++) {
skipping to change at line 173 skipping to change at line 162
invalid = 1; invalid = 1;
} }
if (invalid == 1) { if (invalid == 1) {
INSTANT_USER_MSG("Redirect could not be inserted due to invalid " INSTANT_USER_MSG("Redirect could not be inserted due to invalid "
"input.\n"); "input.\n");
return; return;
} }
ret = ec_redirect(EC_REDIR_ACTION_INSERT, service_list[i]->name, ret = ec_redirect(EC_REDIR_ACTION_INSERT, service_list[i]->name,
proto, source, destination, service_list[i]->from_port, proto, destination, service_list[i]->from_port,
service_list[i]->to_port); service_list[i]->to_port);
if (ret == E_SUCCESS) if (ret == E_SUCCESS)
INSTANT_USER_MSG("New redirect inserted successfully.\n"); INSTANT_USER_MSG("New redirect inserted successfully.\n");
else else
INSTANT_USER_MSG("Insertion of new redirect failed.\n"); INSTANT_USER_MSG("Insertion of new redirect failed.\n");
} }
/* /*
skipping to change at line 195 skipping to change at line 184
*/ */
static void text_redirect_print_rule(struct redir_entry *re) static void text_redirect_print_rule(struct redir_entry *re)
{ {
/* allocate a new entry in the list and safe redir pointer */ /* allocate a new entry in the list and safe redir pointer */
SAFE_REALLOC(redirect_list, (n_redir+1) * sizeof(struct redir_entry *)); SAFE_REALLOC(redirect_list, (n_redir+1) * sizeof(struct redir_entry *));
redirect_list[n_redir] = re; redirect_list[n_redir] = re;
n_redir++; n_redir++;
/* print the rule */ /* print the rule */
fprintf(stdout, "%2d %5s %30s %30s %s\n", n_redir, fprintf(stdout, "%2d %5s %30s %s\n", n_redir,
(re->proto == EC_REDIR_PROTO_IPV4 ? "ipv4" : "ipv6"), (re->proto == EC_REDIR_PROTO_IPV4 ? "ipv4" : "ipv6"),
re->source, re->destination, re->name); re->destination, re->name);
} }
/* /*
* print a registered redirect service name * print a registered redirect service name
*/ */
static void text_redirect_print_serv(struct serv_entry *se) static void text_redirect_print_serv(struct serv_entry *se)
{ {
/* allocate new entry in the list and rember service */ /* allocate new entry in the list and rember service */
SAFE_REALLOC(service_list, (n_serv+1) * sizeof(struct serv_entry *)); SAFE_REALLOC(service_list, (n_serv+1) * sizeof(struct serv_entry *));
 End of changes. 10 change blocks. 
23 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)