mirror of
https://github.com/vanhauser-thc/thc-hydra.git
synced 2025-07-05 20:41:39 -07:00
ipv6 pretty print
This commit is contained in:
parent
4c6cbf03a7
commit
4ab31cd18e
7 changed files with 32 additions and 13 deletions
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Firebird Support - by David Maciejak @ GMAIL dot com
|
Firebird Support - by David Maciejak @ GMAIL dot com
|
||||||
|
|
|
@ -210,8 +210,8 @@ int32_t start_http_proxy_urlenum(int32_t s, char *ip, int32_t port, unsigned cha
|
||||||
if (*ptr == '2' || (*ptr == '3' && (*(ptr + 2) == '1' || *(ptr + 2) == '2')) || strncmp(ptr, "404", 4) == 0 || strncmp(ptr, "403", 4) == 0) {
|
if (*ptr == '2' || (*ptr == '3' && (*(ptr + 2) == '1' || *(ptr + 2) == '2')) || strncmp(ptr, "404", 4) == 0 || strncmp(ptr, "403", 4) == 0) {
|
||||||
hydra_report_found_host(port, ip, "http-proxy", fp);
|
hydra_report_found_host(port, ip, "http-proxy", fp);
|
||||||
if (fp != stdout)
|
if (fp != stdout)
|
||||||
fprintf(fp, "[%d][http-proxy-urlenum] host: %s url: %s\n", port, hydra_address2string(ip), url);
|
fprintf(fp, "[%d][http-proxy-urlenum] host: %s url: %s\n", port, hydra_address2string_beautiful(ip), url);
|
||||||
printf("[%d][http-proxy-urlenum] host: %s url: %s\n", port, hydra_address2string(ip), url);
|
printf("[%d][http-proxy-urlenum] host: %s url: %s\n", port, hydra_address2string_beautiful(ip), url);
|
||||||
hydra_completed_pair_found();
|
hydra_completed_pair_found();
|
||||||
} else {
|
} else {
|
||||||
if (strncmp(ptr, "407", 3) == 0 /*|| strncmp(ptr, "401", 3) == 0 */ ) {
|
if (strncmp(ptr, "407", 3) == 0 /*|| strncmp(ptr, "401", 3) == 0 */ ) {
|
||||||
|
|
23
hydra-mod.c
23
hydra-mod.c
|
@ -1208,6 +1208,29 @@ char *hydra_address2string(char *address) {
|
||||||
struct sockaddr_in target;
|
struct sockaddr_in target;
|
||||||
struct sockaddr_in6 target6;
|
struct sockaddr_in6 target6;
|
||||||
|
|
||||||
|
if (address[0] == 4) {
|
||||||
|
memcpy(&target.sin_addr.s_addr, &address[1], 4);
|
||||||
|
return inet_ntoa((struct in_addr) target.sin_addr);
|
||||||
|
} else
|
||||||
|
#ifdef AF_INET6
|
||||||
|
if (address[0] == 16) {
|
||||||
|
memcpy(&target6.sin6_addr, &address[1], 16);
|
||||||
|
inet_ntop(AF_INET6, &target6.sin6_addr, ipstring, sizeof(ipstring));
|
||||||
|
return ipstring;
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
fprintf(stderr, "[ERROR] unknown address string size!\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return NULL; // not reached
|
||||||
|
}
|
||||||
|
|
||||||
|
char *hydra_address2string_beautiful(char *address) {
|
||||||
|
struct sockaddr_in target;
|
||||||
|
struct sockaddr_in6 target6;
|
||||||
|
|
||||||
if (address[0] == 4) {
|
if (address[0] == 4) {
|
||||||
memcpy(&target.sin_addr.s_addr, &address[1], 4);
|
memcpy(&target.sin_addr.s_addr, &address[1], 4);
|
||||||
return inet_ntoa((struct in_addr) target.sin_addr);
|
return inet_ntoa((struct in_addr) target.sin_addr);
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PostgresSQL Support - by Diaul (at) devilopers.org
|
* PostgresSQL Support - by Diaul (at) devilopers.org
|
||||||
*
|
*
|
||||||
|
|
|
@ -172,7 +172,7 @@ int32_t service_ssh_init(char *ip, int32_t sp, unsigned char options, char *misc
|
||||||
ssh_session session = ssh_new();
|
ssh_session session = ssh_new();
|
||||||
|
|
||||||
if (verbose || debug)
|
if (verbose || debug)
|
||||||
printf("[INFO] Testing if password authentication is supported by ssh://%s@%s:%d\n", miscptr == NULL ? "hydra" : miscptr, hydra_address2string(ip), port);
|
printf("[INFO] Testing if password authentication is supported by ssh://%s@%s:%d\n", miscptr == NULL ? "hydra" : miscptr, hydra_address2string_beautiful(ip), port);
|
||||||
ssh_options_set(session, SSH_OPTIONS_PORT, &port);
|
ssh_options_set(session, SSH_OPTIONS_PORT, &port);
|
||||||
ssh_options_set(session, SSH_OPTIONS_HOST, hydra_address2string(ip));
|
ssh_options_set(session, SSH_OPTIONS_HOST, hydra_address2string(ip));
|
||||||
if (miscptr == NULL)
|
if (miscptr == NULL)
|
||||||
|
@ -182,7 +182,7 @@ int32_t service_ssh_init(char *ip, int32_t sp, unsigned char options, char *misc
|
||||||
ssh_options_set(session, SSH_OPTIONS_COMPRESSION_C_S, "none");
|
ssh_options_set(session, SSH_OPTIONS_COMPRESSION_C_S, "none");
|
||||||
ssh_options_set(session, SSH_OPTIONS_COMPRESSION_S_C, "none");
|
ssh_options_set(session, SSH_OPTIONS_COMPRESSION_S_C, "none");
|
||||||
if (ssh_connect(session) != 0) {
|
if (ssh_connect(session) != 0) {
|
||||||
fprintf(stderr, "[ERROR] could not connect to ssh://%s:%d - %s\n", hydra_address2string(ip), port, ssh_get_error(session));
|
fprintf(stderr, "[ERROR] could not connect to ssh://%s:%d - %s\n", hydra_address2string_beautiful(ip), port, ssh_get_error(session));
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
rc = ssh_userauth_none(session, NULL);
|
rc = ssh_userauth_none(session, NULL);
|
||||||
|
@ -193,11 +193,11 @@ int32_t service_ssh_init(char *ip, int32_t sp, unsigned char options, char *misc
|
||||||
|
|
||||||
if ((method & SSH_AUTH_METHOD_INTERACTIVE) || (method & SSH_AUTH_METHOD_PASSWORD)) {
|
if ((method & SSH_AUTH_METHOD_INTERACTIVE) || (method & SSH_AUTH_METHOD_PASSWORD)) {
|
||||||
if (verbose || debug)
|
if (verbose || debug)
|
||||||
printf("[INFO] Successful, password authentication is supported by ssh://%s:%d\n", hydra_address2string(ip), port);
|
printf("[INFO] Successful, password authentication is supported by ssh://%s:%d\n", hydra_address2string_beautiful(ip), port);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "[ERROR] target ssh://%s:%d/ does not support password authentication.\n", hydra_address2string(ip), port);
|
fprintf(stderr, "[ERROR] target ssh://%s:%d/ does not support password authentication.\n", hydra_address2string_beautiful(ip), port);
|
||||||
return 1;
|
return 1;
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -103,10 +103,7 @@ int32_t start_svn(int32_t s, char *ip, int32_t port, unsigned char options, char
|
||||||
svn_auth_open(&ctx->auth_baton, providers, pool);
|
svn_auth_open(&ctx->auth_baton, providers, pool);
|
||||||
|
|
||||||
revision.kind = svn_opt_revision_head;
|
revision.kind = svn_opt_revision_head;
|
||||||
if (ipv6)
|
snprintf(URL, sizeof(URL), "svn://%s:%d/%s", hydra_address2string_beautiful(ip), port, URLBRANCH);
|
||||||
snprintf(URL, sizeof(URL), "svn://[%s]:%d/%s", hydra_address2string(ip), port, URLBRANCH);
|
|
||||||
else
|
|
||||||
snprintf(URL, sizeof(URL), "svn://%s:%d/%s", hydra_address2string(ip), port, URLBRANCH);
|
|
||||||
dirents = SVN_DIRENT_KIND;
|
dirents = SVN_DIRENT_KIND;
|
||||||
canonical = svn_uri_canonicalize(URL, pool);
|
canonical = svn_uri_canonicalize(URL, pool);
|
||||||
//err = svn_client_list2(canonical, &revision, &revision, svn_depth_unknown, dirents, FALSE, print_dirdummy, NULL, ctx, pool);
|
//err = svn_client_list2(canonical, &revision, &revision, svn_depth_unknown, dirents, FALSE, print_dirdummy, NULL, ctx, pool);
|
||||||
|
|
3
hydra.c
3
hydra.c
|
@ -211,6 +211,7 @@ extern char *hydra_strcasestr(const char *haystack, const char *needle);
|
||||||
extern void hydra_tobase64(unsigned char *buf, int32_t buflen, int32_t bufsize);
|
extern void hydra_tobase64(unsigned char *buf, int32_t buflen, int32_t bufsize);
|
||||||
extern char *hydra_string_replace(const char *string, const char *substr, const char *replacement);
|
extern char *hydra_string_replace(const char *string, const char *substr, const char *replacement);
|
||||||
extern char *hydra_address2string(char *address);
|
extern char *hydra_address2string(char *address);
|
||||||
|
extern char *hydra_address2string_beautiful(char *address);
|
||||||
extern int32_t colored_output;
|
extern int32_t colored_output;
|
||||||
extern char quiet;
|
extern char quiet;
|
||||||
extern int32_t do_retry;
|
extern int32_t do_retry;
|
||||||
|
@ -638,7 +639,7 @@ void hydra_debug(int32_t force, char *string) {
|
||||||
hydra_target* target = hydra_targets[i];
|
hydra_target* target = hydra_targets[i];
|
||||||
printf
|
printf
|
||||||
("[DEBUG] Target %d - target %s ip %s login_no %llu pass_no %llu sent %llu pass_state %d redo_state %d (%d redos) use_count %d failed %d done %d fail_count %d login_ptr %s pass_ptr %s\n",
|
("[DEBUG] Target %d - target %s ip %s login_no %llu pass_no %llu sent %llu pass_state %d redo_state %d (%d redos) use_count %d failed %d done %d fail_count %d login_ptr %s pass_ptr %s\n",
|
||||||
i, STR_NULL(target->target), hydra_address2string(target->ip),
|
i, STR_NULL(target->target), hydra_address2string_beautiful(target->ip),
|
||||||
target->login_no, target->pass_no, target->sent,
|
target->login_no, target->pass_no, target->sent,
|
||||||
target->pass_state, target->redo_state, target->redo,
|
target->pass_state, target->redo_state, target->redo,
|
||||||
target->use_count, target->failed, target->done,
|
target->use_count, target->failed, target->done,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue