Skip to content

Instantly share code, notes, and snippets.

@userlandkernel
Created February 28, 2020 12:10
Show Gist options
  • Save userlandkernel/a0b8cd50ad79e0eb3be1ee618008eae8 to your computer and use it in GitHub Desktop.
Save userlandkernel/a0b8cd50ad79e0eb3be1ee618008eae8 to your computer and use it in GitHub Desktop.
CONF_DSID="12345678"
CONF_EMAIL="automation@phonecheck.com"
CONF_ARTWORK="https://placehold.it/400x400"
if [ ! -f "$1" ]; then
echo "Usage: $0 /path/to/app.ipa"
exit 1;
fi
function unpack() {
mkdir -p /tmp/iparepack.tmp
unzip "$1" -d /tmp/iparepack.tmp
rm -rf /tmp/iparepack.tmp/Payload/iTunesMetadata.plist
}
function build_metadata() {
# Build Artwork
IMAGE=$(curl -s "$CONF_ARTWORK" -o -)
echo "$IMAGE" > /tmp/iparepack.tmp/iTunesArtwork
# Build metadata
METADATA="<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
METADATA+="<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">"
METADATA+="<plist version=\"1.0\">"
METADATA+="<dict>"
METADATA+="<key>appleId</key>"
METADATA+="<string>$CONF_EMAIL</string>"
METADATA+="<key>artistId</key>"
METADATA+="<integer>1445150854</integer>"
METADATA+="<key>artistName</key>"
METADATA+="<string>PhoneCheck Automation</string>"
METADATA+="<key>bundleDisplayName</key>"
METADATA+="<string>PhoneCheck Auto-App</string>"
METADATA+="<key>bundleShortVersionString</key>"
METADATA+="<string>2.1.7</string>"
METADATA+="<key>bundleVersion</key>"
METADATA+="<string>11122019</string>"
METADATA+="<key>com.apple.iTunesStore.downloadInfo</key>"
METADATA+="<dict>"
METADATA+="<key>accountInfo</key>"
METADATA+="<dict>"
METADATA+="<key>AccountStoreFront</key>"
METADATA+="<string>143465-19,32</string>"
METADATA+="<key>AppleID</key>"
METADATA+="<string>$CONF_EMAIL</string>"
METADATA+="<key>DSPersonID</key>"
METADATA+="<integer>$CONF_DSID</integer>"
METADATA+="<key>DownloaderID</key>"
METADATA+="<integer>0</integer>"
METADATA+="<key>FamilyID</key>"
METADATA+="<integer>0</integer>"
METADATA+="<key>PurchaserID</key>"
METADATA+="<integer>$CONF_DSID</integer>"
METADATA+="</dict>"
METADATA+="<key>purchaseDate</key>"
METADATA+="<string>2019-10-31T08:36:26Z</string>"
METADATA+="</dict>"
METADATA+="<key>copyright</key>"
METADATA+="<string>© 2019 PhoneCheck LLC</string>"
METADATA+="<key>drmVersionNumber</key>"
METADATA+="<integer>0</integer>"
METADATA+="<key>fileExtension</key>"
METADATA+="<string>.app</string>"
METADATA+="<key>gameCenterEnabled</key>"
METADATA+="<false/>"
METADATA+="<key>gameCenterEverEnabled</key>"
METADATA+="<false/>"
METADATA+="<key>genre</key>"
METADATA+="<string>工具</string>"
METADATA+="<key>genreId</key>"
METADATA+="<integer>6002</integer>"
METADATA+="<key>itemId</key>"
METADATA+="<integer>1485187588</integer>"
METADATA+="<key>itemName</key>"
METADATA+="<string>PhoneCheck Auto-app</string>"
METADATA+="<key>kind</key>"
METADATA+="<string>software</string>"
METADATA+="<key>playlistName</key>"
METADATA+="<string>PhoneCheck Automation</string>"
METADATA+="<key>product-type</key>"
METADATA+="<string>ios-app</string>"
METADATA+="<key>purchaseDate</key>"
METADATA+="<date>2019-10-31T08:36:26Z</date>"
METADATA+="<key>rating</key>"
METADATA+="<dict>"
METADATA+="<key>content</key>"
METADATA+="<string>Advisory.NO.UNRESTRICTED_WEB_ACCESS and Advisory.NO.GAMBLING_CONTESTS</string>"
METADATA+="<key>label</key>"
METADATA+="<string>4+</string>"
METADATA+="<key>rank</key>"
METADATA+="<integer>100</integer>"
METADATA+="<key>system</key>"
METADATA+="<string>itunes-games</string>"
METADATA+="</dict>"
METADATA+="<key>releaseDate</key>"
METADATA+="<string>2019-10-29T06:58:26Z</string>"
METADATA+="<key>s</key>"
METADATA+="<integer>143465</integer>"
METADATA+="<key>softwareIcon57x57URL</key>"
METADATA+="<string>$CONF_ARTWORK</string>"
METADATA+="<key>softwareIconNeedsShine</key>"
METADATA+="<true/>"
METADATA+="<key>softwareVersionBundleId</key>"
METADATA+="<string>rn.notes.best</string>"
METADATA+="<key>softwareVersionExternalIdentifier</key>"
METADATA+="<integer>8833556905</integer>"
METADATA+="<key>softwareVersionExternalIdentifiers</key>"
METADATA+="<array>"
METADATA+="<integer>833357375</integer>"
METADATA+="<integer>833413383</integer>"
METADATA+="<integer>833459554</integer>"
METADATA+="<integer>833525096</integer>"
METADATA+="<integer>833556905</integer>"
METADATA+="</array>"
METADATA+="<key>storeCohort</key>"
METADATA+="<string>7|date=1572510600000&amp;sf=143465&amp;pgtp=Software&amp;pgid=1485187588&amp;prpg=Software_1395946824&amp;ctxt=App%20Store</string>"
METADATA+="<key>vendorId</key>"
METADATA+="<integer>119461735</integer>"
METADATA+="<key>versionRestrictions</key>"
METADATA+="<integer>16843008</integer>"
METADATA+="</dict>"
METADATA+="</plist>"
echo "$METADATA" > /tmp/iparepack.tmp/iTunesMetadata.plist
}
function repack() {
cd /tmp/iparepack.tmp
zip /tmp/repacked.ipa -r *
}
function cleanup() {
rm -rf /tmp/iparepack.tmp
rm -rf /tmp/repacked.ipa
}
function install() {
ideviceinstaller -i /tmp/repacked.ipa
}
unpack $@
build_metadata
repack
install
cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment