mirror of
https://github.com/vanhauser-thc/thc-hydra.git
synced 2025-07-06 13:01:42 -07:00
commit
7a4fa7b51e
2 changed files with 52 additions and 29 deletions
|
@ -65,7 +65,7 @@ int start_ncp(int s, char *ip, int port, unsigned char options, char *miscptr, F
|
||||||
}
|
}
|
||||||
memset(context, 0, sizeof(context));
|
memset(context, 0, sizeof(context));
|
||||||
strncpy(context, login, strlen(login));
|
strncpy(context, login, strlen(login));
|
||||||
strncpy(context + strlen(login), miscptr, sizeof(miscptr) + 1);
|
strncpy(context + strlen(login), miscptr, sizeof(char) + 1);
|
||||||
login = context;
|
login = context;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
79
hydra.c
79
hydra.c
|
@ -660,42 +660,65 @@ void module_usage() {
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define STR_NULL(s) ((s) == NULL ? "(null)" : (s))
|
||||||
|
|
||||||
void hydra_debug(int force, char *string) {
|
void hydra_debug(int force, char *string) {
|
||||||
int i, active = 0, inactive = 0;
|
int active = 0;
|
||||||
|
int inactive = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (!debug && !force)
|
if (!debug && !force)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
printf("[DEBUG] Code: %s Time: %lu\n", string, (unsigned long int) time(NULL));
|
printf("[DEBUG] Code: %s Time: %lu\n", string, (unsigned long int) time(NULL));
|
||||||
printf("[DEBUG] Options: mode %d ssl %d restore %d showAttempt %d tasks %d max_use %d tnp %d tpsal %d tprl %d exit_found %d miscptr %s service %s\n",
|
printf("[DEBUG] Options: mode %d ssl %d restore %d showAttempt %d tasks %d max_use %d tnp %d tpsal %d tprl %d exit_found %d miscptr %s service %s\n",
|
||||||
hydra_options.mode, hydra_options.ssl, hydra_options.restore, hydra_options.showAttempt, hydra_options.tasks, hydra_options.max_use,
|
hydra_options.mode, hydra_options.ssl, hydra_options.restore,
|
||||||
hydra_options.try_null_password, hydra_options.try_password_same_as_login, hydra_options.try_password_reverse_login, hydra_options.exit_found,
|
hydra_options.showAttempt, hydra_options.tasks, hydra_options.max_use,
|
||||||
hydra_options.miscptr == NULL ? "(null)" : hydra_options.miscptr, hydra_options.service);
|
hydra_options.try_null_password, hydra_options.try_password_same_as_login,
|
||||||
|
hydra_options.try_password_reverse_login, hydra_options.exit_found,
|
||||||
|
STR_NULL(hydra_options.miscptr), hydra_options.service);
|
||||||
|
|
||||||
printf("[DEBUG] Brains: active %d targets %d finished %d todo_all %lu todo %lu sent %lu found %lu countlogin %lu sizelogin %lu countpass %lu sizepass %lu\n",
|
printf("[DEBUG] Brains: active %d targets %d finished %d todo_all %lu todo %lu sent %lu found %lu countlogin %lu sizelogin %lu countpass %lu sizepass %lu\n",
|
||||||
hydra_brains.active, hydra_brains.targets, hydra_brains.finished, hydra_brains.todo_all + total_redo_count, hydra_brains.todo, hydra_brains.sent, hydra_brains.found,
|
hydra_brains.active, hydra_brains.targets, hydra_brains.finished,
|
||||||
(unsigned long int) hydra_brains.countlogin, (unsigned long int) hydra_brains.sizelogin, (unsigned long int) hydra_brains.countpass,
|
hydra_brains.todo_all + total_redo_count, hydra_brains.todo,
|
||||||
|
hydra_brains.sent, hydra_brains.found,
|
||||||
|
(unsigned long int) hydra_brains.countlogin,
|
||||||
|
(unsigned long int) hydra_brains.sizelogin,
|
||||||
|
(unsigned long int) hydra_brains.countpass,
|
||||||
(unsigned long int) hydra_brains.sizepass);
|
(unsigned long int) hydra_brains.sizepass);
|
||||||
for (i = 0; i < hydra_brains.targets; i++)
|
|
||||||
|
for (i = 0; i < hydra_brains.targets; i++) {
|
||||||
|
hydra_target* target = hydra_targets[i];
|
||||||
printf
|
printf
|
||||||
("[DEBUG] Target %d - target %s ip %s login_no %lu pass_no %lu sent %lu 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 %lu pass_no %lu sent %lu 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, hydra_targets[i]->target == NULL ? "(null)" : hydra_targets[i]->target, hydra_address2string(hydra_targets[i]->ip), hydra_targets[i]->login_no,
|
i, STR_NULL(target->target), hydra_address2string(target->ip),
|
||||||
hydra_targets[i]->pass_no, hydra_targets[i]->sent, hydra_targets[i]->pass_state, hydra_targets[i]->redo_state, hydra_targets[i]->redo, hydra_targets[i]->use_count, hydra_targets[i]->failed, hydra_targets[i]->done,
|
target->login_no, target->pass_no, target->sent,
|
||||||
hydra_targets[i]->fail_count, hydra_targets[i]->login_ptr == NULL ? "(null)" : hydra_targets[i]->login_ptr,
|
target->pass_state, target->redo_state, target->redo,
|
||||||
hydra_targets[i]->pass_ptr == NULL ? "(null)" : hydra_targets[i]->pass_ptr);
|
target->use_count, target->failed, target->done,
|
||||||
if (hydra_heads != NULL) {
|
target->fail_count,
|
||||||
for (i = 0; i < hydra_options.max_use; i++)
|
STR_NULL(target->login_ptr),
|
||||||
if (hydra_heads[i]->active >= 0) {
|
STR_NULL(target->pass_ptr));
|
||||||
printf("[DEBUG] Task %d - pid %d active %d redo %d current_login_ptr %s current_pass_ptr %s\n",
|
|
||||||
i, (int) hydra_heads[i]->pid, hydra_heads[i]->active, hydra_heads[i]->redo,
|
|
||||||
hydra_heads[i]->current_login_ptr == NULL ? "(null)" : hydra_heads[i]->current_login_ptr,
|
|
||||||
hydra_heads[i]->current_pass_ptr == NULL ? "(null)" : hydra_heads[i]->current_pass_ptr);
|
|
||||||
if (hydra_heads[i]->active == 0)
|
|
||||||
inactive++;
|
|
||||||
else
|
|
||||||
active++;
|
|
||||||
}
|
|
||||||
printf("[DEBUG] Tasks %d inactive %d active\n", inactive, active);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hydra_heads == NULL) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < hydra_options.max_use; i++) {
|
||||||
|
if (hydra_heads[i]->active >= 0) {
|
||||||
|
printf("[DEBUG] Task %d - pid %d active %d redo %d current_login_ptr %s current_pass_ptr %s\n",
|
||||||
|
i, (int) hydra_heads[i]->pid,
|
||||||
|
hydra_heads[i]->active,
|
||||||
|
hydra_heads[i]->redo,
|
||||||
|
STR_NULL(hydra_heads[i]->current_login_ptr),
|
||||||
|
STR_NULL(hydra_heads[i]->current_pass_ptr));
|
||||||
|
if (hydra_heads[i]->active == 0)
|
||||||
|
inactive++;
|
||||||
|
else
|
||||||
|
active++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("[DEBUG] Tasks %d inactive %d active\n", inactive, active);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bail(char *text) {
|
void bail(char *text) {
|
||||||
|
@ -3512,7 +3535,7 @@ int main(int argc, char *argv[]) {
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
// if (countinfile > 60) fprintf(stderr, "[WARNING] the -M option is not working correctly at the moment for target lists > 60!\n");
|
// if (countinfile > 60) fprintf(stderr, "[WARNING] the -M option is not working correctly at the moment for target lists > 60!\n");
|
||||||
hydra_targets = malloc(sizeof(hydra_targets) * (countservers + 2) + 8);
|
hydra_targets = malloc(sizeof(hydra_target*) * (countservers + 2) + 8);
|
||||||
if (hydra_targets == NULL)
|
if (hydra_targets == NULL)
|
||||||
bail("Could not allocate enough memory for target data");
|
bail("Could not allocate enough memory for target data");
|
||||||
sizeinfile = size_of_data;
|
sizeinfile = size_of_data;
|
||||||
|
@ -3600,7 +3623,7 @@ int main(int argc, char *argv[]) {
|
||||||
four_from = (addr4 & l);
|
four_from = (addr4 & l);
|
||||||
l = 1 << (32 - k);
|
l = 1 << (32 - k);
|
||||||
hydra_brains.targets = countservers = l;
|
hydra_brains.targets = countservers = l;
|
||||||
hydra_targets = malloc(sizeof(hydra_targets) * (l + 2) + 8);
|
hydra_targets = malloc(sizeof(hydra_target*) * (l + 2) + 8);
|
||||||
if (hydra_targets == NULL)
|
if (hydra_targets == NULL)
|
||||||
bail("Could not allocate enough memory for target data");
|
bail("Could not allocate enough memory for target data");
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@ -3864,7 +3887,7 @@ int main(int argc, char *argv[]) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (hydra_options.restore == 0) {
|
if (hydra_options.restore == 0) {
|
||||||
hydra_heads = malloc(sizeof(hydra_heads) * hydra_options.max_use);
|
hydra_heads = malloc(sizeof(hydra_head*) * hydra_options.max_use);
|
||||||
target_no = 0;
|
target_no = 0;
|
||||||
for (i = 0; i < hydra_options.max_use; i++) {
|
for (i = 0; i < hydra_options.max_use; i++) {
|
||||||
hydra_heads[i] = malloc(sizeof(hydra_head));
|
hydra_heads[i] = malloc(sizeof(hydra_head));
|
||||||
|
@ -4151,7 +4174,7 @@ int main(int argc, char *argv[]) {
|
||||||
hydra_brains.sent, // tries
|
hydra_brains.sent, // tries
|
||||||
(long unsigned int) ((elapsed_status - starttime) / 3600), // hours
|
(long unsigned int) ((elapsed_status - starttime) / 3600), // hours
|
||||||
(long unsigned int) (((elapsed_status - starttime) % 3600) / 60), // minutes
|
(long unsigned int) (((elapsed_status - starttime) % 3600) / 60), // minutes
|
||||||
(hydra_brains.todo_all + total_redo_count) - hydra_brains.sent <= 0 ? 1 : (hydra_brains.todo_all + total_redo_count) - hydra_brains.sent, // left todo
|
(hydra_brains.todo_all + total_redo_count) - hydra_brains.sent, // left todo
|
||||||
(long unsigned int) (((double) (hydra_brains.todo_all + total_redo_count) - hydra_brains.sent) / ((double) hydra_brains.sent / (elapsed_status - starttime))
|
(long unsigned int) (((double) (hydra_brains.todo_all + total_redo_count) - hydra_brains.sent) / ((double) hydra_brains.sent / (elapsed_status - starttime))
|
||||||
) / 3600, // hours
|
) / 3600, // hours
|
||||||
(((long unsigned int) (((double) (hydra_brains.todo_all + total_redo_count) - hydra_brains.sent) / ((double) hydra_brains.sent / (elapsed_status - starttime))
|
(((long unsigned int) (((double) (hydra_brains.todo_all + total_redo_count) - hydra_brains.sent) / ((double) hydra_brains.sent / (elapsed_status - starttime))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue