@@ -36,6 +36,7 @@ case $(uname) in
3636 cat tmp.plist | sed -n " s/.*<" $3 " >\(.*\)<\/" $3 " >.*/\1/p"
3737 rm tmp.plist
3838 }
39+ iOS=1
3940 fi
4041 ;;
4142
5758
5859# UNNECESSARY FUNCTIONS
5960Verbose () {
61+ tv=" $? "
6062 if [ " $3 " = " -v" ]; then
6163 if [ -n " $v " ]; then
62- if [ " $? " = 0 ]; then
64+ if [ " $tv " = 0 ]; then
6365 echo " $1 "
6466 else
6567 echo " $2 "
6668 fi
6769 fi
70+ else
71+ if [ " $tv " = 0 ]; then
72+ echo " $1 "
73+ else
74+ echo " $2 "
75+ fi
6876 fi
6977}
7078
@@ -147,13 +155,13 @@ while getopts :n:i:o:c:f:d:huSmeCv args; do
147155 echo " -f [Paths/Bundle IDs] Specify the files or tweak Bundle IDs to import"
148156 echo " -d [Names] From the .deb files imported, specify the names of the dylibs (e.g: Foo.dylib) to inject"
149157 echo " -c [Version] Set custom version for output ipa"
150- echo " -h Print this help menu"
151158 echo " -u Remove UISupportedDevices from Info.plist"
152159 echo " -v Enable Verbose Mode"
153160 echo " -m Enables the manual dylib selection 'UI'"
154- echo " -C Disables Aatomatic cleanup"
161+ echo " -C Disables Automatic cleanup"
155162 echo " -s Fakesigns iPA for use with AppSync"
156163 echo " -e Removes App Extensions"
164+ echo " -h Print this help menu"
157165 echo
158166 echo " Examples:"
159167 echo " azule -n Foo -i ~/Foo.ipa -o ~/Foo/ -f ~/Foo.dylib ~/Foo.bundle"
@@ -168,23 +176,6 @@ while getopts :n:i:o:c:f:d:huSmeCv args; do
168176 esac
169177done
170178
171- # GET IPA
172- if [ -z " $ipadir " ]; then while
173- printf ' Path to IPA: '
174- read ipa
175- ipadir=$( eval " echo \$ ipa" )
176- [ -z " $ipadir " ] && echo " I need the IPA to make your app."
177- do true ; done ; fi
178-
179- # VERBOSE
180- if [ -n " $v " ]; then
181- if [ -f " $ipadir " ]; then
182- echo " Path to IPA is $ipadir "
183- else
184- echo " Invalid Path to IPA"
185- fi
186- fi
187-
188179# GET FILES
189180if [ -z " $files " ]; then while
190181 printf ' Files or Tweak IDs: '
@@ -227,7 +218,7 @@ do true; done; fi
227218
228219tweakid=" $RANDOM "
229220mkdir -p " $( dirname " $outdir /$name " ) "
230- Verbose " Output Directory is $( dirname " $outdir /$name " ) " " $( dirname " $outdir /$name " ) is an invalid output directory"
221+ Verbose " Output Directory is $( dirname " $outdir /$name " ) " " $( dirname " $outdir /$name " ) is an invalid output directory" -v
231222
232223# .TMP DIRECTORIES
233224dir=" $( mktemp -d) "
@@ -238,14 +229,62 @@ mkdir -p "$dir/$tweakid/Custom"
238229Verbose " $dir /$tweakid /Custom has been created" " Couldn't create $dir /$tweakid /Custom" -v
239230cd " $dir /$tweakid "
240231
232+ # GET IPA
233+ if [ -z " $ipadir " ]; then while
234+ printf ' Path to IPA: '
235+ read ipa
236+ ipadir=$( eval " echo \$ ipa" )
237+ [ -z " $ipadir " ] && echo " I need the IPA to make your app."
238+ do true ; done ; fi
239+
240+ if [[ ! -f " $ipadir " && -n " $iOS " ]]; then
241+ while read i; do
242+ if [ " $( " $plutil " -key MCMMetadataIdentifier " $i " ) " = " $ipadir " ]; then
243+ echo " Decrypting App..."
244+ mkdir -p Payload
245+ rsync -a $( dirname " $i " ) /* .app Payload
246+ while read i; do
247+ if [ -n " $( " $otool " -l " $i " | grep " cryptid 1" ) " ]; then
248+ flexdecrypt " $i " --output " $i " & > /dev/null
249+ fi
250+ done < <( find Payload/* .app -type f ! -name " *.*" -o -iname " *.dylib" )
251+ decrypted=1
252+ echo " Decrypted App"
253+ break
254+ fi
255+ done < <( find /var/containers/Bundle/Application -iname .com.apple.mobile_container_manager.metadata.plist)
256+
257+ if [ -z " $decrypted " ]; then
258+ echo " Couldn't find app"
259+ exit 1
260+ fi
261+ fi
262+
263+ if [ -n " $v " ]; then
264+ if [ -f " $ipadir " ]; then
265+ echo " Path to IPA is $ipadir "
266+ else
267+ if [ -n " $decrypted " ]; then
268+ echo " BundleID of App is $ipadir "
269+ fi
270+ fi
271+ fi
272+
273+ if [[ ! -f " $ipadir " && -z " $decrypted " ]]; then
274+ echo " Invalid iPA"
275+ exit 1
276+ fi
277+
241278# EXTRACT IPA
242- echo " Extracting iPA..."
243- eval " unzip -q '$ipadir ' -d $dir /'$tweakid '"
244- Verbose " IPA extracted" " Couldn't extract IPA"
279+ if [ -z " $decrypted " ]; then
280+ echo " Extracting iPA..."
281+ eval " unzip -q '$ipadir ' -d $dir /'$tweakid '"
282+ Verbose " IPA extracted" " Couldn't extract IPA"
283+ fi
245284
246285if [ -n " $e " ]; then
247286 echo " Removing Extensions..."
248- rm -rf Payload/* .app/Plugins/
287+ rm -rf Payload/* .app/Plugins
249288 Verbose " Removed Extensions" " Couldn't Remove Extensions"
250289fi
251290executable=" Payload/$( basename Payload/* .app) /$( ExtractPlistValue CFBundleExecutable Payload/* .app/Info.plist string) "
418457if [ -n " $u " ]; then
419458 UISupportedDevices=" $( ExtractPlistValue UISupportedDevices Payload/* .app/Info.plist string) "
420459 if [ -n " $UISupportedDevices " ]; then
421- " $plutil " -remove UISupportedDevices Payload/* .app/Info.plist
460+ if [ -n " $iOS " ]; then
461+ " $plutil " -remove -key UISupportedDevices Payload/* .app/Info.plist & > /dev/null
462+ else
463+ " $plutil " -remove UISupportedDevices Payload/* .app/Info.plist & > /dev/null
464+ fi
422465 Verbose " Removed UISupportedDevices from app" " Couldn't remove UISupportedDevices from app"
423466 else
424467 echo " The specified iPA doesn't have UISupportedDevices"
425468 fi
426469fi
427470
428471if [ -n " $c " ]; then
429- " $plutil " -replace CFBundleVersion -string " $c " Payload/* .app/Info.plist >> /dev/null
430- Verbose " Changed CFBundleVersion to $c " " Couldn't change CFBundleVersion to $c "
431-
432- " $plutil " -replace CFBundleShortVersionString -string " $c " Payload/* .app/Info.plist >> /dev/null
433- Verbose " Changed CFBundleShortVersionString to $c " " Couldn't change CFBundleShortVersionString to $c "
472+ if [ -n " $iOS " ]; then
473+ " $plutil " -value " $c " -key CFBundleVersion Payload/* .app/Info.plist & > /dev/null
474+ " $plutil " -value " $c " -key CFBundleShortVersionString Payload/* .app/Info.plist & > /dev/null
475+ else
476+ " $plutil " -replace CFBundleVersion -string " $c " Payload/* .app/Info.plist & > /dev/null
477+ " $plutil " -replace CFBundleShortVersionString -string " $c " Payload/* .app/Info.plist & > /dev/null
478+ fi
479+ Verbose " Changed App Version to $c " " Couldn't Change App Version"
434480fi
435481
436482# FAKESIGNING
0 commit comments