dependencies.sh 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #!/bin/sh
  2. TIMESTAMP=`date "+[%Y-%m-%d %H:%M:%S]"`
  3. LOGFILE="/pineapple/modules/PMKIDAttack/log/module.log"
  4. # downloads from adde88 repo
  5. # change "blob" to "raw" for direct download
  6. # V6.0
  7. # Dependencies from https://github.com/adde88/openwrt-useful-tools/tree/packages-19.07_mkvi
  8. # https://github.com/adde88/openwrt-useful-tools/blob/a47fffeca89106bab9563c4a01d21871eb6b74f9/hcxtools-custom_6.0.3-5_mips_24kc.ipk
  9. # https://github.com/adde88/openwrt-useful-tools/blob/a47fffeca89106bab9563c4a01d21871eb6b74f9/hcxdumptool-custom_6.0.7-6_mips_24kc.ipk
  10. # HCXTOOLS_IPK="/pineapple/modules/PMKIDAttack/scripts/hcxtools-custom_6.0.3-5_mips_24kc.ipk"
  11. # HCXDUMPTOOL_IPK="/pineapple/modules/PMKIDAttack/scripts/hcxdumptool-custom_6.0.7-6_mips_24kc.ipk"
  12. # V6.2
  13. # Dependencies from https://github.com/adde88/openwrt-useful-tools/tree/packages-19.07_mkvi
  14. # https://github.com/adde88/openwrt-useful-tools/blob/a5c9ce6997a3953f318f0f4c0ca2293b2d5c6307/hcxtools-custom_6.2.5-8_mips_24kc.ipk
  15. # https://github.com/adde88/openwrt-useful-tools/blob/a5c9ce6997a3953f318f0f4c0ca2293b2d5c6307/hcxdumptool-custom_6.2.5-8_mips_24kc.ipk
  16. HCXTOOLS_IPK="/pineapple/modules/PMKIDAttack/scripts/hcxtools-custom_6.2.5-8_mips_24kc.ipk"
  17. HCXDUMPTOOL_IPK="/pineapple/modules/PMKIDAttack/scripts/hcxdumptool-custom_6.2.5-8_mips_24kc.ipk"
  18. # V6.1
  19. # downloads from oficial opkg
  20. #HCXTOOLS_IPK="hcxtools"
  21. #HCXDUMPTOOL_IPK="hcxdumptool"
  22. function add_log {
  23. echo $TIMESTAMP $1 >> $LOGFILE
  24. }
  25. if [[ "$1" == "" ]]; then
  26. echo "Argument to script missing! Run with \"dependencies.sh [install|remove]\""
  27. exit 1
  28. fi
  29. [[ -f /tmp/PMKIDAttack.progress ]] && {
  30. exit 0
  31. }
  32. add_log "Starting dependencies script with argument: $1"
  33. touch /tmp/PMKIDAttack.progress
  34. if [[ "$1" = "install" ]]; then
  35. opkg update
  36. if [[ -e /sd ]]; then
  37. add_log "Installing on sd"
  38. opkg --dest sd install $HCXTOOLS_IPK >> $LOGFILE
  39. if [[ $? -ne 0 ]]; then
  40. add_log "ERROR: opkg --dest sd install $HCXTOOLS_IPK failed"
  41. exit 1
  42. fi
  43. opkg --dest sd install $HCXDUMPTOOL_IPK >> $LOGFILE
  44. if [[ $? -ne 0 ]]; then
  45. add_log "ERROR: opkg --dest sd install $HCXDUMPTOOL_IPK failed"
  46. exit 1
  47. fi
  48. else
  49. add_log "Installing on disk"
  50. opkg install $HCXTOOLS_IPK >> $LOGFILE
  51. if [[ $? -ne 0 ]]; then
  52. add_log "ERROR: opkg install $HCXTOOLS_IPK failed"
  53. exit 1
  54. fi
  55. opkg install $HCXDUMPTOOL_IPK >> $LOGFILE
  56. if [[ $? -ne 0 ]]; then
  57. add_log "ERROR: opkg install $HCXDUMPTOOL_IPK failed"
  58. exit 1
  59. fi
  60. fi
  61. touch /etc/config/pmkidattack
  62. uci add pmkidattack config
  63. uci set pmkidattack.@config[0].installed=1
  64. uci set pmkidattack.@config[0].attack=0
  65. uci set pmkidattack.@config[0].ssid=''
  66. uci set pmkidattack.@config[0].bssid=''
  67. uci commit pmkidattack
  68. add_log "Installation complete!"
  69. fi
  70. if [[ "$1" = "remove" ]]; then
  71. add_log "Removing dependencies"
  72. rm -rf /etc/config/PMKIDAttack
  73. opkg remove hcxtools-custom hcxdumptool-custom
  74. #opkg remove hcxtools hcxdumptool
  75. uci set pmkidattack.@config[0].installed=0
  76. uci commit pmkidattack
  77. echo "execute this for manual check! opkg list-installed | grep hcx"
  78. add_log "Removing complete!"
  79. fi
  80. rm /tmp/PMKIDAttack.progress