mirror of
https://github.com/vanhauser-thc/thc-hydra.git
synced 2025-08-19 21:03:52 -07:00
big int to stdint switch
This commit is contained in:
parent
74931e3b58
commit
f124c26fc6
73 changed files with 1364 additions and 1235 deletions
|
@ -75,15 +75,15 @@ typedef struct cookie_node {
|
|||
struct cookie_node *next;
|
||||
} t_cookie_node, *ptr_cookie_node;
|
||||
|
||||
int success_cond = 0;
|
||||
int getcookie = 1;
|
||||
int auth_flag = 0;
|
||||
int32_t success_cond = 0;
|
||||
int32_t getcookie = 1;
|
||||
int32_t auth_flag = 0;
|
||||
|
||||
char cookie[4096] = "", cmiscptr[1024];
|
||||
|
||||
extern char *webtarget;
|
||||
extern char *slash;
|
||||
int webport, freemischttpform = 0;
|
||||
int32_t webport, freemischttpform = 0;
|
||||
char bufferurl[6096+24], cookieurl[6096+24] = "", userheader[6096+24] = "", *url, *variables, *optional1;
|
||||
|
||||
#define MAX_REDIRECT 8
|
||||
|
@ -91,8 +91,8 @@ char bufferurl[6096+24], cookieurl[6096+24] = "", userheader[6096+24] = "", *url
|
|||
#define MAX_PROXY_LENGTH 2048 // sizeof(cookieurl) * 2
|
||||
|
||||
char redirected_url_buff[2048] = "";
|
||||
int redirected_flag = 0;
|
||||
int redirected_cpt = MAX_REDIRECT;
|
||||
int32_t redirected_flag = 0;
|
||||
int32_t redirected_cpt = MAX_REDIRECT;
|
||||
|
||||
char *cookie_request, *normal_request; // Buffers for HTTP headers
|
||||
|
||||
|
@ -135,7 +135,7 @@ strndup (const char *s, size_t n)
|
|||
}
|
||||
#endif
|
||||
|
||||
int append_cookie(char *name, char *value, ptr_cookie_node *last_cookie)
|
||||
int32_t append_cookie(char *name, char *value, ptr_cookie_node *last_cookie)
|
||||
{
|
||||
ptr_cookie_node new_ptr = (ptr_cookie_node) malloc(sizeof(t_cookie_node));
|
||||
if (!new_ptr)
|
||||
|
@ -156,7 +156,7 @@ int append_cookie(char *name, char *value, ptr_cookie_node *last_cookie)
|
|||
char * stringify_cookies(ptr_cookie_node ptr_cookie)
|
||||
{
|
||||
ptr_cookie_node cur_ptr = NULL;
|
||||
unsigned int length = 1;
|
||||
uint32_t length = 1;
|
||||
char *cookie_hdr = (char *) malloc(length);
|
||||
|
||||
if (cookie_hdr) {
|
||||
|
@ -195,7 +195,7 @@ success:
|
|||
* +--------+
|
||||
* Returns 1 if success, or 0 otherwise.
|
||||
*/
|
||||
int add_or_update_cookie(ptr_cookie_node * ptr_cookie, char * cookie_expr)
|
||||
int32_t add_or_update_cookie(ptr_cookie_node * ptr_cookie, char * cookie_expr)
|
||||
{
|
||||
ptr_cookie_node cur_ptr = NULL, new_ptr = NULL;
|
||||
char * cookie = strdup(cookie_expr);
|
||||
|
@ -227,11 +227,11 @@ int add_or_update_cookie(ptr_cookie_node * ptr_cookie, char * cookie_expr)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int process_cookies(ptr_cookie_node * ptr_cookie, char * cookie_expr)
|
||||
int32_t process_cookies(ptr_cookie_node * ptr_cookie, char * cookie_expr)
|
||||
{
|
||||
char *tok = NULL;
|
||||
char *expr = strdup(cookie_expr);
|
||||
int res = 0;
|
||||
int32_t res = 0;
|
||||
|
||||
if (strstr(cookie_expr, ";")) {
|
||||
tok = strtok(expr, ";");
|
||||
|
@ -257,7 +257,7 @@ int process_cookies(ptr_cookie_node * ptr_cookie, char * cookie_expr)
|
|||
*
|
||||
* Returns 1 if success, or 0 otherwise (out of memory).
|
||||
*/
|
||||
int add_header(ptr_header_node * ptr_head, char *header, char *value, char type) {
|
||||
int32_t add_header(ptr_header_node * ptr_head, char *header, char *value, char type) {
|
||||
ptr_header_node cur_ptr = NULL;
|
||||
ptr_header_node existing_hdr, new_ptr;
|
||||
|
||||
|
@ -369,7 +369,7 @@ void cleanup(ptr_header_node *ptr_head) {
|
|||
char *stringify_headers(ptr_header_node * ptr_head) {
|
||||
char *headers_str = NULL;
|
||||
ptr_header_node cur_ptr = *ptr_head;
|
||||
int ttl_size = 0;
|
||||
int32_t ttl_size = 0;
|
||||
|
||||
for (; cur_ptr; cur_ptr = cur_ptr->next)
|
||||
ttl_size += strlen(cur_ptr->header) + strlen(cur_ptr->value) + 4;
|
||||
|
@ -391,7 +391,7 @@ char *stringify_headers(ptr_header_node * ptr_head) {
|
|||
|
||||
|
||||
char *prepare_http_request(char *type, char *path, char *params, char *headers) {
|
||||
unsigned int reqlen = 0;
|
||||
uint32_t reqlen = 0;
|
||||
char *http_request = NULL;
|
||||
|
||||
if (type && path && headers) {
|
||||
|
@ -431,7 +431,7 @@ char *prepare_http_request(char *type, char *path, char *params, char *headers)
|
|||
return http_request;
|
||||
}
|
||||
|
||||
int strpos(char *str, char *target) {
|
||||
int32_t strpos(char *str, char *target) {
|
||||
char *res = strstr(str, target);
|
||||
|
||||
if (res == NULL)
|
||||
|
@ -462,12 +462,12 @@ char *html_encode(char *string) {
|
|||
|
||||
|
||||
/*
|
||||
int analyze_server_response(int socket)
|
||||
int32_t analyze_server_response(int32_t socket)
|
||||
return 0 or 1 when the cond regex is matched
|
||||
return -1 if no response from server
|
||||
*/
|
||||
int analyze_server_response(int s) {
|
||||
int runs = 0;
|
||||
int32_t analyze_server_response(int32_t s) {
|
||||
int32_t runs = 0;
|
||||
redirected_flag = 0;
|
||||
auth_flag = 0;
|
||||
while ((buf = hydra_receive_line(s)) != NULL) {
|
||||
|
@ -572,7 +572,7 @@ int analyze_server_response(int s) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void hydra_reconnect(int s, char *ip, int port, unsigned char options, char *hostname) {
|
||||
void hydra_reconnect(int32_t s, char *ip, int32_t port, unsigned char options, char *hostname) {
|
||||
if (s >= 0)
|
||||
s = hydra_disconnect(s);
|
||||
if ((options & OPTION_SSL) == 0) {
|
||||
|
@ -582,13 +582,13 @@ void hydra_reconnect(int s, char *ip, int port, unsigned char options, char *hos
|
|||
}
|
||||
}
|
||||
|
||||
int start_http_form(int s, char *ip, int port, unsigned char options, char *miscptr, FILE * fp, char *hostname, char *type, ptr_header_node ptr_head, ptr_cookie_node ptr_cookie) {
|
||||
int32_t start_http_form(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE * fp, char *hostname, char *type, ptr_header_node ptr_head, ptr_cookie_node ptr_cookie) {
|
||||
char *empty = "";
|
||||
char *login, *pass, clogin[256], cpass[256];
|
||||
char header[8096], *upd3variables;
|
||||
char *cookie_header = NULL;
|
||||
char *http_request;
|
||||
int found = !success_cond, i, j;
|
||||
int32_t found = !success_cond, i, j;
|
||||
char content_length[MAX_CONTENT_LENGTH], proxy_string[MAX_PROXY_LENGTH];
|
||||
|
||||
memset(header, 0, sizeof(header));
|
||||
|
@ -630,7 +630,7 @@ int start_http_form(int s, char *ip, int port, unsigned char options, char *misc
|
|||
if (strcmp(type, "POST") == 0) {
|
||||
memset(proxy_string, 0, sizeof(proxy_string));
|
||||
snprintf(proxy_string, MAX_PROXY_LENGTH - 1, "http://%s:%d%.600s", webtarget, webport, url);
|
||||
snprintf(content_length, MAX_CONTENT_LENGTH - 1, "%d", (int) strlen(upd3variables));
|
||||
snprintf(content_length, MAX_CONTENT_LENGTH - 1, "%d", (int32_t) strlen(upd3variables));
|
||||
if (header_exists(&ptr_head, "Content-Length", HEADER_TYPE_DEFAULT))
|
||||
hdrrepv(&ptr_head, "Content-Length", content_length);
|
||||
else
|
||||
|
@ -678,7 +678,7 @@ int start_http_form(int s, char *ip, int port, unsigned char options, char *misc
|
|||
if (strcmp(type, "POST") == 0) {
|
||||
memset(proxy_string, 0, sizeof(proxy_string));
|
||||
snprintf(proxy_string, MAX_PROXY_LENGTH - 1, "http://%s:%d%.600s", webtarget, webport, url);
|
||||
snprintf(content_length, MAX_CONTENT_LENGTH - 1, "%d", (int) strlen(upd3variables));
|
||||
snprintf(content_length, MAX_CONTENT_LENGTH - 1, "%d", (int32_t) strlen(upd3variables));
|
||||
if (header_exists(&ptr_head, "Content-Length", HEADER_TYPE_DEFAULT))
|
||||
hdrrepv(&ptr_head, "Content-Length", content_length);
|
||||
else
|
||||
|
@ -724,7 +724,7 @@ int start_http_form(int s, char *ip, int port, unsigned char options, char *misc
|
|||
}
|
||||
// now prepare for the "real" request
|
||||
if (strcmp(type, "POST") == 0) {
|
||||
snprintf(content_length, MAX_CONTENT_LENGTH - 1, "%d", (int) strlen(upd3variables));
|
||||
snprintf(content_length, MAX_CONTENT_LENGTH - 1, "%d", (int32_t) strlen(upd3variables));
|
||||
if (header_exists(&ptr_head, "Content-Length", HEADER_TYPE_DEFAULT))
|
||||
hdrrepv(&ptr_head, "Content-Length", content_length);
|
||||
else
|
||||
|
@ -905,9 +905,9 @@ int start_http_form(int s, char *ip, int port, unsigned char options, char *misc
|
|||
return 1;
|
||||
}
|
||||
|
||||
void service_http_form(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname, char *type, ptr_header_node * ptr_head, ptr_cookie_node * ptr_cookie) {
|
||||
int run = 1, next_run = 1, sock = -1;
|
||||
int myport = PORT_HTTP, mysslport = PORT_HTTP_SSL;
|
||||
void service_http_form(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE * fp, int32_t port, char *hostname, char *type, ptr_header_node * ptr_head, ptr_cookie_node * ptr_cookie) {
|
||||
int32_t run = 1, next_run = 1, sock = -1;
|
||||
int32_t myport = PORT_HTTP, mysslport = PORT_HTTP_SSL;
|
||||
|
||||
// register our socket descriptor
|
||||
hydra_register_socket(sp);
|
||||
|
@ -945,7 +945,7 @@ void service_http_form(char *ip, int sp, unsigned char options, char *miscptr, F
|
|||
port = mysslport;
|
||||
}
|
||||
if (sock < 0) {
|
||||
hydra_report(stderr, "[ERROR] Child with pid %d terminating, cannot connect\n", (int) getpid());
|
||||
hydra_report(stderr, "[ERROR] Child with pid %d terminating, cannot connect\n", (int32_t) getpid());
|
||||
if (freemischttpform)
|
||||
free(miscptr);
|
||||
freemischttpform = 0;
|
||||
|
@ -986,7 +986,7 @@ void service_http_form(char *ip, int sp, unsigned char options, char *miscptr, F
|
|||
free(miscptr);
|
||||
}
|
||||
|
||||
void service_http_get_form(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
|
||||
void service_http_get_form(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE * fp, int32_t port, char *hostname) {
|
||||
ptr_cookie_node ptr_cookie = NULL;
|
||||
ptr_header_node ptr_head = initialize(ip, options, miscptr);
|
||||
|
||||
|
@ -998,7 +998,7 @@ void service_http_get_form(char *ip, int sp, unsigned char options, char *miscpt
|
|||
}
|
||||
}
|
||||
|
||||
void service_http_post_form(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
|
||||
void service_http_post_form(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE * fp, int32_t port, char *hostname) {
|
||||
ptr_cookie_node ptr_cookie = NULL;
|
||||
ptr_header_node ptr_head = initialize(ip, options, miscptr);
|
||||
|
||||
|
@ -1010,7 +1010,7 @@ void service_http_post_form(char *ip, int sp, unsigned char options, char *miscp
|
|||
}
|
||||
}
|
||||
|
||||
int service_http_form_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
|
||||
int32_t service_http_form_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE * fp, int32_t port, char *hostname) {
|
||||
// called before the childrens are forked off, so this is the function
|
||||
// which should be filled if initial connections and service setup has to be
|
||||
// performed once only.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue