Skip to content

Instantly share code, notes, and snippets.

@0xc010d
Forked from xslim/recodesign.sh
Created June 20, 2012 15:31
Show Gist options
  • Save 0xc010d/2960507 to your computer and use it in GitHub Desktop.
Save 0xc010d/2960507 to your computer and use it in GitHub Desktop.
Recodesign ipa
#!/bin/sh
SAVEDIR=`pwd`
WORKDIR=/tmp/ipa_$RANDOM$RANDOM
WORKIPA=/tmp/ipa_$RANDOM$RANDOM.ipa
echo unpacking $1
mkdir -p $WORKDIR
unzip "$1" -d $WORKDIR > /dev/null || exit
cd $WORKDIR
SAVEIFS=$IFS
IFS=$'\n'
for f in $(find Payload -mindepth 1 -maxdepth 2 -type d); do
echo Processing "$f"
rm -rf "$f"/_CodeSignature
cat >"$f"/ResourceRules.plist <<XXX
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>rules</key>
<dict>
<key>.*</key>
<true/>
<key>Info.plist</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>ResourceRules.plist</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>100</real>
</dict>
</dict>
</dict>
</plist>
XXX
codesign -f -s "iPhone Developer" -vvv "$f"
done
IFS=$SAVEIFS
echo repacking
zip -9yr $WORKIPA * > /dev/null
cd $SAVEDIR && mv "$1" "$1.$RANDOM$RANDOM.bak" && mv $WORKIPA "$1" && rm -rf $WORKIPA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment