mirror of
https://github.com/vanhauser-thc/thc-hydra.git
synced 2025-07-05 12:36:09 -07:00
indent
This commit is contained in:
parent
f423875d90
commit
cedbd0ddb2
7 changed files with 28 additions and 52 deletions
16
bfg.c
16
bfg.c
|
@ -62,7 +62,7 @@ int32_t bf_init(char *arg) {
|
|||
int32_t crs_len = 0;
|
||||
char flags = 0;
|
||||
char *tmp = strchr(arg, ':');
|
||||
|
||||
|
||||
if (!tmp) {
|
||||
fprintf(stderr, "Error: Invalid option format for -x\n");
|
||||
return 1;
|
||||
|
@ -170,12 +170,12 @@ int32_t bf_init(char *arg) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bf_options.crs_len = crs_len;
|
||||
bf_options.current = bf_options.from;
|
||||
|
||||
memset((char *) bf_options.state, 0, sizeof(bf_options.state));
|
||||
|
||||
memset((char *)bf_options.state, 0, sizeof(bf_options.state));
|
||||
|
||||
if (debug)
|
||||
printf("[DEBUG] bfg INIT: from %u, to %u, len: %u, set: %s\n", bf_options.from, bf_options.to, bf_options.crs_len, bf_options.crs);
|
||||
|
||||
|
@ -210,9 +210,9 @@ char *bf_next() {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
for(i=0; i<bf_options.current; ++i)
|
||||
bf_options.ptr[i] = bf_options.crs[bf_options.state[i]];
|
||||
//we don't subtract the same depending on wether the length is odd or even
|
||||
for (i = 0; i < bf_options.current; ++i)
|
||||
bf_options.ptr[i] = bf_options.crs[bf_options.state[i]];
|
||||
// we don't subtract the same depending on wether the length is odd or even
|
||||
bf_options.ptr[bf_options.current] = 0;
|
||||
|
||||
if (debug) {
|
||||
|
@ -222,7 +222,7 @@ char *bf_next() {
|
|||
printf(", x: %s\n", bf_options.ptr);
|
||||
}
|
||||
|
||||
//we revert the ordering of the bruteforce to fix the first static character
|
||||
// we revert the ordering of the bruteforce to fix the first static character
|
||||
while (pos >= 0 && (++bf_options.state[pos]) >= bf_options.crs_len) {
|
||||
bf_options.state[pos] = 0;
|
||||
pos--;
|
||||
|
|
|
@ -1215,7 +1215,8 @@ int32_t service_http_form_init(char *ip, int32_t sp, unsigned char options, char
|
|||
// 0 all OK
|
||||
// -1 error, hydra will exit, so print a good error message here
|
||||
|
||||
if (initialize(ip, options, miscptr) == NULL) return 1;
|
||||
if (initialize(ip, options, miscptr) == NULL)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1224,7 +1225,7 @@ ptr_header_node initialize(char *ip, unsigned char options, char *miscptr) {
|
|||
ptr_header_node ptr_head = NULL;
|
||||
char *ptr, *ptr2, *proxy_string;
|
||||
#ifdef AF_INET6
|
||||
unsigned char addr6 [sizeof(struct in6_addr)];
|
||||
unsigned char addr6[sizeof(struct in6_addr)];
|
||||
#endif
|
||||
|
||||
if (use_proxy > 0 && proxy_count > 0)
|
||||
|
@ -1251,7 +1252,7 @@ ptr_header_node initialize(char *ip, unsigned char options, char *miscptr) {
|
|||
#ifdef AF_INET6
|
||||
+ 2 /* [] */
|
||||
#endif
|
||||
);
|
||||
);
|
||||
#ifdef AF_INET6
|
||||
/* let libc decide if target is an ipv6 address */
|
||||
if (inet_pton(AF_INET6, webtarget, addr6)) {
|
||||
|
@ -1262,8 +1263,7 @@ ptr_header_node initialize(char *ip, unsigned char options, char *miscptr) {
|
|||
#ifdef AF_INET6
|
||||
}
|
||||
#endif
|
||||
if (options & OPTION_SSL && webport != PORT_HTTP_SSL ||
|
||||
!(options & OPTION_SSL) && webport != PORT_HTTP) {
|
||||
if (options & OPTION_SSL && webport != PORT_HTTP_SSL || !(options & OPTION_SSL) && webport != PORT_HTTP) {
|
||||
sprintf(ptr2, ":%d", webport);
|
||||
}
|
||||
webtarget = ptr;
|
||||
|
@ -1342,7 +1342,7 @@ ptr_header_node initialize(char *ip, unsigned char options, char *miscptr) {
|
|||
|
||||
// printf("miscptr: %s, url=%s, variables=%s, ptr=%s, optional1: %s, cond: %s
|
||||
// (%d)\n", miscptr, url, variables, ptr, optional1, cond, success_cond);
|
||||
|
||||
|
||||
/*
|
||||
* Parse the user-supplied options.
|
||||
* Beware of the backslashes (\)!
|
||||
|
|
|
@ -51,15 +51,10 @@ int32_t start_http_proxy(int32_t s, char *ip, int32_t port, unsigned char option
|
|||
}
|
||||
|
||||
if (debug) {
|
||||
hydra_report(stderr,
|
||||
"S:%-.*s\n",
|
||||
(int)(strchr(http_proxy_buf, '\r') - http_proxy_buf),
|
||||
http_proxy_buf);
|
||||
hydra_report(stderr, "S:%-.*s\n", (int)(strchr(http_proxy_buf, '\r') - http_proxy_buf), http_proxy_buf);
|
||||
}
|
||||
|
||||
while (http_proxy_buf != NULL &&
|
||||
(auth_hdr = hydra_strcasestr(http_proxy_buf,
|
||||
"Proxy-Authenticate:")) == NULL) {
|
||||
while (http_proxy_buf != NULL && (auth_hdr = hydra_strcasestr(http_proxy_buf, "Proxy-Authenticate:")) == NULL) {
|
||||
free(http_proxy_buf);
|
||||
http_proxy_buf = hydra_receive_line(s);
|
||||
}
|
||||
|
@ -71,10 +66,7 @@ int32_t start_http_proxy(int32_t s, char *ip, int32_t port, unsigned char option
|
|||
}
|
||||
|
||||
if (debug) {
|
||||
hydra_report(stderr,
|
||||
"S:%-.*s\n",
|
||||
(int)(strchr(auth_hdr, '\r') - auth_hdr),
|
||||
auth_hdr);
|
||||
hydra_report(stderr, "S:%-.*s\n", (int)(strchr(auth_hdr, '\r') - auth_hdr), auth_hdr);
|
||||
}
|
||||
|
||||
// after the first query we should have been disconnected from web server
|
||||
|
@ -115,10 +107,7 @@ int32_t start_http_proxy(int32_t s, char *ip, int32_t port, unsigned char option
|
|||
}
|
||||
|
||||
if (debug) {
|
||||
hydra_report(stderr,
|
||||
"S:%-.*s\n",
|
||||
(int)(strchr(http_proxy_buf, '\r') - http_proxy_buf),
|
||||
http_proxy_buf);
|
||||
hydra_report(stderr, "S:%-.*s\n", (int)(strchr(http_proxy_buf, '\r') - http_proxy_buf), http_proxy_buf);
|
||||
}
|
||||
} else {
|
||||
if (http_proxy_auth_mechanism == AUTH_NTLM || hydra_strcasestr(auth_hdr, "Proxy-Authenticate: NTLM") != NULL) {
|
||||
|
@ -220,10 +209,7 @@ int32_t start_http_proxy(int32_t s, char *ip, int32_t port, unsigned char option
|
|||
}
|
||||
|
||||
if (debug && http_proxy_buf != NULL) {
|
||||
hydra_report(stderr,
|
||||
"S:%-.*s\n",
|
||||
(int)(strchr(http_proxy_buf, '\r') - http_proxy_buf),
|
||||
http_proxy_buf);
|
||||
hydra_report(stderr, "S:%-.*s\n", (int)(strchr(http_proxy_buf, '\r') - http_proxy_buf), http_proxy_buf);
|
||||
}
|
||||
|
||||
if (http_proxy_buf == NULL)
|
||||
|
@ -234,10 +220,7 @@ int32_t start_http_proxy(int32_t s, char *ip, int32_t port, unsigned char option
|
|||
{
|
||||
if (auth_hdr != NULL) {
|
||||
// buf[strlen(http_proxy_buf) - 1] = '\0';
|
||||
hydra_report(stderr,
|
||||
"Unsupported Auth type:\n%-.*s\n",
|
||||
(int)(strchr(http_proxy_buf, '\r') - auth_hdr),
|
||||
auth_hdr);
|
||||
hydra_report(stderr, "Unsupported Auth type:\n%-.*s\n", (int)(strchr(http_proxy_buf, '\r') - auth_hdr), auth_hdr);
|
||||
auth_hdr = NULL;
|
||||
free(http_proxy_buf);
|
||||
http_proxy_buf = NULL;
|
||||
|
@ -250,11 +233,7 @@ int32_t start_http_proxy(int32_t s, char *ip, int32_t port, unsigned char option
|
|||
}
|
||||
|
||||
ptr = ((char *)index(http_proxy_buf, ' ')) + 1;
|
||||
if (*ptr == '2' ||
|
||||
(*ptr == '3' && *(ptr + 2) == '1') ||
|
||||
(*ptr == '3' && *(ptr + 2) == '2') ||
|
||||
(*ptr == '4' && *(ptr + 2) == '4')
|
||||
) {
|
||||
if (*ptr == '2' || (*ptr == '3' && *(ptr + 2) == '1') || (*ptr == '3' && *(ptr + 2) == '2') || (*ptr == '4' && *(ptr + 2) == '4')) {
|
||||
hydra_report_found_host(port, ip, "http-proxy", fp);
|
||||
hydra_completed_pair_found();
|
||||
free(http_proxy_buf);
|
||||
|
|
|
@ -314,7 +314,7 @@ void service_http(char *ip, int32_t sp, unsigned char options, char *miscptr, FI
|
|||
char *ptr, *ptr2;
|
||||
ptr_header_node ptr_head = NULL;
|
||||
#ifdef AF_INET6
|
||||
unsigned char addr6 [sizeof(struct in6_addr)];
|
||||
unsigned char addr6[sizeof(struct in6_addr)];
|
||||
#endif
|
||||
|
||||
hydra_register_socket(sp);
|
||||
|
@ -333,9 +333,9 @@ void service_http(char *ip, int32_t sp, unsigned char options, char *miscptr, FI
|
|||
/* normalise the webtarget for ipv6/port number */
|
||||
webtarget = malloc(strlen(hostname) + 1 /* null */ + 6 /* :65535 */
|
||||
#ifdef AF_INET6
|
||||
+ 2 /* [] */
|
||||
+ 2 /* [] */
|
||||
#endif
|
||||
);
|
||||
);
|
||||
#ifdef AF_INET6
|
||||
/* let libc decide if target is an ipv6 address */
|
||||
if (inet_pton(AF_INET6, hostname, addr6)) {
|
||||
|
@ -346,8 +346,7 @@ void service_http(char *ip, int32_t sp, unsigned char options, char *miscptr, FI
|
|||
#ifdef AF_INET6
|
||||
}
|
||||
#endif
|
||||
if (options & OPTION_SSL && webport != PORT_HTTP_SSL ||
|
||||
!(options & OPTION_SSL) && webport != PORT_HTTP) {
|
||||
if (options & OPTION_SSL && webport != PORT_HTTP_SSL || !(options & OPTION_SSL) && webport != PORT_HTTP) {
|
||||
sprintf(ptr, ":%d", webport);
|
||||
}
|
||||
ptr = NULL;
|
||||
|
|
|
@ -18,8 +18,8 @@ void dummy_oracle() { printf("\n"); }
|
|||
#else
|
||||
|
||||
#include <oci.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdbool.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
extern char *HYDRA_EXIT;
|
||||
|
||||
|
|
|
@ -152,9 +152,7 @@ bool smb2_run_test(creds_t *cr, const char *server, uint16_t port) {
|
|||
case ECONNREFUSED:
|
||||
// there are probably more codes that could be added here to
|
||||
// indicate connection errors.
|
||||
hydra_report(stderr,
|
||||
"[ERROR] Error %s (%d) while connecting to %s\n",
|
||||
strerror(errno), errno, server);
|
||||
hydra_report(stderr, "[ERROR] Error %s (%d) while connecting to %s\n", strerror(errno), errno, server);
|
||||
smbc_free_context(ctx, 1);
|
||||
EXIT_CONNECTION_ERROR;
|
||||
break;
|
||||
|
|
2
hydra.c
2
hydra.c
|
@ -618,7 +618,7 @@ void module_usage() {
|
|||
"%s:\n================================================================"
|
||||
"============\n",
|
||||
hydra_options.service);
|
||||
if (strncmp(hydra_options.service, "https-", 6) == 0 )
|
||||
if (strncmp(hydra_options.service, "https-", 6) == 0)
|
||||
memmove(hydra_options.service + 4, hydra_options.service + 5, strlen(hydra_options.service) - 4);
|
||||
for (i = 0; i < sizeof(services) / sizeof(services[0]); i++) {
|
||||
if (strcmp(hydra_options.service, services[i].name) == 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue