@@ -159,7 +159,7 @@ cleanup () {
159159}
160160
161161# CLI ARGUEMENTS
162- while getopts :n:i:o:c:a:b:x:f:d:p:huSewlv args; do
162+ while getopts :n:i:o:c:a:b:x:f:d:p:huSewmglv args; do
163163 case " $args " in
164164 n)
165165 name=" $OPTARG "
@@ -228,7 +228,7 @@ while getopts :n:i:o:c:a:b:x:f:d:p:huSewlv args; do
228228 fi
229229 appleid=" $OPTARG "
230230 until [[ $( eval " echo \$ {$OPTIND }" ) =~ ^-.* ]] || [ -z " $( eval " echo \$ {$OPTIND }" ) " ]; do
231- password=" ( $( eval " echo \$ {$OPTIND }" ) )"
231+ password=" $( eval " echo \$ {$OPTIND }" ) "
232232 OPTIND=$(( OPTIND + 1 ))
233233 done
234234 ;;
@@ -257,8 +257,31 @@ while getopts :n:i:o:c:a:b:x:f:d:p:huSewlv args; do
257257
258258 e) e=1 && run=1 ;;
259259 w) w=1 && run=1 ;;
260- l) l=1 ;;
261260 S) fakesign=1 && run=1 ;;
261+
262+ l)
263+ if [ " $os " != " iOS" ]; then
264+ echo " -l is not supported on your platform"
265+ exit 1
266+ fi
267+ l=1
268+ ;;
269+
270+ m)
271+ if [ " $os " != " iOS" ]; then
272+ echo " -m is not supported on your platform"
273+ exit 1
274+ fi
275+ m=1
276+ ;;
277+
278+ g)
279+ if [ " $os " != " iOS" ]; then
280+ echo " -g is not supported on your platform"
281+ exit 1
282+ fi
283+ g=1
284+ ;;
262285
263286 h)
264287 echo " Usage: azule [options]"
@@ -273,17 +296,20 @@ while getopts :n:i:o:c:a:b:x:f:d:p:huSewlv args; do
273296 echo " -c [Version] Set custom version for output ipa"
274297 echo " -b [BundleId] Set custom BundleID for output ipa"
275298 echo " -p [Name] Set custom Display Name for output ipa"
276- echo " -a [Root Password] Use APT instead of Parcility [iOS Only]"
277299 echo " -u Remove UISupportedDevices from app"
278300 echo " -v Enable Verbose Mode"
279- echo " -m Enables the manual dylib selection 'UI' (Not Recommended)"
280301 echo " -S Fakesigns iPA for use with AppSync"
281302 echo " -e Removes App Extensions"
282303 echo " -w Removes Watch App"
283- echo " -x [Apple ID] [Password] Fetch and decrypt iPA [iOS Only]"
284- echo " -l Don't Update Outdated Apps"
285304 echo " -h Print this help menu"
286305 echo
306+ echo " iOS Only Arguements"
307+ echo " -x [Apple ID] [Password] Fetch and decrypt iPA"
308+ echo " -a [Root Password] Use APT instead of Parcility"
309+ echo " -g Use Flexdecrypt instead of bfdecrypt for decryption"
310+ echo " -m Enforce Updating Apps Before Decrypting"
311+ echo " -l Don't Update Outdated Apps"
312+ echo
287313 echo " Examples:"
288314 echo " azule -n Foo -i ~/Foo.ipa -o ~/Foo/ -f ~/Foo.dylib ~/Foo.bundle"
289315 echo " azule -n Foo -i ~/Foo.ipa -o ~/Foo/ -f com.bar.foo -d Foo.dylib"
@@ -347,11 +373,15 @@ if [[ -z "$run" && -z "$drun" ]]; then
347373 " Remove Watch App"
348374 " Run With Verbose Mode"
349375 " Set Custom Output Name"
350- " Use APT instead of Parcility"
351376 )
352377
353378 if [ " $os " == " iOS" ]; then
354- arguements+=( " Do Not Update Outdated Apps" )
379+ arguements+=(
380+ " Do Not Update Outdated Apps"
381+ " Force Update Apps"
382+ " Decrypt Apps through Flexdecrypt"
383+ " Use APT instead of Parcility"
384+ )
355385 fi
356386
357387 arguements+=( " Done" )
@@ -426,6 +456,10 @@ if [[ -z "$run" && -z "$drun" ]]; then
426456 ;;
427457
428458 " Do Not Update Outdated Apps" ) l=1 ;;
459+
460+ " Force Update Apps" ) m=1 ;;
461+
462+ " Decrypt Apps through Flexdecrypt" ) g=1 ;;
429463
430464 " Run With Verbose Mode" ) v=" -v" ;;
431465
@@ -521,7 +555,7 @@ if [ -n "$drun" ]; then
521555 if [ -n " $currentv " ]; then l+=1; fi
522556
523557 # INSTALL UPDATES
524- if [[ " $latestv " != " $currentv " && " $l " != " 11" ]]; then
558+ if [[ " $latestv " != " $currentv " && " $l " != " 11" ]] || [ -n " $m " ] ; then
525559
526560 # VARIABLE CHECK
527561 if [ -z " $appleid " ]; then while
@@ -536,7 +570,8 @@ if [ -n "$drun" ]; then
536570 [ -z " $password " ] && echo " No Password Provided"
537571 do true ; done ; fi
538572
539- ipatool-azule download -b " $ipadir " -e " $appleid " -p " $password "
573+ if ! ipatool-azule download -b " $ipadir " -e " $appleid " -p " $password " ; then exit 1; fi
574+
540575 appinst " $dir /$tweakid " /* .ipa
541576
542577 while read -r i; do
@@ -548,46 +583,85 @@ if [ -n "$drun" ]; then
548583 done < <( find /var/containers/Bundle/Application -name .com.apple.mobile_container_manager.metadata.plist)
549584 fi
550585
551- # GET IPA DIRECTORY
552- while read -r i; do
553- if [ " $( ExtractPlistValue MCMMetadataIdentifier " $i " ) " = " $ipadir " ]; then
554- bfipadir=" $( dirname " $i " ) /Documents/decrypted-app.ipa"
555- break
586+ if [ -n " $g " ]; then
587+
588+ # FLEXDECRYPT
589+
590+ while read i; do
591+ if [ " $( ExtractPlistValue MCMMetadataIdentifier " $i " ) " = " $ipadir " ]; then
592+ echo " Preparing App..."
593+ mkdir -p Payload
594+ rsync -a $( dirname " $i " ) /* .app Payload
595+ unzipped=1
596+ break
597+ fi
598+ done < <( find /var/containers/Bundle/Application -name .com.apple.mobile_container_manager.metadata.plist)
599+
600+ if [ -z " $unzipped " ]; then
601+ echo " Couldn't find app"
602+ exit 1
603+ fi
604+
605+ while read -r i; do
606+ CFBundleExecutable=" $( ExtractPlistValue CFBundleExecutable " $i " ) "
607+ if [[ -n " $CFBundleExecutable " && " $( otool -l " $( dirname " $i " ) /$CFBundleExecutable " | grep " cryptid 1" ) " ]]; then
608+ if [ -z " $ran " ]; then
609+ echo " Decrypting App..."
610+ fi
611+ flexdecrypt " $( dirname " $i " ) /$CFBundleExecutable " --output " $( dirname " $i " ) /$CFBundleExecutable " & > /dev/null
612+ ran=1
613+ fi
614+ done < <( find Payload/* .app -name " Info.plist" )
615+
616+ if [ -n " $ran " ]; then
617+ echo " Decrypted App"
618+ else
619+ echo " App Was Not Encrypted"
556620 fi
557- done < <( find /var/mobile/Containers/Data/Application -name .com.apple.mobile_container_manager.metadata.plist 2> /dev/null)
621+ else
622+
623+ # BFDECRYPT
624+
625+ while read -r i; do
626+ if [ " $( ExtractPlistValue MCMMetadataIdentifier " $i " ) " = " $ipadir " ]; then
627+ bfipadir=" $( dirname " $i " ) /Documents/decrypted-app.ipa"
628+ break
629+ fi
630+ done < <( find /var/mobile/Containers/Data/Application -name .com.apple.mobile_container_manager.metadata.plist 2> /dev/null)
558631
559- # PRE CLEANUP
560- find /var/mobile/Containers/Data/Application/ -name decrypted-app.ipa & > /dev/null -exec rm -rf " {}" \;
632+ # PRE CLEANUP
633+ find /var/mobile/Containers/Data/Application/ -name decrypted-app.ipa & > /dev/null -exec rm -rf " {}" \;
561634
562- # BFDECRYPT SETUP
563- if ! [[ " $( ExtractPlistValue selectedApplications /var/mobile/Library/Preferences/com.level3tjg.bfdecrypt.plist key) " =~ $ipadir ]]; then
564- cp /var/mobile/Library/Preferences/com.level3tjg.bfdecrypt.plist " $dir /$tweakid /bfbackup.plist"
565- plutil -value " $ipadir " -arrayadd -key selectedApplications /var/mobile/Library/Preferences/com.level3tjg.bfdecrypt.plist > /dev/null
566- fi
635+ # BFDECRYPT SETUP
636+ if ! [[ " $( ExtractPlistValue selectedApplications /var/mobile/Library/Preferences/com.level3tjg.bfdecrypt.plist key) " =~ $ipadir ]]; then
637+ cp /var/mobile/Library/Preferences/com.level3tjg.bfdecrypt.plist " $dir /$tweakid /bfbackup.plist"
638+ plutil -value " $ipadir " -arrayadd -key selectedApplications /var/mobile/Library/Preferences/com.level3tjg.bfdecrypt.plist > /dev/null
639+ fi
567640
568- # KILL APP
569- PID=$( ps awwwx| grep " $bfbinary " | grep container| grep ' .app' | grep -v grep| sed ' s/^\ *//g' | cut -f1 -d\ )
570- if [ -n " $PID " ]; then
571- kill -9 " $PID "
572- fi
641+ # KILL APP
642+ PID=$( ps awwwx| grep " $bfbinary " | grep container| grep ' .app' | grep -v grep| sed ' s/^\ *//g' | cut -f1 -d\ )
643+ if [ -n " $PID " ]; then
644+ kill -9 " $PID "
645+ fi
573646
574- # LAUNCH APP
575- open " $ipadir "
647+ # LAUNCH APP
648+ open " $ipadir "
576649
577- # WAIT FOR IPA
578- until [ -f " $bfipadir " ]; do : ; done
579- while [ -d " $( dirname " $bfipadir " ) /ipa" ]; do : ; done
650+ # WAIT FOR IPA
651+ until [ -f " $bfipadir " ]; do : ; done
652+ while [ -d " $( dirname " $bfipadir " ) /ipa" ]; do : ; done
580653
581- # KILL APP
582- PID=$( ps awwwx| grep " $bfbinary " | grep container| grep ' .app' | grep -v grep| sed ' s/^\ *//g' | cut -f1 -d\ )
583- kill -9 " $PID " & > /dev/null
654+ # KILL APP
655+ PID=$( ps awwwx| grep " $bfbinary " | grep container| grep ' .app' | grep -v grep| sed ' s/^\ *//g' | cut -f1 -d\ )
656+ kill -9 " $PID " & > /dev/null
584657
585- # SET NEW IPADIR
586- ipadir=" $bfipadir "
658+ # SET NEW IPADIR
659+ ipadir=" $bfipadir "
587660
588- # CLEANUP
589- if [ -f " $dir /$tweakid /bfbackup.plist" ]; then
590- mv " $dir /$tweakid /bfbackup.plist" /var/mobile/Library/Preferences/com.level3tjg.bfdecrypt.plist
661+ # CLEANUP
662+ if [ -f " $dir /$tweakid /bfbackup.plist" ]; then
663+ mv " $dir /$tweakid /bfbackup.plist" /var/mobile/Library/Preferences/com.level3tjg.bfdecrypt.plist
664+ fi
591665 fi
592666fi
593667
@@ -597,10 +671,13 @@ if [ -n "$v" ]; then
597671fi
598672
599673# EXTRACTING IPA
600- if [ -n " $run " ]; then
674+ if [[ -n " $run " && -z " $unzipped " ] ]; then
601675 echo " Extracting iPA..."
602676 eval " unzip -q '$ipadir ' -d $dir /'$tweakid '"
603677 Verbose " IPA extracted" " Couldn't extract IPA"
678+ fi
679+
680+ if [ -z " $bfipadir " ]; then
604681 rm -rf " $bfipadir "
605682fi
606683
0 commit comments