Re-sign using Xcode [this way is relatively easy]

Steps:

1. Create an Xcode project

2. Decompress the ipA package of wechat and replace it with the. App file

  • Delete the PlugIns/Watch folder
  • Replace it with your own bundleID and go to info.plist to change it

The Bundle ID must be the same as the Bundle ID of our newly created factory.

  • Re-sign the frame under the Framewroks with the certificate

Codesign-fs “iPhone Developer: XXX (XXXXXXXX)” mars.framework codesign -fs “iPhone Developer: XXX (XXXXXXXX)” MMCommon.framework codesign -fs “iPhone Developer: XXX (XXXXXXXX)” MultiMedia.framework codesign -fs “iPhone Developer: XXX (XXXXXXXX)” WCDB.framework

4. When Xcode runs, you can run the WeChat to your mobile phone

#### use XCode script automatic signature to create an APP folder under the project. As long as you place the IPA package in that folder, you can automatically install the signature on your phone [Monkey] 1. Place the IPA package to be re-signed in the APP directory

2. Add a script file to the project

3. Write the automatic signature step to the script

Script information (in fact, these steps are manual signature to do)

# ${SRCROOT
TEMP_PATH="${SRCROOT}/Temp"
# Resource folder
ASSETS_PATH="${SRCROOT}/APP"
# IPA packet path
TARGET_IPA_PATH="${ASSETS_PATH}/*.ipa"

Create a Temp folder
rm -rf "${TEMP_PATH}"
mkdir -p "${TEMP_PATH}"

# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
# 1. Decompress IPA into Temp
Decompress ipA package to Temp directory
unzip -oqq "$TARGET_IPA_PATH" -d "$TEMP_PATH"
Get the path to the unzipped temporary App
TEMP_APP_PATH=$(set -- "$TEMP_PATH/Payload/"*.app;echo "The $1")
# print
echo "TEMP_APP_PATH:$TEMP_APP_PATH"

# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
# 2. Copy the unzipped. App
#BUILT_PRODUCTS_DIR APP package path generated by the project
# TARGET_NAME target name
TARGET_APP_PATH="$BUILT_PRODUCTS_DIR/$TARGET_NAME.app"
echo "TARGET_APP_PATH:$TARGET_APP_PATH"

rm -rf "$TARGET_APP_PATH"
mkdir -p "$TARGET_APP_PATH"
cp -rf "$TEMP_APP_PATH/" "$TARGET_APP_PATH/"


# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
# 3. Remove extension and watchAPP to simplify the reskin process. In addition, personal free certificates cannot be signed with extension
echo "Removing AppExtensions"
rm -rf "$TARGET_APP_PATH/PlugIns"
rm -rf "$TARGET_APP_PATH/Watch"

# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
# 4. Update the BundleId in info.plist
# Set "KEY Value" "target file path.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier $PRODUCT_BUNDLE_IDENTIFIER" "$TARGET_APP_PATH/Info.plist"

# 5. Grant permissions on executable files
Add ipA binary execution permission, otherwise Xcode will tell it will not run
The 'Executable file' key of info.plist should correspond to the name of the Executable file in the third-party app package
# Grep and take the last line, then cut to extract the key information you want. Put it in APP_BINARY
APP_BINARY=`plutil -convert xml1 -o - $TARGET_APP_PATH/Info.plist|grep -A1 Exec|tail -n1|cut -f2 -d\>|cut -f1 -d\ < `This adds executable permissions to binary files +X
chmod +x "$TARGET_APP_PATH/$APP_BINARY"

# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
# 6. Re-sign existing dynamic libraries under third-party app Frameworks
TARGET_APP_FRAMEWORKS_PATH="$TARGET_APP_PATH/Frameworks"
if [ -d "$TARGET_APP_FRAMEWORKS_PATH" ];
then
Walk through the paths of all dynamic libraries
for FRAMEWORK in "$TARGET_APP_FRAMEWORKS_PATH/"*
do
echo "🍺 🍺 🍺 🍺 🍺 🍺 FRAMEWORK:$FRAMEWORK"
Sign #
/usr/bin/codesign --force --sign "$EXPANDED_CODE_SIGN_IDENTITY" "$FRAMEWORK"
done
fi
Copy the code

#### use the Monkeydev automatic signature ##### step

  • Monkey’s integration github.com/AloneMonkey…
  • Create a MonkeyDev project

  • Put the broken IPA package in the Target directory

Direct run can run to our mobile phone #####Monkeydev principle we can find the same place, Monkeydev also has its own script

Inside also did the same heavy signature operation, here are interested in their own to see, I will not do more to explain

Later I will upload and share the source code of these projects…