1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-08-04 12:56:00 +00:00

Update tools/install_modules.sh: make pyenv works with Apple Intel, use pycryptodome instead of pycrypto, add missing Module::Build::Pluggable::XSUtil

This commit is contained in:
Gabriele Gristina 2025-07-12 19:18:37 +02:00
parent b5202e4be6
commit 63377a9890
No known key found for this signature in database
GPG Key ID: 9F68B59298F311F0

View File

@ -7,89 +7,119 @@
## Test suite installation helper script ## Test suite installation helper script
IS_APPLE=0
IS_APPLE_SILICON=0
UNAME=$(uname -s)
if [ "${UNAME}" == "Darwin" ]; then
IS_APPLE=1
fi
if [ ${IS_APPLE} -eq 1 ]; then
if [ "$(sysctl -in hw.optional.arm64 2>/dev/null)" == "1" ]; then
IS_APPLE_SILICON=1
fi
fi
# Sum of all exit codes # Sum of all exit codes
ERRORS=0 ERRORS=0
cpanm Authen::Passphrase::LANManager \ cpanm Authen::Passphrase::LANManager \
Authen::Passphrase::MySQL323 \ Authen::Passphrase::MySQL323 \
Authen::Passphrase::NTHash \ Authen::Passphrase::NTHash \
Authen::Passphrase::PHPass \ Authen::Passphrase::PHPass \
Bitcoin::Crypto \ Bitcoin::Crypto \
Bitcoin::Crypto::Base58 \ Bitcoin::Crypto::Base58 \
Compress::Zlib \ Compress::Zlib \
Convert::EBCDIC \ Convert::EBCDIC \
Crypt::Argon2 \ Crypt::Argon2 \
Crypt::AuthEnc::GCM \ Crypt::AuthEnc::GCM \
Crypt::Camellia \ Crypt::Camellia \
Crypt::CBC \ Crypt::CBC \
Crypt::Cipher::Serpent \ Crypt::Cipher::Serpent \
Crypt::DES \ Crypt::DES \
Crypt::DES_EDE3 \ Crypt::DES_EDE3 \
Crypt::Digest::BLAKE2s_256 \ Crypt::Digest::BLAKE2s_256 \
Crypt::Digest::RIPEMD160 \ Crypt::Digest::RIPEMD160 \
Crypt::Digest::Whirlpool \ Crypt::Digest::Whirlpool \
Crypt::ECB \ Crypt::ECB \
Crypt::Eksblowfish::Bcrypt \ Crypt::Eksblowfish::Bcrypt \
Crypt::GCrypt \ Crypt::GCrypt \
Crypt::Mode::CBC \ Crypt::Mode::CBC \
Crypt::Mode::ECB \ Crypt::Mode::ECB \
Crypt::MySQL \ Crypt::MySQL \
Crypt::OpenSSH::ChachaPoly \ Crypt::OpenSSH::ChachaPoly \
Crypt::OpenSSL::EC \ Crypt::OpenSSL::EC \
Crypt::OpenSSL::Bignum::CTX \ Crypt::OpenSSL::Bignum::CTX \
Crypt::Passwd::XS \ Crypt::Passwd::XS \
Crypt::PBKDF2 \ Crypt::PBKDF2 \
Crypt::RC4 \ Crypt::RC4 \
Crypt::Rijndael \ Crypt::Rijndael \
Crypt::ScryptKDF \ Crypt::ScryptKDF \
Crypt::Skip32 \ Crypt::Skip32 \
Crypt::Twofish \ Crypt::Twofish \
Crypt::UnixCrypt_XS \ Crypt::UnixCrypt_XS \
Data::Types \ Data::Types \
Digest::CMAC \ Digest::CMAC \
Digest::CRC \ Digest::CRC \
Digest::GOST \ Digest::GOST \
Digest::HMAC \ Digest::HMAC \
Digest::HMAC_MD5 \ Digest::HMAC_MD5 \
Digest::Keccak \ Digest::Keccak \
Digest::MD4 \ Digest::MD4 \
Digest::MD5 \ Digest::MD5 \
Digest::MurmurHash3 \ Digest::MurmurHash3 \
Digest::Perl::MD5 \ Digest::Perl::MD5 \
Digest::SHA \ Digest::SHA \
Digest::SHA1 \ Digest::SHA1 \
Digest::SHA3 \ Digest::SHA3 \
Digest::SipHash \ Digest::SipHash \
Encode \ Encode \
JSON \ JSON \
Math::BigInt \ Math::BigInt \
MIME::Base64 \ MIME::Base64 \
Module::Build \ Module::Build \
Net::DNS::RR::NSEC3 \ Module::Build::Pluggable::XSUtil \
Net::DNS::SEC \ Net::DNS::RR::NSEC3 \
POSIX \ Net::DNS::SEC \
Text::Iconv \ POSIX \
Text::Iconv \
; ;
ERRORS=$((ERRORS+$?)) ERRORS=$((ERRORS+$?))
cpanm https://github.com/matrix/p5-Digest-BLAKE2.git perl -MDigest::BLAKE2 -e1 &>/dev/null
if [ $? -ne 0 ]; then
cpanm https://github.com/matrix/p5-Digest-BLAKE2.git
ERRORS=$((ERRORS+$?))
fi
ERRORS=$((ERRORS+$?)) # checks for pyenv
pyenv_enabled=0 pyenv_enabled=0
# check for pyenv
which pyenv &>/dev/null which pyenv &>/dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
if [[ $(pyenv version-name) != "system" ]]; then if [[ $(pyenv version-name) != "system" ]]; then
# active session detected # active session detected
pyenv_enabled=1 pyenv_enabled=1
else else
# enum last version available # enum last version available
latest=$(pyenv install --list | grep -E "^\s*3\.[0-9]+\.[0-9]$" | tail -n 1) latest=$(pyenv install --list | grep -E "^\s*3\.[0-9]+\.[0-9]$" | tail -n 1)
if [ $IS_APPLE -eq 1 ]; then
if [ $IS_APPLE_SILICON -eq 0 ]; then
# workaround but with pyenv and Apple Intel with brew binutils in path
remove_path="$(brew --prefix)/opt/binutils/bin"
PATH=$(echo "$PATH" | tr ':' '\n' | awk '$0 != "${remove_path}"' | xargs | sed 's/ /:/g')
export $PATH
fi
fi
# install the latest version or skip it if it is already present # install the latest version or skip it if it is already present
pyenv install -s ${latest} pyenv install -s ${latest}
@ -98,50 +128,46 @@ if [ $? -eq 0 ]; then
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
pyenv_enabled=1 pyenv_enabled=1
fi fi
fi fi
fi fi
if [ ${pyenv_enabled} -eq 0 ]; then if [ ${pyenv_enabled} -eq 0 ]; then
echo "! something is wrong with pyenv. Please setup latest version manually and re-run this script.
((ERRORS++)) echo "! something is wrong with pyenv. Please setup latest version manually and re-run this script."
(( ERRORS++ ))
else else
echo "> Installing python3 deps ..." echo "> Installing python3 deps ..."
pip3 install git+https://github.com/matrix/pygost pip3 install git+https://github.com/matrix/pygost
ERRORS=$((ERRORS+$?)) ERRORS=$((ERRORS+$?))
# pip3 uninstall -y pycryptoplus pycrypto pycryptodome
pip3 install pycryptoplus pip3 install pycryptoplus
ERRORS=$((ERRORS+$?)) ERRORS=$((ERRORS+$?))
# pip3 uninstall -y pycryptodome # latest versions do not require this work around anymore pip3 install pycryptodome
pip3 install pycrypto
ERRORS=$((ERRORS+$?)) ERRORS=$((ERRORS+$?))
pip3 install cryptography pip3 install cryptography
ERRORS=$((ERRORS+$?)) ERRORS=$((ERRORS+$?))
fi fi
php --version > /dev/null 2> /dev/null php --version &> /dev/null
if [ $? -ne 0 ]; then
if [ "$?" -ne 0 ] echo "! php must be installed for some unit tests'
then
echo '[ ERROR ] php must be installed for some unit tests'
ERRORS=$((ERRORS+1)) ERRORS=$((ERRORS+1))
fi fi
echo echo
if [ $ERRORS -eq 0 ]; then
echo '[ OK ] All commands were successful' if [ $ERRORS -gt 0 ]; then
exit 0
else
echo '[ FAIL ] Some commands were not successful' echo '[ FAIL ] Some commands were not successful'
exit 1 exit 1
fi fi
echo '[ OK ] All commands were successful'
exit 0