-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathfridpa.sh
executable file
·101 lines (82 loc) · 3.25 KB
/
fridpa.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
# An automated wrapper script for unpacking, patching, signing and deploying
# apps on non-jailbroken device. Once the process is completed, the apps will
# launch in debugging mode with lldb attached and ready for hooking using Frida
#
# Developed by @tanprathan
export PATH=$PATH:/usr/libexec
DYLIB=${pwd}/FridaGadget.dylib
function patch() {
# Clear Payload folder
rm -rf Payload*
# Download Frida DYLIB if not found
if [ ! -f $DYLIB ]; then
echo "FridaGadget.dylib not found"
echo "Download from the internet"
curl -O https://build.frida.re/frida/ios/lib/FridaGadget.dylib
fi
# Obtaining Certificate Identity from Developer profile:
echo "" && echo -e "***** Listing Signing Identity *****"
security find-identity -p codesigning -v
echo "" && echo -n "Enter your Identity (Same as mobileprovision) then press [ENTER]: "
read SID
# Unpacking and Identifying Application Name:
echo "" && echo -n "Ensure the IPA and embedded.mobileprovision file are on the current directory [ENTER]"
read OK
APPPACKAGE="$(find *.ipa)"
unzip ${APPPACKAGE} >/dev/null
APPNAME="$(ls Payload)"
# Copying Frida to Application folder and Inserting load command
cp FridaGadget.dylib "Payload/${APPNAME}/"
echo "" && echo -e "***** Inserting load command into Binary *****"
APPBINARY=${APPNAME%.*}
./optool install -c load -p "@executable_path/FridaGadget.dylib" -t "Payload/${APPNAME}/${APPBINARY}"
# Obtaining entitlements and Bundle ID:
security cms -D -i embedded.mobileprovision >profile.plist
PlistBuddy -x -c 'Print :Entitlements' profile.plist >entitlements.plist
ENT=$(egrep -a -A 2 application-identifier embedded.mobileprovision | grep string | sed -e 's/<string>//' -e 's/<\/string>//' -e 's/ //' | tr -d '\t')
BUNDLEID=${ENT#*.}
# Signing the Application package:
cp embedded.mobileprovision "Payload/${APPNAME}/embedded.mobileprovision"
PlistBuddy -c "Set :CFBundleIdentifier ${BUNDLEID}" "Payload/${APPNAME}/Info.plist"
rm -rf Payload/${APPNAME}/_CodeSignature
echo "" && echo -e "***** Re-signing Binary *****"
codesign --force --sign ${SID} "Payload/${APPNAME}/FridaGadget.dylib"
codesign --force --sign ${SID} --entitlements entitlements.plist "Payload/${APPNAME}/${APPBINARY}"
# Clear entitlements file
rm entitlements.plist
rm profile.plist
# Deploying application with debuggable mode:
echo "" && echo -e "***** Deploying Application on iDevice *****"
ios-deploy --bundle "Payload/${APPNAME}/"
echo "" && echo -n "Trust Developer profile on Device Settings and press [ENTER]"
read OK
echo "" && echo -e "***** Deploying Application with Frida Server *****"
ios-deploy --noinstall --debug --bundle "Payload/${APPNAME}/"
exit 0
}
function deploy() {
APPNAME="$(ls Payload)"
echo "" && echo -e "***** Deploying Application with Frida Server *****"
ios-deploy --noinstall --debug --bundle "Payload/${APPNAME}/"
exit 0
}
# Providing option for Fridpa
cat welcome.txt
echo "" && echo -n "Enter your Option for Fridpa and press [ENTER]: "
read option
case ${option} in
1) patch ;;
2) deploy ;;
*)
echo ""
echo "++++++++++++++++++++++++++++++"
echo "+ +"
echo "+ Noob Spotted, Go away !! +"
echo "+ +"
echo "++++++++++++++++++++++++++++++"
echo ""
exit 1
;;
esac
sleep 10