mirror of
https://github.com/vanhauser-thc/thc-hydra.git
synced 2025-07-05 20:41:39 -07:00
fix xmpp for servers that send multiple lines
This commit is contained in:
parent
d8b31b9682
commit
1965e69d92
1 changed files with 46 additions and 47 deletions
93
hydra-xmpp.c
93
hydra-xmpp.c
|
@ -96,6 +96,7 @@ int start_xmpp(int s, char *ip, int port, unsigned char options, char *miscptr,
|
|||
/* server now would ask for the password */
|
||||
if ((strstr(buf, CHALLENGE_STR) != NULL) || (strstr(buf, CHALLENGE_STR2) != NULL)) {
|
||||
char *ptr = strstr(buf, CHALLENGE_STR);
|
||||
|
||||
if (!ptr)
|
||||
ptr = strstr(buf, CHALLENGE_STR2);
|
||||
char *ptr_end = strstr(ptr, CHALLENGE_END_STR);
|
||||
|
@ -334,56 +335,54 @@ void service_xmpp(char *target, char *ip, int sp, unsigned char options, char *m
|
|||
}
|
||||
//some server is longer to answer
|
||||
usleep(300000);
|
||||
buf = hydra_receive_line(sock);
|
||||
do {
|
||||
if ((buf = hydra_receive_line(sock)) == NULL) {
|
||||
/* no auth method identified */
|
||||
hydra_report(stderr, "[ERROR] no authentication methods can be identified %s\n", buf);
|
||||
free(buf);
|
||||
hydra_child_exit(1);
|
||||
}
|
||||
|
||||
if (buf == NULL)
|
||||
hydra_child_exit(1);
|
||||
if (strstr(buf, "<stream:stream") == NULL) {
|
||||
if (verbose || debug)
|
||||
hydra_report(stderr, "[ERROR] Not an xmpp protocol or service shutdown: %s\n", buf);
|
||||
free(buf);
|
||||
hydra_child_exit(1);
|
||||
}
|
||||
|
||||
if (strstr(buf, "<stream:stream") == NULL) {
|
||||
if (verbose || debug)
|
||||
hydra_report(stderr, "[ERROR] Not an xmpp protocol or service shutdown: %s\n", buf);
|
||||
if (strstr(buf, "<stream:error")) {
|
||||
if (strstr(buf, "<host-unknown"))
|
||||
hydra_report(stderr, "[ERROR] %s host unknown, you have to specify a fqdn xmpp server, the domain name will be used in the jabber init request : %s\n", domain, buf);
|
||||
else
|
||||
hydra_report(stderr, "[ERROR] xmpp protocol : %s\n", buf);
|
||||
free(buf);
|
||||
hydra_child_exit(1);
|
||||
}
|
||||
|
||||
/* try to identify which features is supported */
|
||||
if (strstr(buf, ":xmpp-tls") != NULL) {
|
||||
tls = 1;
|
||||
}
|
||||
|
||||
if (strstr(buf, ":xmpp-sasl") != NULL) {
|
||||
if (strstr(buf, "<mechanism>SCRAM-SHA-1</mechanism>") != NULL) {
|
||||
xmpp_auth_mechanism = AUTH_SCRAMSHA1;
|
||||
}
|
||||
if (strstr(buf, "<mechanism>CRAM-MD5</mechanism>") != NULL) {
|
||||
xmpp_auth_mechanism = AUTH_CRAMMD5;
|
||||
}
|
||||
if (strstr(buf, "<mechanism>DIGEST-MD5</mechanism>") != NULL) {
|
||||
xmpp_auth_mechanism = AUTH_DIGESTMD5;
|
||||
}
|
||||
if (strstr(buf, "<mechanism>PLAIN</mechanism>") != NULL) {
|
||||
xmpp_auth_mechanism = AUTH_PLAIN;
|
||||
}
|
||||
if (strstr(buf, "<mechanism>LOGIN</mechanism>") != NULL) {
|
||||
xmpp_auth_mechanism = AUTH_LOGIN;
|
||||
}
|
||||
}
|
||||
free(buf);
|
||||
hydra_child_exit(1);
|
||||
}
|
||||
|
||||
if (strstr(buf, "<stream:error")) {
|
||||
if (strstr(buf, "<host-unknown"))
|
||||
hydra_report(stderr, "[ERROR] %s host unknown, you have to specify a fqdn xmpp server, the domain name will be used in the jabber init request : %s\n", domain, buf);
|
||||
else
|
||||
hydra_report(stderr, "[ERROR] xmpp protocol : %s\n", buf);
|
||||
free(buf);
|
||||
hydra_child_exit(1);
|
||||
}
|
||||
|
||||
/* try to identify which features is supported */
|
||||
if (strstr(buf, ":xmpp-tls") != NULL) {
|
||||
tls = 1;
|
||||
}
|
||||
|
||||
if (strstr(buf, ":xmpp-sasl") != NULL) {
|
||||
if (strstr(buf, "<mechanism>SCRAM-SHA-1</mechanism>") != NULL) {
|
||||
xmpp_auth_mechanism = AUTH_SCRAMSHA1;
|
||||
}
|
||||
if (strstr(buf, "<mechanism>CRAM-MD5</mechanism>") != NULL) {
|
||||
xmpp_auth_mechanism = AUTH_CRAMMD5;
|
||||
}
|
||||
if (strstr(buf, "<mechanism>DIGEST-MD5</mechanism>") != NULL) {
|
||||
xmpp_auth_mechanism = AUTH_DIGESTMD5;
|
||||
}
|
||||
if (strstr(buf, "<mechanism>PLAIN</mechanism>") != NULL) {
|
||||
xmpp_auth_mechanism = AUTH_PLAIN;
|
||||
}
|
||||
if (strstr(buf, "<mechanism>LOGIN</mechanism>") != NULL) {
|
||||
xmpp_auth_mechanism = AUTH_LOGIN;
|
||||
}
|
||||
}
|
||||
if (xmpp_auth_mechanism == AUTH_ERROR) {
|
||||
/* no auth method identified */
|
||||
hydra_report(stderr, "[ERROR] no authentication methods can be identified %s\n", buf);
|
||||
free(buf);
|
||||
hydra_child_exit(1);
|
||||
}
|
||||
free(buf);
|
||||
} while (xmpp_auth_mechanism == AUTH_ERROR);
|
||||
|
||||
if ((miscptr != NULL) && (strlen(miscptr) > 0)) {
|
||||
int i;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue