replace rdesktop with freerdp for rdp module

This commit is contained in:
Tuan 2019-04-23 18:32:22 +07:00
parent 12f22f253b
commit f93b799384
3 changed files with 156 additions and 3151 deletions

93
configure vendored
View file

@ -69,6 +69,8 @@ NSL_PATH=""
SOCKET_PATH=""
MANDIR=""
XHYDRA_SUPPORT=""
FREERDP2_PATH=""
WINPR2_PATH=""
if [ '!' "X" = "X$*" ]; then
while [ $# -gt 0 ] ; do
@ -997,6 +999,78 @@ fi
fi
echo "Checking for Freerdp2 (libfreerdp2.so, freerdp/*.h, libwinpr2.so, winpr/*.h) ..."
for i in $LIBDIRS ; do
if [ "X" = "X$FREERDP2_PATH" ]; then
if [ -f "$i/libfreerdp2.so" -o -f "$i/libfreerdp2.dylib" -o -f "$i/libfreerdp2.a" ]; then
FREERDP2_PATH="$i"
fi
fi
if [ "X" = "X$FREERDP2_PATH" ]; then
TMP_LIB=`/bin/ls $i/libfreerdp2*.so* 2> /dev/null | grep libfreerdp2`
if [ -n "$TMP_LIB" ]; then
FREERDP2_PATH="$i"
fi
fi
done
FREERDP2_IPATH=
for i in $INCDIRS ; do
if [ "X" = "X$FREERDP2_IPATH" ]; then
if [ -f "$i/freerdp/freerdp.h" ]; then
FREERDP2_IPATH="$i/freerdp2"
fi
if [ -f "$i/freerdp2/freerdp/freerdp.h" ]; then
FREERDP2_IPATH="$i/freerdp2"
fi
fi
done
for i in $LIBDIRS ; do
if [ "X" = "X$WINPR2_PATH" ]; then
if [ -f "$i/libwinpr2.so" -o -f "$i/libwinpr2.dylib" -o -f "$i/libwinpr2.a" ]; then
WINPR2_PATH="$i"
fi
fi
if [ "X" = "X$WINPR2_PATH" ]; then
TMP_LIB=`/bin/ls $i/winpr.dll* 2> /dev/null | grep winpr`
if [ -n "$TMP_LIB" ]; then
WINPR2_PATH="$i"
fi
fi
done
WINPR2_IPATH=
for i in $INCDIRS ; do
if [ "X" = "X$WINPR2_IPATH" ]; then
if [ -f "$i/winpr.h" ]; then
WINPR2_IPATH="$i"
fi
if [ -f "$i/winpr2/winpr/winpr.h" ]; then
WINPR2_IPATH="$i/winpr2"
fi
fi
done
if [ "X" != "X$DEBUG" ]; then
echo DEBUG: FREERDP2_PATH=$FREERDP2_PATH/
echo DEBUG: FREERDP2_IPATH=$FREERDP2_IPATH/
echo DEBUG: WINPR2_PATH=$WINPR2_PATH/
echo DEBUG: WINPR2_IPATH=$WINPR2_IPATH/
fi
if [ -n "$FREERDP2_PATH" -a -n "$FREERDP2_IPATH" -a -n "$WINPR2_PATH" -a -n "$WINPR2_IPATH" ]; then
echo " ... found"
fi
if [ "X" = "X$FREERDP2_PATH" -o "X" = "X$FREERDP2_IPATH" -o "X" = "X$WINPR2_PATH" -o "X" = "X$WINPR2_IPATH" ]; then
echo " ... NOT found, module rdp disabled"
FREERDP2_PATH=""
FREERDP2_IPATH=""
WINPR2_PATH=""
WINPR2_IPATH=""
fi
echo "Checking for Mongodb (libmongoc-1.0.so, mongoc.h, libbson-1.0.so, bson.h) ..."
for i in $LIBDIRS ; do
@ -1180,7 +1254,7 @@ XLIBS=""
XLIBPATHS=""
XIPATHS=""
if [ -n "$FIREBIRD_PATH" -o -n "$PCRE_PATH" -o -n "$IDN_PATH" -o -n "$SSL_PATH" -o -n "$CRYPTO_PATH" -o -n "$NSL_PATH" -o -n "$SOCKET_PATH" -o -n "$RESOLV_PATH" -o -n "$SAPR3_PATH" -o -n "$SSH_PATH" -o -n "$POSTGRES_PATH" -o -n "$SVN_PATH" -o -n "$NCP_PATH" -o -n "$CURSES_PATH" -o -n "$ORACLE_PATH" -o -n "$AFP_PATH" -o -n "$MYSQL_PATH" -o -n "$MCACHED_PATH" -o -n "$MONGOD_PATH" ]; then
if [ -n "$FIREBIRD_PATH" -o -n "$PCRE_PATH" -o -n "$IDN_PATH" -o -n "$SSL_PATH" -o -n "$CRYPTO_PATH" -o -n "$NSL_PATH" -o -n "$SOCKET_PATH" -o -n "$RESOLV_PATH" -o -n "$SAPR3_PATH" -o -n "$SSH_PATH" -o -n "$POSTGRES_PATH" -o -n "$SVN_PATH" -o -n "$NCP_PATH" -o -n "$CURSES_PATH" -o -n "$ORACLE_PATH" -o -n "$AFP_PATH" -o -n "$MYSQL_PATH" -o -n "$MCACHED_PATH" -o -n "$MONGOD_PATH" -o -n "$FREERDP2_PATH" -o -n "$WINPR2_PATH" ]; then
XLIBPATHS="-L/usr/lib -L/usr/local/lib -L/lib"
fi
if [ -n "$MYSQL_IPATH" ]; then
@ -1253,9 +1327,15 @@ fi
if [ -n "$BSON_PATH" ]; then
XDEFINES="$XDEFINES -DLIBBSON"
fi
if [ -n "$FREERDP2_PATH" ]; then
XDEFINES="$XDEFINES -DLIBFREERDP2"
fi
if [ -n "$WINPR2_PATH" ]; then
XDEFINES="$XDEFINES -DLIBWINPR2"
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 $MCACHED_PATH $MONGODB_PATH $BSON_PATH; do
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 $MCACHED_PATH $MONGODB_PATH $BSON_PATH $FREERDP2_PATH $WINPR2_PATH; do
if [ "$OLDPATH" = "$i" ]; then
OLDPATH="$i"
else
@ -1314,6 +1394,9 @@ fi
if [ -n "$MONGODB_IPATH" ]; then
XIPATHS="$XIPATHS -I$MONGODB_IPATH -I$BSON_IPATH"
fi
if [ -n "$FREERDP2_IPATH" ]; then
XIPATHS="$XIPATHS -I$FREERDP2_IPATH -I$WINPR2_IPATH"
fi
if [ -n "$HAVE_GCRYPT" ]; then
XLIBS="$XLIBS -lgcrypt"
fi
@ -1386,6 +1469,12 @@ fi
if [ -n "$BSON_PATH" ]; then
XLIBS="$XLIBS -lbson-1.0"
fi
if [ -n "$FREERDP2_PATH" ]; then
XLIBS="$XLIBS -lfreerdp2"
fi
if [ -n "$WINPR2_PATH" ]; then
XLIBS="$XLIBS -lwinpr2"
fi
if [ -d /usr/kerberos/include ]; then
XIPATHS="$XIPATHS -I/usr/kerberos/include"
fi

File diff suppressed because it is too large Load diff

40
hydra.c
View file

@ -110,6 +110,8 @@ extern void service_oracle_sid(char *ip, int32_t sp, unsigned char options, char
extern int32_t service_oracle_sid_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE * fp, int32_t port, char *hostname);
extern void service_sip(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE * fp, int32_t port, char *hostname);
extern int32_t service_sip_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE * fp, int32_t port, char *hostname);
#endif
#ifdef LIBFREERDP2
extern void service_rdp(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE * fp, int32_t port, char *hostname);
extern int32_t service_rdp_init(char *ip, int32_t sp, unsigned char options, char *miscptr, FILE * fp, int32_t port, char *hostname);
#endif
@ -418,7 +420,7 @@ SERVICE3("mongodb", mongodb),
#endif
SERVICE(redis),
SERVICE(rexec),
#ifdef LIBOPENSSL
#ifdef LIBFREERDP2
SERVICE3("rdp", rdp),
#endif
SERVICE(rlogin),
@ -2150,8 +2152,6 @@ int main(int argc, char *argv[]) {
SERVICES = hydra_string_replace(SERVICES, "[-{cram|digest}md5]", "");
// for sip
SERVICES = hydra_string_replace(SERVICES, " sip", "");
// for rdp
SERVICES = hydra_string_replace(SERVICES, " rdp", "");
// for oracle-listener
SERVICES = hydra_string_replace(SERVICES, " oracle-listener", "");
// general
@ -2160,6 +2160,12 @@ int main(int argc, char *argv[]) {
SERVICES = hydra_string_replace(SERVICES, " oracle-sid", "");
strcat(unsupported, "SSL-services (ftps, sip, rdp, oracle-services, ...) ");
#endif
#ifndef LIBFREERDP2
// for rdp
SERVICES = hydra_string_replace(SERVICES, " rdp", "");
#endif
#ifndef HAVE_MATH_H
if (strlen(unsupported) > 0)
strcat(unsupported, "and ");
@ -2759,10 +2765,15 @@ int main(int argc, char *argv[]) {
#endif
}
if ((strcmp(hydra_options.service, "smb") == 0) || (strcmp(hydra_options.service, "smbnt") == 0) ||
(strcmp(hydra_options.service, "sip") == 0) || (strcmp(hydra_options.service, "rdp") == 0) ||
(strcmp(hydra_options.service, "sip") == 0) ||
(strcmp(hydra_options.service, "oracle-listener") == 0) || (strcmp(hydra_options.service, "oracle-sid") == 0)) {
#ifndef LIBOPENSSL
bail("Compiled without OPENSSL support, module not available!");
#endif
}
if (strcmp(hydra_options.service, "rdp") == 0){
#ifndef LIBFREERDP2
bail("Compiled without FREERDP2 support, module not available!");
#endif
}
if (strcmp(hydra_options.service, "pcnfs") == 0) {
@ -3061,17 +3072,16 @@ int main(int argc, char *argv[]) {
if (strcmp(hydra_options.service, "irc") == 0)
i = 1;
if (strcmp(hydra_options.service, "rdp") == 0) {
//if (hydra_options.tasks > 4)
// fprintf(stderr, "[WARNING] rdp servers often don't like many connections, use -t 1 or -t 4 to reduce the number of parallel connections and -W 1 or -W 3 to wait between connection to allow the server to recover\n");
//if (hydra_options.tasks > 4) {
// fprintf(stderr, "[INFO] Reduced number of tasks to 4 (rdp does not like many parallel connections)\n");
// hydra_options.tasks = 4;
//}
//if (conwait == 0)
// hydra_options.conwait = conwait = 1;
//printf("[WARNING] the rdp module is currently reported to be unreliable, most likely against new Windows version. Please test, report - and if possible, fix.\n");
printf("[ERROR] the rdp module does not support the current protocol, hence it is disabled. If you want to develop it, please contact vh@thc.org\n");
exit(-1);
if (hydra_options.tasks > 4)
fprintf(stderr, "[WARNING] rdp servers often don't like many connections, use -t 1 or -t 4 to reduce the number of parallel connections and -W 1 or -W 3 to wait between connection to allow the server to recover\n");
if (hydra_options.tasks > 4) {
fprintf(stderr, "[INFO] Reduced number of tasks to 4 (rdp does not like many parallel connections)\n");
hydra_options.tasks = 4;
}
if (conwait == 0)
hydra_options.conwait = conwait = 1;
printf("[WARNING] the rdp module is experimental. Please test, report - and if possible, fix.\n");
i = 1;
}
if (strcmp(hydra_options.service, "radmin2") == 0) {
#ifdef HAVE_GCRYPT