The-SamminAter / repo

My (The-SamminAter's) repo for jailbroken devices - also apparently a good template
https://the-samminater.github.io/repo/
6 stars 2 forks source link

Compile thc-hydra for ios #2

Closed PainterHalver closed 2 years ago

PainterHalver commented 2 years ago

Hi. I'm struggling to find a way to compile thc-hydra to run on my iphone and I see your issue here. Have you found a way to do this? I can never get pass the make command. I tried copying SDK, installing then remove clang, CC=clang and all I found on the internet but no hope. Any help is appreciated. Thank you!

The-SamminAter commented 2 years ago

Ah. In the years that have passed since then, I'm not as clueless. I will try compiling it on my phone. And get back to you.

First of all though, do you have clang installed from Bingner's (or Procursus') repo?

PainterHalver commented 2 years ago

Yes, after messing up with all the missing and conflicting SDK headers now I'm here. I'm on IOS 12 with llvm, Clang 10.0.0 and bunch of other packages that hydra needs (libssl,...). Below is where I'm at.


iPhone:/var/mobile/Documents/thc-hydra root# CC="clang -v" make
clang -v -I. -O3 -g -fcommon  -lm -g   -o hydra  hydra.c 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-memcached.o hydra-mongodb.o hydra-mysql.o hydra-mssql.o hydra-cobaltstrike.o hydra-xmpp.o hydra-http-proxy-urlenum.o hydra-snmp.o hydra-cvs.o hydra-smtp.o hydra-smtp-enum.o hydra-sapr3.o hydra-ssh.o hydra-sshkey.o hydra-teamspeak.o hydra-postgres.o hydra-rsh.o hydra-rlogin.o hydra-oracle-listener.o hydra-svn.o hydra-pcanywhere.o hydra-sip.o hydra-oracle-sid.o hydra-oracle.o hydra-vmauthd.o hydra-asterisk.o hydra-firebird.o hydra-afp.o hydra-ncp.o hydra-http-proxy.o hydra-http-form.o hydra-irc.o hydra-redis.o hydra-rdp.o hydra-s7-300.c hydra-adam6500.o hydra-rtsp.o hydra-rpcap.o hydra-radmin2.o crc32.o d3des.o bfg.o ntlm.o sasl.o hmacmd5.o hydra-mod.o hydra-time.o hydra-smb2.o -lm -lgcrypt -lz -lcurses -lssl -lpcre -lcrypto -L/usr/lib -L/usr/local/lib -L/lib -L/usr/lib -I/usr/include -I/usr/include -DLIBOPENSSL -DLIBNCURSES -DHAVE_PCRE -DNO_STRRCHR -DNO_RSA_LEGACY -DHAVE_ZLIB -DHAVE_GCRYPT -DHAVE_MATH_H -DHAVE_SYS_PARAM_H
clang version 10.0.0 (git@bingner.com:elucubratus.git 38d9371d79ade653c47347ca418b91e61808011c)
Target: arm64-apple-ios7.0
Thread model: posix
InstalledDir: /usr/bin
 "/usr/lib/llvm-10/bin/clang-10" -cc1 -triple arm64-apple-ios7.0.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -disable-free -disable-llvm-verifier -discard-value-names -main-file-name hydra.c -mrelocation-model pic -pic-level 2 -mthread-model posix -mframe-pointer=non-leaf -fno-rounding-math -masm-verbose -munwind-tables -faligned-alloc-unavailable -target-cpu apple-a7 -target-feature +fp-armv8 -target-feature +neon -target-feature +crypto -target-feature +zcm -target-feature +zcz -target-feature +sha2 -target-feature +aes -target-abi darwinpcs -fallow-half-arguments-and-returns -dwarf-column-info -debug-info-kind=standalone -dwarf-version=2 -debugger-tuning=lldb -target-linker-version 450.3 -v -resource-dir /usr/lib/llvm-10/lib/clang/10.0.0 -I . -I /usr/include -I /usr/include -D LIBOPENSSL -D LIBNCURSES -D HAVE_PCRE -D NO_STRRCHR -D NO_RSA_LEGACY -D HAVE_ZLIB -D HAVE_GCRYPT -D HAVE_MATH_H -D HAVE_SYS_PARAM_H -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-10/lib/clang/10.0.0/include -internal-externc-isystem /usr/include -internal-externc-isystem /usr/share/SDKs/iPhoneOS.sdk/usr/include -O3 -fdebug-compilation-dir /var/mobile/Documents/thc-hydra -ferror-limit 19 -fmessage-length 147 -stack-protector 1 -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fobjc-runtime=ios-7.0.0 -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o /var/tmp/hydra-0788ea.o -x c hydra.c
clang -cc1 version 10.0.0 based upon LLVM 10.0.0 default target arm64-apple-ios7.0
ignoring duplicate directory "/usr/include"
ignoring duplicate directory "/usr/include"
  as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
 .
 /usr/local/include
 /usr/lib/llvm-10/lib/clang/10.0.0/include
 /usr/include
 /usr/share/SDKs/iPhoneOS.sdk/usr/include
 /usr/share/SDKs/iPhoneOS.sdk/System/Library/Frameworks (framework directory)
 /usr/share/SDKs/iPhoneOS.sdk/Library/Frameworks (framework directory)
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
hydra.c:888:52: warning: format specifies type 'unsigned long' but the argument has type 'unsigned long long' [-Wformat]
    fprintf(stderr, "Error: malloc(%lu) failed\n", hydra_brains.sizelogin + hydra_brains.countlogin + 8);
                                   ~~~             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                   %llu
