diff --git a/Makefile.am b/Makefile.am index f6b1a37..d608896 100755 --- a/Makefile.am +++ b/Makefile.am @@ -9,7 +9,7 @@ MANDIR ?= /man/man1/ DATADIR ?= /etc DESTDIR ?= -SRC = hydra-vnc.c hydra-pcnfs.c hydra-rexec.c hydra-nntp.c hydra-socks5.c \ +SRC = output-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 \ @@ -22,7 +22,7 @@ SRC = hydra-vnc.c hydra-pcnfs.c hydra-rexec.c hydra-nntp.c hydra-socks5.c \ hydra-s7-300.c hydra-redis.c hydra-adam6500.c hydra-rtsp.c \ hydra-rpcap.c hydra-radmin2.c \ hydra-time.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 = output-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 \ @@ -38,14 +38,14 @@ OBJ = hydra-vnc.o hydra-pcnfs.o hydra-rexec.o hydra-nntp.o hydra-socks5.o \ BINS = hydra pw-inspector EXTRA_DIST = README README.arm README.palm CHANGES TODO INSTALL LICENSE \ - hydra-mod.h hydra.h crc32.h d3des.h + hydra-mod.h output-redis.h hydra.h crc32.h d3des.h all: pw-inspector hydra $(XHYDRA_SUPPORT) @echo @echo Now type "make install" hydra: hydra.c $(OBJ) - $(CC) $(OPTS) $(SEC) $(LIBS) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o hydra $(HYDRA_LOGO) hydra.c $(OBJ) $(LIBS) $(XLIBS) $(XLIBPATHS) $(XIPATHS) $(XDEFINES) + $(CC) $(OPTS) $(SEC) $(LIBS) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o hydra $(HYDRA_LOGO) hydra.c $(OBJ) $(LIBS) $(XLIBS) $(XLIBPATHS) $(XIPATHS) $(XDEFINES) -L./lib/hiredis -lhiredis @echo @echo If men could get pregnant, abortion would be a sacrament @echo @@ -54,10 +54,10 @@ xhydra: -cd hydra-gtk && sh ./make_xhydra.sh pw-inspector: pw-inspector.c - -$(CC) $(OPTS) $(SEC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o pw-inspector $(PWI_LOGO) pw-inspector.c + -$(CC) $(OPTS) $(SEC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o pw-inspector $(PWI_LOGO) pw-inspector.c .c.o: - $(CC) $(OPTS) $(SEC) $(CFLAGS) $(CPPFLAGS) -c $< $(XDEFINES) $(XIPATHS) + cd ./lib/hiredis && make && cd ../../ && $(CC) $(OPTS) $(SEC) $(CFLAGS) $(CPPFLAGS) -c $< $(XDEFINES) $(XIPATHS) -L./lib/hiredis -lhiredis strip: all strip $(BINS) @@ -75,6 +75,7 @@ install: strip -cp -f hydra.1 xhydra.1 pw-inspector.1 $(DESTDIR)$(PREFIX)$(MANDIR) clean: + cd ./lib/hiredis && make clean && cd ../../ rm -rf xhydra pw-inspector hydra *.o core *.core *.stackdump *~ Makefile.in Makefile dev_rfc hydra.restore arm/*.ipk arm/ipkg/usr/bin/* hydra-gtk/src/*.o hydra-gtk/src/xhydra hydra-gtk/stamp-h hydra-gtk/config.status hydra-gtk/errors hydra-gtk/config.log hydra-gtk/src/.deps hydra-gtk/src/Makefile hydra-gtk/Makefile cp -f Makefile.orig Makefile diff --git a/hydra.c b/hydra.c old mode 100644 new mode 100755 index ae4837f..3e2e633 --- a/hydra.c +++ b/hydra.c @@ -9,6 +9,7 @@ */ #include "hydra.h" #include "bfg.h" +#include "output-redis.h" #ifdef LIBNCURSES #include @@ -2058,6 +2059,7 @@ void process_proxy_line(int32_t type, char *string) { int main(int argc, char *argv[]) { char *proxy_string = NULL, *device = NULL, *memcheck, *cmdtarget = NULL; char *outfile_format_tmp; + char *output; FILE *lfp = NULL, *pfp = NULL, *cfp = NULL, *ifp = NULL, *rfp = NULL, *proxyfp; size_t countinfile = 1, sizeinfile = 0; uint64_t math2; @@ -3511,12 +3513,18 @@ int main(int argc, char *argv[]) { exit(-1); } if (hydra_options.outfile_format == FORMAT_JSONV1) { + sprintf(output,"%s", "{ \"generator\": {" + "\"software\": \"%s\", \"version\": \"%s\", \"built\": \"%s\"," + "\"server\": \"%s\", \"service\": \"%s\", \"jsonoutputversion\": \"1.00\",\n" + "\"commandline\": \"%s"); fprintf(hydra_brains.ofp, "{ \"generator\": {\n" "\t\"software\": \"%s\", \"version\": \"%s\", \"built\": \"%s\",\n" "\t\"server\": \"%s\", \"service\": \"%s\", \"jsonoutputversion\": \"1.00\",\n" "\t\"commandline\": \"%s", PROGRAM, VERSION, hydra_build_time(), hydra_options.server == NULL ? hydra_options.infile_ptr : hydra_options.server, hydra_options.service, prg); + set("a", "2"); + for (i = 1; i < argc; i++) { char *t = hydra_string_replace(argv[i],"\"","\\\""); fprintf(hydra_brains.ofp, " %s", t); @@ -3787,6 +3795,7 @@ int main(int argc, char *argv[]) { hydra_heads[head_no]->current_pass_ptr != NULL ? hydra_string_replace(hydra_heads[head_no]->current_pass_ptr,"\"","\\\"") : "" ); fflush(hydra_brains.ofp); + set("a", "3"); } else if (hydra_options.outfile_ptr != NULL && hydra_brains.ofp != NULL) { // else output format == 0 aka text if (hydra_heads[head_no]->current_login_ptr == NULL || strlen(hydra_heads[head_no]->current_login_ptr) == 0) { if (hydra_heads[head_no]->current_pass_ptr == NULL || strlen(hydra_heads[head_no]->current_pass_ptr) == 0) @@ -4053,7 +4062,9 @@ int main(int argc, char *argv[]) { } fclose(hydra_brains.ofp); } - + set("output", output); + printf("%d", output); + redis_free(); fflush(NULL); if (error || j != 0 || exit_condition < 0) return -1; diff --git a/hydra.h b/hydra.h index d1fcc60..38bd7ba 100755 --- a/hydra.h +++ b/hydra.h @@ -28,6 +28,7 @@ #include #include #include +#include "output-redis.h" #ifdef HAVE_OPENSSL #define HYDRA_SSL diff --git a/output-redis.c b/output-redis.c new file mode 100755 index 0000000..d3ef782 --- /dev/null +++ b/output-redis.c @@ -0,0 +1,40 @@ +// +// hydra-rtsp.c +// hydra-rtsp +// +// Created by Javier zhukun on 03/04/18. +// +// + +#include "output-redis.h" + +void set(const unsigned char *key, const unsigned char *value) +{ + if (conn == NULL) + { + conn = redisConnect("127.0.0.1", 6379); + } + if(conn != NULL && conn->err) + { + + printf("connection error: %s\n",conn->errstr); + } + redisReply *reply = (redisReply*)redisCommand(conn,"set %s %s", key, value); + freeReplyObject(reply); + + /*reply = redisCommand(conn,"get %s", key); + printf("%s\n",reply->str); + freeReplyObject(reply); */ + + +} + +void redis_free() +{ + redisFree(conn); +} +/*int main() +{ + set("a", "1"); + return 0; +}*/ diff --git a/output-redis.h b/output-redis.h new file mode 100755 index 0000000..8f0d591 --- /dev/null +++ b/output-redis.h @@ -0,0 +1,15 @@ +// +// hydra-rtsp.c +// hydra-rtsp +// +// Created by Javier zhukun on 03/04/18. +// +// + +#include +#include "lib/hiredis/hiredis.h" + +redisContext *conn; + +void set(const unsigned char *key, const unsigned char *value); +void redis_free(); \ No newline at end of file diff --git a/quick b/quick new file mode 100755 index 0000000..96b82af --- /dev/null +++ b/quick @@ -0,0 +1,5 @@ +#rm -f output-redis +#gcc output-redis.c -o output-redis -L./lib/hiredis -lhiredis +make clean +./configure +make