code format

This commit is contained in:
vanhauser-thc 2021-08-23 11:31:58 +02:00
parent 09453c7be8
commit 67ef4c733f
8 changed files with 22 additions and 34 deletions

View file

@ -2,6 +2,7 @@ Changelog for hydra
-------------------
Release 9.3-dev
* New module: cobaltstrike by ultimaiiii, thank you!
* fix for ssh to support -M or ip/range
* for vnc/cisco/... protocols that only check for a password, skip host
after the password is found

View file

@ -17,7 +17,7 @@ APPDIR = /share/applications
SRC = hydra-vnc.c hydra-pcnfs.c hydra-rexec.c hydra-nntp.c hydra-socks5.c \
hydra-telnet.c hydra-cisco.c hydra-http.c hydra-ftp.c hydra-imap.c \
hydra-pop3.c hydra-smb.c hydra-icq.c hydra-cisco-enable.c hydra-ldap.c \
hydra-memcached.c hydra-mongodb.c hydra-mysql.c hydra-mssql.c hydra-cobaltstrike.c hydra-xmpp.c \
hydra-memcached.c hydra-mongodb.c hydra-mysql.c hydra-mssql.c hydra-xmpp.c \
hydra-http-proxy-urlenum.c hydra-snmp.c hydra-cvs.c hydra-smtp.c \
hydra-smtp-enum.c hydra-sapr3.c hydra-ssh.c hydra-sshkey.c hydra-teamspeak.c \
hydra-postgres.c hydra-rsh.c hydra-rlogin.c hydra-oracle-listener.c \
@ -25,7 +25,7 @@ SRC = hydra-vnc.c hydra-pcnfs.c hydra-rexec.c hydra-nntp.c hydra-socks5.c \
hydra-asterisk.c hydra-firebird.c hydra-afp.c hydra-ncp.c hydra-rdp.c \
hydra-oracle-sid.c hydra-http-proxy.c hydra-http-form.c hydra-irc.c \
hydra-s7-300.c hydra-redis.c hydra-adam6500.c hydra-rtsp.c \
hydra-rpcap.c hydra-radmin2.c \
hydra-rpcap.c hydra-radmin2.c hydra-cobaltstrike.c \
hydra-time.c crc32.c d3des.c bfg.c ntlm.c sasl.c hmacmd5.c hydra-mod.c \
hydra-smb2.c
OBJ = hydra-vnc.o hydra-pcnfs.o hydra-rexec.o hydra-nntp.o hydra-socks5.o \

View file

