fixed -U crash

This commit is contained in:
van Hauser 2017-01-18 10:31:37 +01:00
commit f340852655
2 changed files with 15 additions and 5 deletions

View file

@ -12,6 +12,7 @@ Release 8.4-dev
-I : ignore an existing hydra.restore file (dont wait for 10 seconds) -I : ignore an existing hydra.restore file (dont wait for 10 seconds)
* Upgraded hydra-svn to work with the current libsvn version * Upgraded hydra-svn to work with the current libsvn version
* Fixed dpl4hydra to be able to update from the web again * Fixed dpl4hydra to be able to update from the web again
* Fixed crash when -U was used without any service (thanks to thecarterb for reporting)
* Updated default password lists * Updated default password lists
* The protocols vnc, xmpp, telnet, imap, nntp and pcanywhere got accidentially long sleep commands due a patch in 8.2, fixed * The protocols vnc, xmpp, telnet, imap, nntp and pcanywhere got accidentially long sleep commands due a patch in 8.2, fixed
* Added special error message for clueless users :) * Added special error message for clueless users :)

17
hydra.c
View file

@ -2728,13 +2728,17 @@ int main(int argc, char *argv[]) {
hydra_options.server = NULL; hydra_options.server = NULL;
hydra_options.service = NULL; hydra_options.service = NULL;
if (modusage) if (modusage) {
hydra_options.service = targetdef; hydra_options.service = targetdef;
else } else
help(0); help(0);
} }
} else { } else {
if (strstr(argv[optind], "://") != NULL) { if (modusage && argv[optind] == NULL) {
printf("[ERROR] you must supply a service name after the -U help switch\n");
exit(-1);
}
if (argv[optind] == NULL || strstr(argv[optind], "://") != NULL) {
printf("[ERROR] Invalid target definition!\n"); printf("[ERROR] Invalid target definition!\n");
printf("[ERROR] Either you use \"www.example.com module [optional-module-parameters]\" *or* you use the \"module://www.example.com/optional-module-parameters\" syntax!\n"); printf("[ERROR] Either you use \"www.example.com module [optional-module-parameters]\" *or* you use the \"module://www.example.com/optional-module-parameters\" syntax!\n");
exit(-1); exit(-1);
@ -2801,8 +2805,13 @@ int main(int argc, char *argv[]) {
if (strcmp(hydra_options.service, "https-form-post") == 0) if (strcmp(hydra_options.service, "https-form-post") == 0)
strcpy(hydra_options.service, "https-post-form"); strcpy(hydra_options.service, "https-post-form");
if (modusage == 1) if (modusage == 1) {
if (hydra_options.service == NULL) {
printf("[ERROR] you must supply a service name after the -U help switch\n");
exit(-1);
}
module_usage(); module_usage();
}
i = 0; i = 0;
if (strcmp(hydra_options.service, "telnet") == 0) { if (strcmp(hydra_options.service, "telnet") == 0) {