Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -rupN hydra-7.6/hydra.c hydra-7.6-redis/hydra.c
- --- hydra-7.6/hydra.c 2013-12-25 08:01:57.000000000 +0100
- +++ hydra-7.6-redis/hydra.c 2014-02-10 13:48:06.205464035 +0100
- @@ -118,6 +118,7 @@ extern int service_pcnfs_init(char *ip,
- extern int service_pop3_init(char *ip, int sp, unsigned char options,
- char *miscptr, FILE * fp, int port);
- extern int service_http_proxy_init(char *ip, int sp, unsigned char
- options, char *miscptr, FILE * fp, int port);
- extern int service_asterisk_init(char *ip, int sp, unsigned char
- options, char *miscptr, FILE * fp, int port);
- +extern int service_redis_init(char *ip, int sp, unsigned char
- options, char *miscptr, FILE * fp, int port);
- extern int service_rexec_init(char *ip, int sp, unsigned char
- options, char *miscptr, FILE * fp, int port);
- extern int service_rlogin_init(char *ip, int sp, unsigned char
- options, char *miscptr, FILE * fp, int port);
- extern int service_rsh_init(char *ip, int sp, unsigned char options,
- char *miscptr, FILE * fp, int port);
- @@ -135,7 +136,7 @@ extern int service_s7_300_init(char *ip,
- // ADD NEW SERVICES HERE
- -char *SERVICES = "asterisk afp cisco cisco-enable cvs firebird ftp
- ftps http[s]-{head|get} http[s]-{get|post}-form http-proxy
- http-proxy-urlenum icq imap[s] irc ldap2[s]
- ldap3[-{cram|digest}md5][s] mssql mysql ncp nntp oracle
- oracle-listener oracle-sid pcanywhere pcnfs pop3[s] postgres rdp rexec
- rlogin rsh s7-300 sapr3 sip smb smtp[s] smtp-enum snmp socks5 ssh
- sshkey svn teamspeak telnet[s] vmauthd vnc xmpp";
- +char *SERVICES = "redis asterisk afp cisco cisco-enable cvs firebird
- ftp ftps http[s]-{head|get} http[s]-{get|post}-form http-proxy
- http-proxy-urlenum icq imap[s] irc ldap2[s]
- ldap3[-{cram|digest}md5][s] mssql mysql ncp nntp oracle
- oracle-listener oracle-sid pcanywhere pcnfs pop3[s] postgres rdp rexec
- rlogin rsh s7-300 sapr3 sip smb smtp[s] smtp-enum snmp socks5 ssh
- sshkey svn teamspeak telnet[s] vmauthd vnc xmpp";
- #define MAXBUF 520
- #define MAXLINESIZE ( ( MAXBUF / 2 ) - 4 )
- @@ -1062,6 +1063,8 @@ void hydra_service_init(int target_no) {
- #endif
- if (strcmp(hydra_options.service, "ftp") == 0 ||
- strcmp(hydra_options.service, "ftps") == 0)
- x = service_ftp_init(hydra_targets[target_no]->ip, -1, options,
- hydra_options.miscptr, hydra_brains.ofp, port);
- + if (strcmp(hydra_options.service, "redis") == 0 ||
- strcmp(hydra_options.service, "redis") == 0)
- + x = service_redis_init(hydra_targets[target_no]->ip, -1, options,
- hydra_options.miscptr, hydra_brains.ofp, port);
- if (strcmp(hydra_options.service, "http-get") == 0 ||
- strcmp(hydra_options.service, "http-head") == 0)
- x = service_http_init(hydra_targets[target_no]->ip, -1, options,
- hydra_options.miscptr, hydra_brains.ofp, port);
- if (strcmp(hydra_options.service, "http-form") == 0 ||
- strcmp(hydra_options.service, "http-get-form") == 0 ||
- strcmp(hydra_options.service, "http-post-form") == 0)
- @@ -1214,6 +1217,8 @@ int hydra_spawn_head(int head_no, int ta
- service_ftp(hydra_targets[target_no]->ip,
- hydra_heads[head_no]->sp[1], options, hydra_options.miscptr,
- hydra_brains.ofp, port);
- if (strcmp(hydra_options.service, "ftps") == 0)
- service_ftps(hydra_targets[target_no]->ip,
- hydra_heads[head_no]->sp[1], options, hydra_options.miscptr,
- hydra_brains.ofp, port);
- + if (strcmp(hydra_options.service, "redis") == 0)
- + service_redis(hydra_targets[target_no]->ip,
- hydra_heads[head_no]->sp[1], options, hydra_options.miscptr,
- hydra_brains.ofp, port);
- if (strcmp(hydra_options.service, "pop3") == 0)
- service_pop3(hydra_targets[target_no]->ip,
- hydra_heads[head_no]->sp[1], options, hydra_options.miscptr,
- hydra_brains.ofp, port);
- if (strcmp(hydra_options.service, "imap") == 0)
- @@ -1430,6 +1435,7 @@ int hydra_lookup_port(char *service) {
- {"rdp", PORT_RDP, PORT_RDP_SSL},
- {"asterisk", PORT_ASTERISK, PORT_ASTERISK_SSL},
- {"s7-300", PORT_S7_300, PORT_S7_300_SSL},
- + {"redis", PORT_REDIS, PORT_REDIS_SSL},
- // ADD NEW SERVICES HERE - add new port numbers to hydra.h
- {"", PORT_NOPORT, PORT_NOPORT}
- };
- @@ -2471,6 +2477,8 @@ int main(int argc, char *argv[]) {
- fprintf(stderr, "[INFO] several providers have implemented
- cracking protection, check with a small wordlist first - and stay
- legal!\n");
- i = 1;
- }
- + if (strcmp(hydra_options.service, "redis") == 0)
- + i = 2;
- if (strcmp(hydra_options.service, "asterisk") == 0)
- i = 1;
- if (strcmp(hydra_options.service, "vmauthd") == 0)
- @@ -2912,7 +2920,7 @@ int main(int argc, char *argv[]) {
- if (hydra_options.colonfile != NULL
- || ((hydra_options.login != NULL || hydra_options.loginfile
- != NULL) && (hydra_options.pass != NULL || hydra_options.passfile !=
- NULL || hydra_options.bfg > 0)))
- bail
- - ("The cisco, oracle-listener, s7-300, snmp and vnc modules
- are only using the -p or -P option, not login (-l, -L) or colon file
- (-C).\nUse the telnet module for cisco using \"Username:\"
- authentication.\n");
- + ("The redis, cisco, oracle-listener, s7-300, snmp and vnc
- modules are only using the -p or -P option, not login (-l, -L) or
- colon file (-C).\nUse the telnet module for cisco using \"Username:\"
- authentication.\n");
- if ((hydra_options.login != NULL || hydra_options.loginfile !=
- NULL) && (hydra_options.pass == NULL || hydra_options.passfile ==
- NULL)) {
- hydra_options.pass = hydra_options.login;
- hydra_options.passfile = hydra_options.loginfile;
- diff -rupN hydra-7.6/hydra.h hydra-7.6-redis/hydra.h
- --- hydra-7.6/hydra.h 2013-12-13 20:07:51.000000000 +0100
- +++ hydra-7.6-redis/hydra.h 2014-02-10 13:07:04.929467717 +0100
- @@ -116,6 +116,8 @@
- #define PORT_ASTERISK_SSL 5038
- #define PORT_S7_300 102
- #define PORT_S7_300_SSL 102
- +#define PORT_REDIS 6379
- +#define PORT_REDIS_SSL 6379
- #define False 0
- #define True 1
- diff -rupN hydra-7.6/hydra-redis.c hydra-7.6-redis/hydra-redis.c
- --- hydra-7.6/hydra-redis.c 1970-01-01 01:00:00.000000000 +0100
- +++ hydra-7.6-redis/hydra-redis.c 2014-02-10 16:43:07.900448231 +0100
- @@ -0,0 +1,104 @@
- +#include "hydra-mod.h"
- +
- +extern char *HYDRA_EXIT;
- + char *buf;
- +
- +
- +
- +int start_redis(int s, char *ip, int port, unsigned char options,
- char *miscptr, FILE * fp) {
- + char *pass, buffer[510];
- + char *empty = "";
- +
- + if (strlen(pass = hydra_get_next_password()) == 0)
- + pass = empty;
- +
- + sprintf(buffer, "AUTH %.250s\r\n", pass);
- +
- + if (hydra_send(s, buffer, strlen(buffer), 0) < 0) {
- + return 1;
- + }
- + buf = hydra_receive_line(s);
- + if (buf[0] == '+') {
- + hydra_report_found_host(port, ip, "redis", fp);
- + hydra_completed_pair_found();
- + free(buf);
- + if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
- + return 3;
- + return 1;
- + }
- + if (verbose)
- + hydra_report(stderr, "[VERBOSE] Authentication failed for
- password %s\n", pass);
- + hydra_completed_pair();
- +
- + free(buf);
- +
- + return 1;
- +}
- +
- +void service_redis_core(char *ip, int sp, unsigned char options, char
- *miscptr, FILE * fp, int port, int tls) {
- + int run = 1, next_run = 1, sock = -1;
- + int myport = PORT_REDIS, mysslport = PORT_REDIS_SSL;
- +
- + hydra_register_socket(sp);
- + if (memcmp(hydra_get_next_pair(), &HYDRA_EXIT, sizeof(HYDRA_EXIT)) == 0)
- + hydra_child_exit(0);
- + while (1) {
- + switch (run) {
- + case 1: /* connect and service init function */
- + if (sock >= 0)
- + sock = hydra_disconnect(sock);
- + if ((options & OPTION_SSL) == 0) {
- + if (port != 0)
- + myport = port;
- + sock = hydra_connect_tcp(ip, myport);
- + port = myport;
- + } else {
- + if (port != 0)
- + mysslport = port;
- + sock = hydra_connect_ssl(ip, mysslport);
- + port = mysslport;
- + }
- + if (sock < 0) {
- + if (verbose || debug)
- + hydra_report(stderr, "[ERROR] Child with pid %d
- terminating, can not connect\n", (int) getpid());
- + hydra_child_exit(1);
- + }
- + usleep(250);
- + next_run = 2;
- + break;
- + case 2: /* run the cracking function */
- + next_run = start_redis(sock, ip, port, options, miscptr, fp);
- + break;
- + case 3: /* error exit */
- + if (sock >= 0)
- + sock = hydra_disconnect(sock);
- + hydra_child_exit(2);
- + case 4: /* clean exit */
- + if (sock >= 0)
- + sock = hydra_disconnect(sock);
- + hydra_child_exit(0);
- + default:
- + hydra_report(stderr, "[ERROR] Caught unknown return code, exiting!\n");
- + hydra_child_exit(2);
- + }
- + run = next_run;
- + }
- +}
- +
- +void service_redis(char *ip, int sp, unsigned char options, char
- *miscptr, FILE * fp, int port) {
- + service_redis_core(ip, sp, options, miscptr, fp, port, 0);
- +}
- +
- +int service_redis_init(char *ip, int sp, unsigned char options, char
- *miscptr, FILE * fp, int port) {
- + // called before the childrens are forked off, so this is the function
- + // which should be filled if initial connections and service setup has to be
- + // performed once only.
- + //
- + // fill if needed.
- + //
- + // return codes:
- + // 0 all OK
- + // -1 error, hydra will exit, so print a good error message here
- +
- + return 0;
- +}
- Binary files hydra-7.6/.hydra-vnc.c.swp and
- hydra-7.6-redis/.hydra-vnc.c.swp differ
- diff -rupN hydra-7.6/Makefile.am hydra-7.6-redis/Makefile.am
- --- hydra-7.6/Makefile.am 2013-12-25 08:06:44.000000000 +0100
- +++ hydra-7.6-redis/Makefile.am 2014-02-10 13:11:26.013467283 +0100
- @@ -6,7 +6,7 @@ OPTS=-I. -O3
- LIBS=-lm
- DIR=/bin
- -SRC = hydra-vnc.c hydra-pcnfs.c hydra-rexec.c hydra-nntp.c hydra-socks5.c \
- +SRC = hydra-redis.c 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-mysql.c hydra-mssql.c hydra-xmpp.c hydra-http-proxy-urlenum.c \
- @@ -17,7 +17,7 @@ SRC = hydra-vnc.c hydra-pcnfs.c hydra-re
- hydra-oracle-sid.c hydra-http-proxy.c hydra-http-form.c hydra-irc.c \
- hydra-rdp.c hydra-s7-300.c \
- crc32.c d3des.c bfg.c ntlm.c sasl.c hmacmd5.c hydra-mod.c
- -OBJ = hydra-vnc.o hydra-pcnfs.o hydra-rexec.o hydra-nntp.o hydra-socks5.o \
- +OBJ = hydra-redis.o hydra-vnc.o hydra-pcnfs.o hydra-rexec.o
- hydra-nntp.o hydra-socks5.o \
- hydra-telnet.o hydra-cisco.o hydra-http.o hydra-ftp.o hydra-imap.o \
- hydra-pop3.o hydra-smb.o hydra-icq.o hydra-cisco-enable.o hydra-ldap.o \
- hydra-mysql.o hydra-mssql.o hydra-xmpp.o hydra-http-proxy-urlenum.o \
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement