mirror of
https://github.com/vanhauser-thc/thc-hydra.git
synced 2025-07-06 04:51:40 -07:00
fix for bad implemented web servers
This commit is contained in:
parent
60e3fb52c4
commit
7cf9c74d1b
1 changed files with 20 additions and 4 deletions
20
hydra-http.c
20
hydra-http.c
|
@ -6,7 +6,6 @@ char *webtarget = NULL;
|
|||
char *slash = "/";
|
||||
char *http_buf = NULL;
|
||||
int webport, freemischttp = 0;
|
||||
|
||||
int http_auth_mechanism = AUTH_BASIC;
|
||||
|
||||
int start_http(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp, char *type) {
|
||||
|
@ -14,6 +13,8 @@ int start_http(int s, char *ip, int port, unsigned char options, char *miscptr,
|
|||
char *login, *pass, buffer[500], buffer2[500];
|
||||
char *header = ""; /* XXX TODO */
|
||||
char *ptr, *fooptr;
|
||||
int complete_line = 0;
|
||||
char tmpreplybuf[1024] = "", *tmpreplybufptr;
|
||||
|
||||
if (strlen(login = hydra_get_next_login()) == 0)
|
||||
login = empty;
|
||||
|
@ -152,10 +153,25 @@ int start_http(int s, char *ip, int port, unsigned char options, char *miscptr,
|
|||
if (http_buf != NULL)
|
||||
free(http_buf);
|
||||
http_buf = hydra_receive_line(s);
|
||||
while (http_buf != NULL && strstr(http_buf, "HTTP/1.") == NULL) {
|
||||
complete_line = 0;
|
||||
|
||||
while (http_buf != NULL && (strstr(http_buf, "HTTP/1.") == NULL || (index(http_buf, '\n') == NULL && complete_line == 0))) {
|
||||
if (tmpreplybuf[0] == 0 && strstr(http_buf, "HTTP/1.") != NULL) {
|
||||
strncpy(tmpreplybuf, http_buf, sizeof(tmpreplybuf) - 1);
|
||||
tmpreplybuf[sizeof(tmpreplybuf) - 1] = 0;
|
||||
} else if (tmpreplybuf[0] != 0) {
|
||||
complete_line = 1;
|
||||
if ((tmpreplybufptr = malloc(strlen(tmpreplybuf) + strlen(http_buf) + 1)) != NULL) {
|
||||
strcpy(tmpreplybufptr, tmpreplybuf);
|
||||
strcat(tmpreplybufptr, http_buf);
|
||||
free(http_buf);
|
||||
http_buf = tmpreplybufptr;
|
||||
}
|
||||
} else {
|
||||
free(http_buf);
|
||||
http_buf = hydra_receive_line(s);
|
||||
}
|
||||
}
|
||||
|
||||
//if server cut the connection, just exit cleanly or
|
||||
//this will be an infinite loop
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue