diff --git a/hydra-http-form.c b/hydra-http-form.c index f675beb..025581c 100644 --- a/hydra-http-form.c +++ b/hydra-http-form.c @@ -386,6 +386,7 @@ char *stringify_headers(ptr_header_node *ptr_head) { } } + return headers_str; } @@ -509,8 +510,17 @@ int32_t parse_options(char *miscptr, ptr_header_node *ptr_head) { hydra_report(stderr, "[ERROR] Out of memory for HTTP headers (H).\n"); return 0; default: - hydra_report(stderr, "[ERROR] no valid optional parameter type given: %c\n", miscptr[0]); - return 0; + while (*ptr != 0 && *ptr != ':') + ptr++; + + if (*ptr != 0) { + *ptr = 0; + ptr += 1; + } + + miscptr = ptr; + // hydra_report(stderr, "[ERROR] no valid optional parameter type given: %c\n", miscptr[0]); + // return 0; } } return 1; diff --git a/hydra-http.c b/hydra-http.c index 10fe197..9ae4c1c 100644 --- a/hydra-http.c +++ b/hydra-http.c @@ -270,10 +270,23 @@ int32_t start_http(int32_t s, char *ip, int32_t port, unsigned char options, cha hydra_report_found_host(port, ip, "www", fp); hydra_completed_pair_found(); + if (http_buf != NULL) { + freeM(http_buf); + } + goto finish; } } } + + if (end_condition_type == -1) { + // Skip when status codes do not match + hydra_completed_pair(); + if (http_buf != NULL) { + freeM(http_buf); + } + goto finish; + } } if (ptr != NULL && (*ptr == '2' || *ptr == '3' || strncmp(ptr, "403", 3) == 0 || strncmp(ptr, "404", 3) == 0)) { @@ -456,7 +469,8 @@ int32_t service_http_init(char *ip, int32_t sp, unsigned char options, char *mis - char *misc = (char *)malloc(strlen(miscptr)); + char *misc = (char *)malloc(strlen(miscptr) + 1); + char *cp = misc; memset(misc, '\0', strlen(miscptr)); strcpy(misc, miscptr); @@ -524,14 +538,17 @@ int32_t service_http_init(char *ip, int32_t sp, unsigned char options, char *mis if (strstr(p, "F=") != NULL || strstr(p, "S=") != NULL) { int size = 0; - if (misc != NULL) { + if (misc != NULL && strlen(misc) != 0) { size += strlen(misc) + 1; } size += strlen(p); - match_text_start = (char *)malloc(size); - memset(match_text_start, '\0', strlen(match_text_start)); - strcat(match_text_start, p); - if (misc != NULL) { + if(size == strlen(p)) { + match_text_start = p; + } else { + match_text_start = (char *) realloc(p, size); + } + + if (misc != NULL && strlen(misc) != 0) { strcat(match_text_start, ":"); strcat(match_text_start, misc); } @@ -566,6 +583,8 @@ int32_t service_http_init(char *ip, int32_t sp, unsigned char options, char *mis hydra_report(stderr, "Modificated options:%s\n", miscptr); } + free(cp); + return 0; }