美文网首页
微信重签名、打包、安装脚本

微信重签名、打包、安装脚本

作者: htfang | 来源:发表于2018-01-18 14:22 被阅读0次

# !/bin/bash

SOURCEIPA="$1"

MOBILEPROV="$2"

DYLIB="$3"

LIBSUBSTRATE="$4"

cd ${SOURCEIPA%/*}

security find-identity -v -p codesigning > cers.txt

while IFS='' read -r line || [[ -n "$line" ]]; do

    if [[ "$line" =~ "iPhone Developer" ]]; then

      DEVELOPER=${line:47:${#line}-48}

    fi

done < cers.txt

echo "修改环境依赖"

install_name_tool -change /Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate @loader_path/libsubstrate.dylib "$DYLIB"

unzip -qo "$SOURCEIPA" -d extracted

APPLICATION=$(ls extracted/Payload/)

echo "Copying dylib and mobileprovision"

cp "$DYLIB" "extracted/Payload/$APPLICATION/${DYLIB##*/}"

cp "$MOBILEPROV" "extracted/Payload/$APPLICATION/embedded.mobileprovision"

cp "$LIBSUBSTRATE" "extracted/Payload/$APPLICATION/${LIBSUBSTRATE##*/}"

echo "Insert dylib into Mach-O file"

./yololib "extracted/Payload/$APPLICATION/${APPLICATION%.*}" "${DYLIB##*/}"

echo "Resigning with certificate: $DEVELOPER"

find -d extracted  \( -name "*.app" -o -name "*.appex" -o -name "*.framework" -o -name "*.dylib" \) > directories.txt

security cms -D -i "extracted/Payload/$APPLICATION/embedded.mobileprovision" > t_entitlements_full.plist

/usr/libexec/PlistBuddy -x -c 'Print:Entitlements' t_entitlements_full.plist > t_entitlements.plist

while IFS='' read -r line || [[ -n "$line" ]]; do

    /usr/bin/codesign --continue -f -s "$DEVELOPER" --entitlements "t_entitlements.plist"  "$line"

done < directories.txt

echo "Creating the Signed IPA"

cd extracted

zip -qry ../extracted.ipa *

cd ..

rm -rf "extracted"

rm directories.txt

rm cers.txt

rm t_entitlements.plist

rm t_entitlements_full.plist

echo "Installing APP to your iOS Device"

#mobiledevice install_app extracted.ipa

ideviceinstaller -i extracted.ipa

rm extracted.ipa

相关文章

网友评论

      本文标题:微信重签名、打包、安装脚本

      本文链接:https://www.haomeiwen.com/subject/alhwoxtx.html