This commit is contained in:
Nicholas.Ni 2021-07-26 23:11:42 +08:00
commit a03427dccd
2 changed files with 37 additions and 8 deletions

View file

@ -386,6 +386,7 @@ char *stringify_headers(ptr_header_node *ptr_head) {
} }
} }
return headers_str; 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"); hydra_report(stderr, "[ERROR] Out of memory for HTTP headers (H).\n");
return 0; return 0;
default: default:
hydra_report(stderr, "[ERROR] no valid optional parameter type given: %c\n", miscptr[0]); while (*ptr != 0 && *ptr != ':')
return 0; 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; return 1;

View file

@ -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_report_found_host(port, ip, "www", fp);
hydra_completed_pair_found(); hydra_completed_pair_found();
if (http_buf != NULL) {
freeM(http_buf);
}
goto finish; 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)) { 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)); memset(misc, '\0', strlen(miscptr));
strcpy(misc, 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) { if (strstr(p, "F=") != NULL || strstr(p, "S=") != NULL) {
int size = 0; int size = 0;
if (misc != NULL) { if (misc != NULL && strlen(misc) != 0) {
size += strlen(misc) + 1; size += strlen(misc) + 1;
} }
size += strlen(p); size += strlen(p);
match_text_start = (char *)malloc(size); if(size == strlen(p)) {
memset(match_text_start, '\0', strlen(match_text_start)); match_text_start = p;
strcat(match_text_start, p); } else {
if (misc != NULL) { match_text_start = (char *) realloc(p, size);
}
if (misc != NULL && strlen(misc) != 0) {
strcat(match_text_start, ":"); strcat(match_text_start, ":");
strcat(match_text_start, misc); 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); hydra_report(stderr, "Modificated options:%s\n", miscptr);
} }
free(cp);
return 0; return 0;
} }