more variance for rtsp, code format

This commit is contained in:
vanhauser-thc 2022-04-26 12:09:03 +02:00
parent 73029ac1a5
commit a1cbbe1432
3 changed files with 18 additions and 17 deletions

View file

@ -58,7 +58,8 @@ int32_t start_rdp(char *ip, int32_t port, unsigned char options, char *miscptr,
} }
login_result = rdp_connect(server, port, domain, login, pass); login_result = rdp_connect(server, port, domain, login, pass);
if (debug) hydra_report(stderr, "[DEBUG] rdp reported %08x\n", login_result); if (debug)
hydra_report(stderr, "[DEBUG] rdp reported %08x\n", login_result);
switch (login_result) { switch (login_result) {
case 0: case 0:
// login success // login success

View file

@ -9,6 +9,7 @@
#include "hydra-mod.h" #include "hydra-mod.h"
#include "sasl.h" #include "sasl.h"
#include <stdio.h> #include <stdio.h>
#define _GNU_SOURCE
#include <string.h> #include <string.h>
extern char *HYDRA_EXIT; extern char *HYDRA_EXIT;
@ -16,7 +17,7 @@ char packet[500];
char packet2[500]; char packet2[500];
int32_t is_Unauthorized(char *s) { int32_t is_Unauthorized(char *s) {
if (strstr(s, "401 Unauthorized") != NULL) { if (strcasestr(s, "401 Unauthorized") != NULL) {
return 1; return 1;
} else { } else {
return 0; return 0;
@ -24,7 +25,7 @@ int32_t is_Unauthorized(char *s) {
} }
int32_t is_NotFound(char *s) { int32_t is_NotFound(char *s) {
if (strstr(s, "404 Stream Not Found") != NULL) { if (strcasestr(s, "404 Stream") != NULL || strcasestr(s, "404 Not") != NULL) {
return 1; return 1;
} else { } else {
return 0; return 0;
@ -32,7 +33,7 @@ int32_t is_NotFound(char *s) {
} }
int32_t is_Authorized(char *s) { int32_t is_Authorized(char *s) {
if (strstr(s, "200 OK") != NULL) { if (strcasestr(s, "200 OK") != NULL) {
return 1; return 1;
} else { } else {
return 0; return 0;
@ -40,7 +41,7 @@ int32_t is_Authorized(char *s) {
} }
int32_t use_Basic_Auth(char *s) { int32_t use_Basic_Auth(char *s) {
if (strstr(s, "WWW-Authenticate: Basic") != NULL) { if (strcasestr(s, "WWW-Authenticate: Basic") != NULL) {
return 1; return 1;
} else { } else {
return 0; return 0;
@ -48,7 +49,7 @@ int32_t use_Basic_Auth(char *s) {
} }
int32_t use_Digest_Auth(char *s) { int32_t use_Digest_Auth(char *s) {
if (strstr(s, "WWW-Authenticate: Digest") != NULL) { if (strcasestr(s, "WWW-Authenticate: Digest") != NULL) {
return 1; return 1;
} else { } else {
return 0; return 0;

21
hydra.c
View file

@ -1520,13 +1520,13 @@ void hydra_increase_fail_count(int32_t target_no, int32_t head_no) {
hydra_heads[head_no]->current_login_ptr = empty_login; hydra_heads[head_no]->current_login_ptr = empty_login;
hydra_heads[head_no]->current_pass_ptr = empty_login; hydra_heads[head_no]->current_pass_ptr = empty_login;
} }
/* /*
hydra_targets[target_no]->fail_count--; hydra_targets[target_no]->fail_count--;
if (k < 5 && hydra_targets[target_no]->ok) if (k < 5 && hydra_targets[target_no]->ok)
hydra_targets[target_no]->fail_count--; hydra_targets[target_no]->fail_count--;
if (k == 2 && hydra_targets[target_no]->ok) if (k == 2 && hydra_targets[target_no]->ok)
hydra_targets[target_no]->fail_count--; hydra_targets[target_no]->fail_count--;
*/ */
if (hydra_brains.targets <= hydra_brains.finished) if (hydra_brains.targets <= hydra_brains.finished)
hydra_kill_head(head_no, 1, 0); hydra_kill_head(head_no, 1, 0);
else { else {
@ -1638,7 +1638,7 @@ int32_t hydra_send_next_pair(int32_t target_no, int32_t head_no) {
printf("[COMPLETED] target %s - login \"%s\" - pass \"%s\" - child %d - " printf("[COMPLETED] target %s - login \"%s\" - pass \"%s\" - child %d - "
"%" hPRIu64 " of %" hPRIu64 "\n", "%" hPRIu64 " of %" hPRIu64 "\n",
hydra_targets[target_no]->target, hydra_heads[head_no]->current_login_ptr, hydra_heads[head_no]->current_pass_ptr, head_no, hydra_targets[target_no]->sent, hydra_brains.todo + hydra_targets[target_no]->redo); hydra_targets[target_no]->target, hydra_heads[head_no]->current_login_ptr, hydra_heads[head_no]->current_pass_ptr, head_no, hydra_targets[target_no]->sent, hydra_brains.todo + hydra_targets[target_no]->redo);
//hydra_heads[head_no]->redo = 0; // hydra_heads[head_no]->redo = 0;
if (hydra_targets[target_no]->redo_state > 0) { if (hydra_targets[target_no]->redo_state > 0) {
if (hydra_targets[target_no]->redo_state <= hydra_targets[target_no]->redo) { if (hydra_targets[target_no]->redo_state <= hydra_targets[target_no]->redo) {
hydra_heads[head_no]->current_pass_ptr = hydra_targets[target_no]->redo_pass[hydra_targets[target_no]->redo_state - 1]; hydra_heads[head_no]->current_pass_ptr = hydra_targets[target_no]->redo_pass[hydra_targets[target_no]->redo_state - 1];
@ -3321,8 +3321,7 @@ int main(int argc, char *argv[]) {
hydra_options.port = port; hydra_options.port = port;
} }
if (hydra_options.login == NULL && hydra_options.loginfile == NULL && if (hydra_options.login == NULL && hydra_options.loginfile == NULL && hydra_options.colonfile == NULL)
hydra_options.colonfile == NULL)
hydra_options.exit_found = 1; hydra_options.exit_found = 1;
if (hydra_options.ssl == 0 && hydra_options.port == 443) if (hydra_options.ssl == 0 && hydra_options.port == 443)
@ -3948,7 +3947,7 @@ int main(int argc, char *argv[]) {
// restore device information if present (overwrite null bytes) // restore device information if present (overwrite null bytes)
if (device != NULL) { if (device != NULL) {
char *tmpptr = device - 1; char *tmpptr = device - 1;
*tmpptr = '%'; // you can ignore the compiler warning *tmpptr = '%'; // you can ignore the compiler warning
fprintf(stderr, "[WARNING] not all modules support BINDTODEVICE for IPv6 " fprintf(stderr, "[WARNING] not all modules support BINDTODEVICE for IPv6 "
"link local addresses, e.g. SSH does not\n"); "link local addresses, e.g. SSH does not\n");
} }