deps.sh 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. #!/bin/bash
  2. # Author: Gabriele Gristina <matrix@hashcat.net>
  3. # Revision: 1.0
  4. ## global vars
  5. DEPS="git lzip gcc-multilib make m4 mingw-w64"
  6. #GMP_VER="gmp-6.0.0a"
  7. GMP_VER="gmp-6.1.0"
  8. ## root check
  9. if [ $(id -u) -ne 0 ]; then
  10. echo "! Must be root"
  11. exit 1
  12. fi
  13. ## make a fresh "hashcat-deps" directories
  14. rm -rf /opt/hashcat-deps/tmp/gmp* /opt/hashcat-deps/gmp/{linux32,linux64,win32,win64,osx64} && \
  15. mkdir -p /opt/hashcat-deps/gmp/{linux32,linux64,win32,win64,osx64} /opt/hashcat-deps/tmp && \
  16. cd /opt/hashcat-deps/tmp
  17. if [ $? -ne 0 ]; then
  18. echo "! Cannot create hashcat-deps directories."
  19. exit 1
  20. fi
  21. ## install osx cross stuff
  22. if [ ! -d "apple-pkgs" ]; then
  23. mkdir -p apple-pkgs
  24. fi
  25. cd apple-pkgs
  26. if [ ! -f "libssl0.9.8_0.9.8o-4squeeze14_amd64.deb" ]; then
  27. wget -c http://http.us.debian.org/debian/pool/main/o/openssl/libssl0.9.8_0.9.8o-4squeeze14_amd64.deb
  28. if [ $? -ne 0 ]; then
  29. echo "! failed to download libssl0.9.8 debian package"
  30. exit 1
  31. fi
  32. fi
  33. dpkg -i libssl0.9.8_0.9.8o-4squeeze14_amd64.deb
  34. if [ $? -ne 0 ]; then
  35. echo "! failed to install libssl0.9.8"
  36. exit 1
  37. fi
  38. if [ ! -f "apple-uni-sdk-10.5_20110407-0.flosoft1_amd64.deb" ]; then
  39. wget -c https://launchpad.net/~flosoft/+archive/ubuntu/cross-apple/+files/apple-uni-sdk-10.5_20110407-0.flosoft1_amd64.deb
  40. if [ $? -ne 0 ]; then
  41. echo "! failed to download apple-uni-sdk-10.5 debian package"
  42. exit 1
  43. fi
  44. fi
  45. dpkg -i apple-uni-sdk-10.5_20110407-0.flosoft1_amd64.deb
  46. if [ $? -ne 0 ]; then
  47. echo "! failed to install apple-uni-sdk-10.5"
  48. exit 1
  49. fi
  50. if [ ! -f "apple-uni-sdk-10.6_20110407-0.flosoft1_amd64.deb" ]; then
  51. wget -c https://launchpad.net/~flosoft/+archive/ubuntu/cross-apple/+files/apple-uni-sdk-10.6_20110407-0.flosoft1_amd64.deb
  52. if [ $? -ne 0 ]; then
  53. echo "! failed to download apple-uni-sdk-10.6 debian package"
  54. exit 1
  55. fi
  56. fi
  57. dpkg -i apple-uni-sdk-10.6_20110407-0.flosoft1_amd64.deb
  58. if [ $? -ne 0 ]; then
  59. echo "! failed to install apple-uni-sdk-10.6"
  60. exit 1
  61. fi
  62. if [ ! -f "apple-x86-odcctools_758.159-0flosoft11_amd64.deb" ]; then
  63. wget -c https://launchpad.net/~flosoft/+archive/ubuntu/cross-apple/+files/apple-x86-odcctools_758.159-0flosoft11_amd64.deb
  64. if [ $? -ne 0 ]; then
  65. echo "! failed to download apple-x86-odcctools debian package"
  66. exit 1
  67. fi
  68. fi
  69. dpkg -i apple-x86-odcctools_758.159-0flosoft11_amd64.deb
  70. if [ $? -ne 0 ]; then
  71. echo "! failed to install apple-x86-odcctools"
  72. exit 1
  73. fi
  74. if [ ! -f "apple-x86-gcc_4.2.1~5646.1flosoft2_amd64.deb" ]; then
  75. wget -c https://launchpad.net/~flosoft/+archive/ubuntu/cross-apple/+files/apple-x86-gcc_4.2.1~5646.1flosoft2_amd64.deb
  76. if [ $? -ne 0 ]; then
  77. echo "! failed to download apple-x86-gcc debian package"
  78. exit 1
  79. fi
  80. fi
  81. dpkg -i apple-x86-gcc_4.2.1~5646.1flosoft2_amd64.deb
  82. if [ $? -ne 0 ]; then
  83. echo "! failed to install apple-x86-gcc"
  84. exit 1
  85. fi
  86. cd ..
  87. ## installing needed packages
  88. for pkg in ${DEPS}; do
  89. apt-get -y install ${pkg}
  90. if [ $? -ne 0 ]; then
  91. echo "! failed to install ${pkg}"
  92. exit 1
  93. fi
  94. done
  95. ## download gmp source code
  96. wget -c https://gmplib.org/download/gmp/${GMP_VER}.tar.lz
  97. if [ $? -ne 0 ]; then
  98. echo "! failed to download GMP source code"
  99. exit 1
  100. fi
  101. tar xf ${GMP_VER}.tar.lz
  102. if [ $? -ne 0 ]; then
  103. echo "! failed to extract GMP source code"
  104. exit 1
  105. fi
  106. newDir=$(tar tvf ${GMP_VER}.tar.lz | head -n1 | awk '{print $6}' | sed -e 's/\///g')
  107. if [ "${newDir}" != "${GMP_VER}" ]; then
  108. mv ${newDir} ${GMP_VER}
  109. fi
  110. ## build gmp lib for linux32
  111. cp -af ${GMP_VER} ${GMP_VER}-linux32
  112. cd ${GMP_VER}-linux32 && \
  113. ./configure --host=i386-pc-linux-gnu --prefix=/opt/hashcat-deps/gmp/linux32 --disable-shared && \
  114. sudo make install && \
  115. cd .. && \
  116. rm -rf ${GMP_VER}-linux32
  117. if [ $? -ne 0 ]; then
  118. echo "! failed to build linux32 gmp lib."
  119. exit 1
  120. fi
  121. ## build gmp lib for linux64
  122. cp -af ${GMP_VER} ${GMP_VER}-linux64
  123. cd ${GMP_VER}-linux64 && \
  124. ./configure --host=x86_64-pc-linux-gnu --prefix=/opt/hashcat-deps/gmp/linux64 --disable-shared && \
  125. sudo make install && \
  126. cd .. && \
  127. rm -rf ${GMP_VER}-linux64
  128. if [ $? -ne 0 ]; then
  129. echo "! failed to build linux64 gmp lib."
  130. exit 1
  131. fi
  132. ## build gmp lib for win32
  133. cp -af ${GMP_VER} ${GMP_VER}-win32
  134. cd ${GMP_VER}-win32 && \
  135. ./configure --host=i686-w64-mingw32 --prefix=/opt/hashcat-deps/gmp/win32 --disable-shared && \
  136. sudo make install && \
  137. cd .. && \
  138. rm -rf ${GMP_VER}-win32
  139. if [ $? -ne 0 ]; then
  140. echo "! failed to build win32 gmp lib."
  141. exit 1
  142. fi
  143. ## build gmp lib for win64
  144. cp -af ${GMP_VER} ${GMP_VER}-win64
  145. cd ${GMP_VER}-win64 && \
  146. ./configure --host=x86_64-w64-mingw32 --prefix=/opt/hashcat-deps/gmp/win64 --disable-shared && \
  147. sudo make install && \
  148. cd .. && \
  149. rm -rf ${GMP_VER}-win64
  150. if [ $? -ne 0 ]; then
  151. echo "! failed to build win64 gmp lib."
  152. exit 1
  153. fi
  154. ## build gmp lib for osx64
  155. cp -af ${GMP_VER} ${GMP_VER}-osx64
  156. cd ${GMP_VER}-osx64 && \
  157. sed -i 's/\(i686.*\)$/\1\n\tabilist=64/' configure && \
  158. ABI=64 ./configure --host=i686-apple-darwin10 --prefix=/opt/hashcat-deps/gmp/osx64 --disable-shared --disable-assembly && \
  159. sudo make install && \
  160. cd .. && \
  161. rm -rf ${GMP_VER}-osx64
  162. if [ $? -ne 0 ]; then
  163. echo "! failed to build osx64 gmp lib."
  164. exit 1
  165. fi
  166. echo "> GMP library build success."