parse optional header string e.g. (h|H=My-Hdr\: foo) for non-form based http requests

This commit is contained in:
mathewmarcus 2018-07-14 16:14:40 -05:00
parent 689b20f60a
commit a6db85b963

View file

@ -1,4 +1,5 @@
#include "hydra-mod.h" #include "hydra-mod.h"
#include "hydra-http.h"
#include "sasl.h" #include "sasl.h"
extern char *HYDRA_EXIT; extern char *HYDRA_EXIT;
@ -244,6 +245,7 @@ void service_http(char *ip, int32_t sp, unsigned char options, char *miscptr, FI
int32_t run = 1, next_run = 1, sock = -1; int32_t run = 1, next_run = 1, sock = -1;
int32_t myport = PORT_HTTP, mysslport = PORT_HTTP_SSL; int32_t myport = PORT_HTTP, mysslport = PORT_HTTP_SSL;
char *ptr, *ptr2; char *ptr, *ptr2;
ptr_header_node ptr_head;
hydra_register_socket(sp); hydra_register_socket(sp);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0) if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
@ -278,6 +280,16 @@ void service_http(char *ip, int32_t sp, unsigned char options, char *miscptr, FI
else else
webport = mysslport; webport = mysslport;
/* Advance to options string */
ptr = miscptr;
while (*ptr != 0 && (*ptr != ':' || *(ptr - 1) == '\\'))
ptr++;
if (*ptr != 0)
*ptr++ = 0;
optional1 = ptr;
ptr_head = parse_options(optional1);
while (1) { while (1) {
next_run = 0; next_run = 0;
switch (run) { switch (run) {