hydra.c:897:54: warning: format specifies type 'unsigned long' but the argument has type 'unsigned long long' [-Wformat]
      fprintf(stderr, "Error: malloc(%lu) failed\n", hydra_brains.sizepass + hydra_brains.countpass + 8);
                                     ~~~             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                     %llu
2 warnings generated.
 "/usr/lib/llvm-10/bin/clang-10" -cc1 -triple arm64-apple-ios7.0.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -disable-free -disable-llvm-verifier -discard-value-names -main-file-name hydra-s7-300.c -mrelocation-model pic -pic-level 2 -mthread-model posix -mframe-pointer=non-leaf -fno-rounding-math -masm-verbose -munwind-tables -faligned-alloc-unavailable -target-cpu apple-a7 -target-feature +fp-armv8 -target-feature +neon -target-feature +crypto -target-feature +zcm -target-feature +zcz -target-feature +sha2 -target-feature +aes -target-abi darwinpcs -fallow-half-arguments-and-returns -dwarf-column-info -debug-info-kind=standalone -dwarf-version=2 -debugger-tuning=lldb -target-linker-version 450.3 -v -resource-dir /usr/lib/llvm-10/lib/clang/10.0.0 -I . -I /usr/include -I /usr/include -D LIBOPENSSL -D LIBNCURSES -D HAVE_PCRE -D NO_STRRCHR -D NO_RSA_LEGACY -D HAVE_ZLIB -D HAVE_GCRYPT -D HAVE_MATH_H -D HAVE_SYS_PARAM_H -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-10/lib/clang/10.0.0/include -internal-externc-isystem /usr/include -internal-externc-isystem /usr/share/SDKs/iPhoneOS.sdk/usr/include -O3 -fdebug-compilation-dir /var/mobile/Documents/thc-hydra -ferror-limit 19 -fmessage-length 147 -stack-protector 1 -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fobjc-runtime=ios-7.0.0 -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o /var/tmp/hydra-s7-300-da9733.o -x c hydra-s7-300.c
clang -cc1 version 10.0.0 based upon LLVM 10.0.0 default target arm64-apple-ios7.0
ignoring duplicate directory "/usr/include"
ignoring duplicate directory "/usr/include"
  as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
 .
 /usr/local/include
 /usr/lib/llvm-10/lib/clang/10.0.0/include
 /usr/include
 /usr/share/SDKs/iPhoneOS.sdk/usr/include
 /usr/share/SDKs/iPhoneOS.sdk/System/Library/Frameworks (framework directory)
 /usr/share/SDKs/iPhoneOS.sdk/Library/Frameworks (framework directory)
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
 "/usr/bin/ld" -demangle -lto_library /usr/lib/llvm-10/lib/libLTO.dylib -dynamic -arch arm64 -iphoneos_version_min 7.0.0 -o hydra -L/usr/lib -L/usr/local/lib -L/lib -L/usr/lib -lm /var/tmp/hydra-0788ea.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-memcached.o hydra-mongodb.o hydra-mysql.o hydra-mssql.o hydra-cobaltstrike.o hydra-xmpp.o hydra-http-proxy-urlenum.o hydra-snmp.o hydra-cvs.o hydra-smtp.o hydra-smtp-enum.o hydra-sapr3.o hydra-ssh.o hydra-sshkey.o hydra-teamspeak.o hydra-postgres.o hydra-rsh.o hydra-rlogin.o hydra-oracle-listener.o hydra-svn.o hydra-pcanywhere.o hydra-sip.o hydra-oracle-sid.o hydra-oracle.o hydra-vmauthd.o hydra-asterisk.o hydra-firebird.o hydra-afp.o hydra-ncp.o hydra-http-proxy.o hydra-http-form.o hydra-irc.o hydra-redis.o hydra-rdp.o /var/tmp/hydra-s7-300-da9733.o hydra-adam6500.o hydra-rtsp.o hydra-rpcap.o hydra-radmin2.o crc32.o d3des.o bfg.o ntlm.o sasl.o hmacmd5.o hydra-mod.o hydra-time.o hydra-smb2.o -lm -lgcrypt -lz -lcurses -lssl -lpcre -lcrypto -lSystem
ld: warning: dylib (/usr/local/lib/libz.dylib) was built for newer iOS version (9.0) than being linked (7.0)
Undefined symbols for architecture arm64:
  "_service_oracle_listener", referenced from:
      _services in hydra-0788ea.o
  "_service_oracle_listener_init", referenced from:
      _services in hydra-0788ea.o
  "_service_oracle_sid", referenced from:
      _services in hydra-0788ea.o
  "_service_oracle_sid_init", referenced from:
      _services in hydra-0788ea.o
  "_service_sip", referenced from:
      _services in hydra-0788ea.o
     (maybe you meant: _service_sip_init)
  "_service_smb", referenced from:
      _services in hydra-0788ea.o
     (maybe you meant: _service_smb_init)
  "_usage_oracle_listener", referenced from:
      _services in hydra-0788ea.o
ld: symbol(s) not found for architecture arm64
Not signing file
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:68: hydra] Error 1```
PainterHalver commented 2 years ago

I got it to work! Here's what I did: (ios 12)

Finally got it to work after 2 whole days wow. Thank you though for replying!

The-SamminAter commented 2 years ago

Good to hear. I believe that my original issue originated from clang not being complete/fully working, but that has improved with Bingner's clang 2021 build (the 2020 build was a bit broken as well iirc). It also probably didn't help though that I didn't really know what I was doing, or how to solve issues by looking it up and finding fixes online (it seems).