imparable

ADB Helper by Neha Tariq

Jun 17th, 2021
145
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. # ====================================
  4. # Small script to:
  5. # 1. Run Frida server and hook the script to bypass SSL pinning.
  6. # 2. Pull an APK from the emulated device in Genymotion.
  7. # ====================================
  8.  
  9. PS3='[+] Please select a number from menu: '
  10. options=("Hook with Frida" "Pull an APK" "Quit")
  11. select opt in "${options[@]}"
  12. do
  13. echo -e "\n"
  14. case $opt in
  15. "Hook with Frida")
  16.  
  17. read -p "[+] Enter keyword of your app: " keyword
  18.  
  19. OUTPUT=$(adb shell pm list packages | grep $keyword)
  20. if [[ "$OUTPUT" ]]
  21. then
  22. oldIFS=$IFS
  23. IFS=$'\n'
  24. choices=( $OUTPUT )
  25. IFS=$oldIFS
  26.  
  27. PS3="[+] Please select the package number: "
  28. select answer in "${choices[@]}"; do
  29.  
  30. for item in "${choices[@]}"; do
  31. if [[ $item == $answer ]]; then
  32. app=$(echo "$answer" | sed -e 's/\(^package:\)//g')
  33. adb shell /data/local/tmp/frida-server &
  34. echo -e "\n================================================"
  35. echo -e "\t\tFrida Started!"
  36. echo "================================================"
  37. frida -U --codeshare sowdust/universal-android-ssl-pinning-bypass-2 -f "$app" --no-pause
  38. f_pid=$(adb shell ps | grep frida-server | grep poll_schedule_timeout | awk ' { print $2 }')
  39. kill_frida=$(adb shell kill -9 "$f_pid")
  40. exit
  41.  
  42. break 2
  43. fi
  44.  
  45. done
  46. done
  47. else
  48. echo -e "\nNo APK found with this keyword: $keyword"
  49.  
  50. fi
  51. ;;
  52.  
  53. "Pull an APK")
  54.  
  55. read -p "[+] Enter keyword of your app to pull: " keyword
  56.  
  57. OUTPUT=$(adb shell pm list packages | grep $keyword)
  58. if [[ "$OUTPUT" ]]
  59. then
  60. oldIFS=$IFS
  61. IFS=$'\n'
  62. choices=( $OUTPUT )
  63. IFS=$oldIFS
  64. PS3="[+] Please select the number to pull: "
  65. select answer in "${choices[@]}"; do
  66. for item in "${choices[@]}"; do
  67. if [[ $item == $answer ]]; then
  68. app=$(echo "$answer" | sed -e 's/\(^package:\)//g')
  69. path=$(adb shell pm path "$app" | grep base.apk | sed -e 's/\(^package:\)//g')
  70. rename=$( echo "$path" | sed -e 's/\(^\/data\/app\/\)//g' -e 's/-.*$//' -e 's/\./_/g')
  71. saved=$(adb pull "$path" "$rename.apk")
  72. echo -e "\n"
  73. echo "[+] $rename.apk has been saved!"
  74. exit
  75.  
  76. break 2
  77. fi
  78.  
  79. done
  80. done
  81. else
  82. echo -e "\nNo APK found with this keyword: $keyword"
  83.  
  84. fi
  85. ;;
  86.  
  87. "Quit")
  88. break
  89. ;;
  90. *) echo "[-] Invalid option: $REPLY";;
  91. esac
  92. done
  93.  
RAW Paste Data