A framework of injection

  1. New project 001–Demo, re-signed according to the xcodecodesign. sh file of script re-signed in my last article
  2. Xcode -> TARGETS -> + number ->Cocoa Touch Framework
  3. Create a new class in the meryinFramework file, in the +(void)load method of the class, code, such as
+(void)load{
    NSLog(@"meryin--------------xx--");
}
Copy the code
  1. Binding meryinFramework: TARGETS ->001–Demo ->+New Copy File Phase, change Ddestination to Frameworks under Copy File, then add the + sign under Copy File to the New meryinFramework, And then build it
  2. Copy the **yololib** tool to the /usr/local/bin folder
  3. Project 001–Demo Products, 001–Demo. App Display package contents Find the executable file in the package contents and copy it to the desktopyololib WeChat Frameworks/meryinFramework.framework/meryinFrameworkSo you change the framework dependency 7 of the Macho file. After the modification is successful, open WeChat IPA in the App folder of the project folder as an archive. Then, carry out Payload, find the package content, display the package content, find the WeChat executable file in the package content, and replace it with the WeChat executable file in step 6
  4. Then package the replaced WeChat. App file into WeChat. Ipazip -ry WeChat.ipa PayloadTo replace the original IPA
  5. Finally, only the replaced WeChat. Ipa is left in the App folder, and the result is as follows:

    Use MachOView to view macho framework dependencies:

Two Dylib injection

  1. Then the above project 001–Demo, Xcode -> TARGETS -> + create macOS->Library create meryinDylib

2. Change the Base SDK to iOS

  1. Bind meryinDylib: select meryinDylib build, change Ddestination to Frameworks in Copy File, and add the + sign in Copy File to the new meryinDylib
  2. In the xcodecodesign.sh file, enter the code:
# 7 Inject dylib
echo "Start infusion."
FRAMEWORK_PATH="Frameworks/libmeryinDylib.dylib"
yololib "$TARGET_APP_PATH/$APP_BINARY" "$FRAMEWORK_PATH"
echo "End of injection"
Copy the code
  1. Write the test code in Meryindylib.m and run it
+(void)load{
    NSLog(@"meryin=dylib------");
}
Copy the code

The results are as follows