Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # ====================================
- # Small script to:
- # 1. Run Frida server and hook the script to bypass SSL pinning.
- # 2. Pull an APK from the emulated device in Genymotion.
- # ====================================
- PS3='[+] Please select a number from menu: '
- options=("Hook with Frida" "Pull an APK" "Quit")
- select opt in "${options[@]}"
- do
- echo -e "\n"
- case $opt in
- "Hook with Frida")
- read -p "[+] Enter keyword of your app: " keyword
- OUTPUT=$(adb shell pm list packages | grep $keyword)
- if [[ "$OUTPUT" ]]
- then
- oldIFS=$IFS
- IFS=$'\n'
- choices=( $OUTPUT )
- IFS=$oldIFS
- PS3="[+] Please select the package number: "
- select answer in "${choices[@]}"; do
- for item in "${choices[@]}"; do
- if [[ $item == $answer ]]; then
- app=$(echo "$answer" | sed -e 's/\(^package:\)//g')
- adb shell /data/local/tmp/frida-server &
- echo -e "\n================================================"
- echo -e "\t\tFrida Started!"
- echo "================================================"
- frida -U --codeshare sowdust/universal-android-ssl-pinning-bypass-2 -f "$app" --no-pause
- f_pid=$(adb shell ps | grep frida-server | grep poll_schedule_timeout | awk ' { print $2 }')
- kill_frida=$(adb shell kill -9 "$f_pid")
- exit
- break 2
- fi
- done
- done
- else
- echo -e "\nNo APK found with this keyword: $keyword"
- fi
- ;;
- "Pull an APK")
- read -p "[+] Enter keyword of your app to pull: " keyword
- OUTPUT=$(adb shell pm list packages | grep $keyword)
- if [[ "$OUTPUT" ]]
- then
- oldIFS=$IFS
- IFS=$'\n'
- choices=( $OUTPUT )
- IFS=$oldIFS
- PS3="[+] Please select the number to pull: "
- select answer in "${choices[@]}"; do
- for item in "${choices[@]}"; do
- if [[ $item == $answer ]]; then
- app=$(echo "$answer" | sed -e 's/\(^package:\)//g')
- path=$(adb shell pm path "$app" | grep base.apk | sed -e 's/\(^package:\)//g')
- rename=$( echo "$path" | sed -e 's/\(^\/data\/app\/\)//g' -e 's/-.*$//' -e 's/\./_/g')
- saved=$(adb pull "$path" "$rename.apk")
- echo -e "\n"
- echo "[+] $rename.apk has been saved!"
- exit
- break 2
- fi
- done
- done
- else
- echo -e "\nNo APK found with this keyword: $keyword"
- fi
- ;;
- "Quit")
- break
- ;;
- *) echo "[-] Invalid option: $REPLY";;
- esac
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement