Checking for gcrypt support & disabling radmin2 when it is unavailable.

This commit is contained in:
catatonic 2017-07-07 19:34:52 +00:00
parent c5d98dc352
commit 1503c8a381
4 changed files with 41 additions and 1 deletions

View file

@ -3,7 +3,7 @@
#
OPTS=-I. -O3
# -Wall -g -pedantic
LIBS=-lm -lgcrypt
LIBS=-lm
BINDIR = /bin
MANDIR ?= /man/man1/
DATADIR ?= /etc

24
configure vendored
View file

@ -36,6 +36,7 @@ CURSES_IPATH=""
CRYPTO_PATH=""
IDN_PATH=""
IDN_IPATH=""
GCRYPT_PATH=""
PR29_IPATH=""
PCRE_PATH=""
PCRE_IPATH=""
@ -242,6 +243,22 @@ if [ "$SSL_IPATH" = "/usr/include" ]; then
SSL_IPATH=""
fi
echo "Checking for gcrypt (libgcrypt.so) ..."
for i in $LIBDIRS ; do
if [ "X" = "X$GCRYPT_PATH" ]; then
if [ -f "$i/libgcrypt.so" -o -f "$i/libgcrypt.dylib" -o -f "$i/libgcrypt.a" -o -f "$i/libgcrypt.dll.a" -o -f "$i/libgcrypt.la" ]; then
HAVE_GCRYPT="y"
fi
fi
done
if [ -n "$HAVE_GCRYPT" ]; then
echo " ... found"
else
echo " ... gcrypt not found, gcrypt support disabled"
fi
echo "Checking for idn (libidn.so) ..."
for i in $LIBDIRS ; do
if [ "X" = "X$IDN_PATH" ]; then
@ -1069,6 +1086,10 @@ fi
if [ -n "$HAVE_ZLIB" ]; then
XDEFINES="$XDEFINES -DHAVE_ZLIB"
fi
if [ -n "$HAVE_GCRYPT" ]; then
XDEFINES="$XDEFINES -DHAVE_GCRYPT"
fi
OLDPATH=""
for i in $SSL_PATH $FIREBIRD_PATH $WORACLE_LIB_PATH $PCRE_PATH $IDN_PATH $CRYPTO_PATH $SSH_PATH $NSL_PATH $SOCKET_PATH $RESOLV_PATH $SAPR3_PATH $POSTGRES_PATH $SVN_PATH $NCP_PATH $CURSES_PATH $ORACLE_PATH $AFP_PATH $MYSQL_PATH; do
@ -1124,6 +1145,9 @@ fi
if [ -n "$ORACLE_IPATH" ]; then
XIPATHS="$XIPATHS -I$ORACLE_IPATH"
fi
if [ -n "$HAVE_GCRYPT" ]; then
XLIBS="$XLIBS -lgcrypt"
fi
if [ -n "$HAVE_ZLIB" ]; then
XLIBS="$XLIBS -lz"
fi

View file

@ -1,7 +1,9 @@
#include "hydra-mod.h"
#include <arpa/inet.h>
#include <unistd.h>
#ifdef HAVE_GCRYPT
#include <gcrypt.h>
#endif
extern char *HYDRA_EXIT;
@ -167,6 +169,7 @@ int start_radmin2(int s, char *ip, int port, unsigned char options, char *miscpt
}
void service_radmin2(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {
#ifdef HAVE_GCRYPT
int sock = -1;
int index;
int bytecount;
@ -341,6 +344,7 @@ void service_radmin2(char *ip, int sp, unsigned char options, char *miscptr, FIL
hydra_child_exit(2);
}
}
#endif
}
int service_radmin2_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {

12
hydra.c
View file

@ -57,7 +57,9 @@ extern void service_http_proxy_urlenum(char *ip, int sp, unsigned char options,
extern void service_s7_300(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname);
extern void service_rtsp(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname);
extern void service_rpcap(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname);
#ifdef HAVE_GCRYPT
extern void service_radmin2(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname);
#endif
// ADD NEW SERVICES HERE
@ -148,7 +150,9 @@ extern int service_xmpp_init(char *ip, int sp, unsigned char options, char *misc
extern int service_s7_300_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname);
extern int service_rtsp_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname);
extern int service_rpcap_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname);
#ifdef HAVE_GCRYPT
extern int service_radmin2_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname);
#endif
// ADD NEW SERVICES HERE
@ -1265,8 +1269,10 @@ void hydra_service_init(int target_no) {
x = service_rtsp_init(hydra_targets[target_no]->ip, -1, options, hydra_options.miscptr, hydra_brains.ofp, hydra_targets[target_no]->port, hydra_targets[target_no]->target);
if (strcmp(hydra_options.service, "rpcap") == 0)
x = service_rpcap_init(hydra_targets[target_no]->ip, -1, options, hydra_options.miscptr, hydra_brains.ofp, hydra_targets[target_no]->port, hydra_targets[target_no]->target);
#ifdef HAVE_GCRYPT
if (strcmp(hydra_options.service, "radmin2") == 0)
x = service_radmin2_init(hydra_targets[target_no]->ip, -1, options, hydra_options.miscptr, hydra_brains.ofp, hydra_targets[target_no]->port, hydra_targets[target_no]->target);
#endif
// ADD NEW SERVICES HERE
@ -1473,8 +1479,10 @@ int hydra_spawn_head(int head_no, int target_no) {
service_rtsp(hydra_targets[target_no]->ip, hydra_heads[head_no]->sp[1], options, hydra_options.miscptr, hydra_brains.ofp, hydra_targets[target_no]->port, hydra_targets[hydra_heads[head_no]->target_no]->target);
if (strcmp(hydra_options.service, "rpcap") == 0)
service_rpcap(hydra_targets[target_no]->ip, hydra_heads[head_no]->sp[1], options, hydra_options.miscptr, hydra_brains.ofp, hydra_targets[target_no]->port, hydra_targets[hydra_heads[head_no]->target_no]->target);
#ifdef HAVE_GCRYPT
if (strcmp(hydra_options.service, "radmin2") == 0)
service_radmin2(hydra_targets[target_no]->ip, hydra_heads[head_no]->sp[1], options, hydra_options.miscptr, hydra_brains.ofp, hydra_targets[target_no]->port, hydra_targets[hydra_heads[head_no]->target_no]->target);
#endif
// ADD NEW SERVICES HERE
@ -3275,7 +3283,11 @@ int main(int argc, char *argv[]) {
i = 1;
}
if (strcmp(hydra_options.service, "radmin2") == 0)
#ifdef HAVE_GCRYPT
i = 1;
#else
bail("Compiled without gcrypt support");
#endif
// ADD NEW SERVICES HERE