@ -71,14 +71,12 @@ int32_t start_sip(int32_t s, char *ip, char *lip, int32_t port, int32_t lport, u
}
int32_t has_sip_cred = 0;
int32_t try
= 0;
int32_t try = 0;
/* We have to check many times because server may begin to send "100 Trying"
* before "401 Unauthorized" */
while (try < 2 && !has_sip_cred) {
try
++;
try++;
if (hydra_data_ready_timed(s, 3, 0) > 0) {
i = hydra_recv(s, (char *)buf, sizeof(buf) - 1);
if (i > 0)
@ -160,14 +158,12 @@ int32_t start_sip(int32_t s, char *ip, char *lip, int32_t port, int32_t lport, u
if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
return 3;
}
try
= 0;
try = 0;
int32_t has_resp = 0;
int32_t sip_code = 0;
while (try < 2 && !has_resp) {
try
++;
try++;
if (hydra_data_ready_timed(s, 5, 0) > 0) {
memset(buf, 0, sizeof(buf));
if ((i = hydra_recv(s, (char *)buf, sizeof(buf) - 1)) >= 0)

View file

@ -34,7 +34,7 @@ int32_t start_ssh(int32_t s, char *ip, int32_t port, unsigned char options, char
if (new_session) {
if (session) {
ssh_disconnect(session);
//ssh_finalize();
// ssh_finalize();
ssh_free(session);
} else {
ssh_init();

View file

@ -76,28 +76,16 @@ int32_t start_telnet(int32_t s, char *ip, int32_t port, unsigned char options, c
/*win7 answering with do terminal type = 0xfd 0x18 */
while ((buf = hydra_receive_line(s)) != NULL && make_to_lower(buf) && (strstr(buf, "password:") == NULL || strstr(buf, "login:") == NULL || strstr(buf, "last login:") != NULL) && strstr(buf, "sername:") == NULL) {
if ((miscptr != NULL && strstr(buf, miscptr) != NULL)
|| (miscptr == NULL
&& strstr(buf, "invalid") == NULL
&& strstr(buf, "incorrect") == NULL
&& strstr(buf, "bad ") == NULL
&& (strchr(buf, '/') != NULL
|| strchr(buf, '>') != NULL
|| strchr(buf, '$') != NULL
|| strchr(buf, '#') != NULL
|| strchr(buf, '%') != NULL
|| ((buf[1] == '\xfd')
&& (buf[2] == '\x18')))
)) {
if ((miscptr != NULL && strstr(buf, miscptr) != NULL) || (miscptr == NULL && strstr(buf, "invalid") == NULL && strstr(buf, "incorrect") == NULL && strstr(buf, "bad ") == NULL && (strchr(buf, '/') != NULL || strchr(buf, '>') != NULL || strchr(buf, '$') != NULL || strchr(buf, '#') != NULL || strchr(buf, '%') != NULL || ((buf[1] == '\xfd') && (buf[2] == '\x18'))))) {
hydra_report_found_host(port, ip, "telnet", fp);
hydra_completed_pair_found();
free(buf);
if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
return 3;
return 1;
} else if (buf && strstr(buf, "assword:") ) {
} else if (buf && strstr(buf, "assword:")) {
hydra_completed_pair();
//printf("password prompt\n");
// printf("password prompt\n");
free(buf);
if (strlen(pass = hydra_get_next_password()) == 0)
pass = empty;
@ -116,7 +104,7 @@ int32_t start_telnet(int32_t s, char *ip, int32_t port, unsigned char options, c
return 1;
}
}
} else if (buf && strstr(buf, "login:") ) {
} else if (buf && strstr(buf, "login:")) {
free(buf);
hydra_completed_pair();
return 2;

View file

@ -1935,8 +1935,11 @@ int32_t hydra_send_next_pair(int32_t target_no, int32_t head_no) {
// the above line
}
if (debug || hydra_options.showAttempt) {
printf("[%sATTEMPT] target %s - login \"%s\" - pass \"%s\" - %" hPRIu64 " of %" hPRIu64 " [child %d] (%d/%d)\n", hydra_targets[target_no]->redo_state ? "REDO-" : snp_is_redo ? "RE-" : "", hydra_targets[target_no]->target, hydra_heads[head_no]->current_login_ptr, hydra_heads[head_no]->current_pass_ptr, hydra_targets[target_no]->sent, hydra_brains.todo + hydra_targets[target_no]->redo, head_no, hydra_targets[target_no]->redo_state ? hydra_targets[target_no]->redo_state - 1 : 0,
hydra_targets[target_no]->redo);
printf("[%sATTEMPT] target %s - login \"%s\" - pass \"%s\" - %" hPRIu64 " of %" hPRIu64 " [child %d] (%d/%d)\n",
hydra_targets[target_no]->redo_state ? "REDO-"
: snp_is_redo ? "RE-"
: "",
hydra_targets[target_no]->target, hydra_heads[head_no]->current_login_ptr, hydra_heads[head_no]->current_pass_ptr, hydra_targets[target_no]->sent, hydra_brains.todo + hydra_targets[target_no]->redo, head_no, hydra_targets[target_no]->redo_state ? hydra_targets[target_no]->redo_state - 1 : 0, hydra_targets[target_no]->redo);
}
loop_cnt = 0;
return 0;