Skip to content

Commit 4e18b2f

Browse files
author
Mike Richter
committed
Merged PR 3916: Fix issue found in README.md #18477
Fix issue found in README.md #18477 Related work items: #18477
2 parents ca83390 + 0240168 commit 4e18b2f

File tree

1 file changed

+41
-38
lines changed

1 file changed

+41
-38
lines changed

README.md

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ PreEmptive Protection for iOS - Rename
1111

1212
*PPiOS-Rename* works with more than just your project's code. It also automatically finds symbols to exclude from renaming by looking at all external/dependent frameworks and in Core Data (xcdatamodel) files. The renamed symbols will also be applied to your XIB/Storyboard files, and to any open-source CocoaPods libraries in your project.
1313

14-
*PPiOS-Rename* is licensed under the GNU GPL v2, but commercial support is also available from [PreEmptive Solutions](https://www.preemptive.com/contact/contactus) via a commercial support agreement. Please see LICENSE.txt for details.
14+
*PPiOS-Rename* is licensed under the GNU GPL v2, but commercial support is also available from [PreEmptive](https://www.preemptive.com/contact/contactus) via a commercial support agreement. Please see LICENSE.txt for details.
1515

1616
> DEVELOPER NOTE: This fork includes a substantial rewrite of the git history, to fix [a corrupted commit in the original repo](https://github.com/nygard/class-dump/commit/509591f78f37905913ba0cbd832e5e4f7b925a8a). More details are in [the changelog](CHANGELOG.md).
1717
@@ -90,7 +90,7 @@ Once you are comfortable using *PPiOS-Rename*, it can be easier to use if you in
9090

9191
1. Open the project in Xcode.
9292

93-
2. Go to the Project Navigator, and select the project.
93+
2. Go to the Project navigator, and select the project.
9494

9595
3. Select the icon to open the "Show project and targets list" (near the upper left corner of the main pane).
9696

@@ -105,11 +105,11 @@ Once you are comfortable using *PPiOS-Rename*, it can be easier to use if you in
105105
1. Select Build Settings, select _All_ settings, select _Combined_ view, and search for `plist`.
106106
2. Update the value for `Info.plist File` to be consistent with that of the original target (something like `<project-name>/Build and Analyze <original-target-name>-Info.plist`).
107107
3. Move/rename the duplicated `.plist` file to the new name and path (e.g. using Finder).
108-
4. Delete the now stale reference to the default `.plist` file from the Project Navigator.
108+
4. Delete the now stale reference to the default `.plist` file from the Project navigator.
109109

110110
7. Select Build Phases.
111111

112-
8. Add a script phase by selecting the `+` (just above Target Dependencies), and then selecting New Run Script Phase (it should run as the last phase, and will by default).
112+
8. Add a script phase: select the `+` (just above the "Dependencies" phase), and then select "New Run Script Phase" (it should be the last phase, and will be by default).
113113

114114
9. Rename the phase from `Run Script` to `Analyze Binary`.
115115

@@ -121,9 +121,9 @@ Once you are comfortable using *PPiOS-Rename*, it can be easier to use if you in
121121
test -z "$sdk" && sdk="$CORRESPONDING_SIMULATOR_PLATFORM_DIR/Developer/SDKs/iPhoneSimulator${SDK_VERSION}.sdk"
122122
ppios-rename --analyze --sdk-root "$sdk" "$BUILT_PRODUCTS_DIR/$EXECUTABLE_PATH"
123123

124-
11. From the menu, select Product | Scheme | Manage Schemes.
124+
11. From the menu, select `Product` > `Scheme` > `Manage Schemes...`.
125125

126-
12. If Autocreate Schemes is enabled, a new scheme for the duplicated target will have already been created. Rename it to `Build and Analyze <original-scheme-name>`, and close the dialog. Otherwise, create a new scheme for the Build and Analyze target.
126+
12. If Autocreate Schemes is enabled, a new scheme for the duplicated target will have already been created. Rename it to `Build and Analyze <original-scheme-name>`, and close the dialog. Otherwise, create a new scheme for the "Build and Analyze ..." target.
127127

128128
13. <a name="configureRenaming"></a>Duplicate the original target again, and rename it to `Apply Renaming to <original-target-name>`. Again, optionally renaming the `Info.plist` file as described in [step 6](#renameInfoPlist).
129129
> Notes: Signing details for the target may need to be set in order for the build to complete successfully. These can be configured on the General tab.
@@ -149,11 +149,11 @@ When ready to start testing an obfuscated build:
149149

150150
1. Ensure all local source code changes have been committed.
151151

152-
2. Build using the Build and Analyze scheme, producing the symbols file, `symbols.map`.
152+
2. Build using the `Build and Analyze ...` scheme, producing the symbols file, `symbols.map`.
153153

154154
3. Commit or otherwise preserve the `symbols.map` file.
155155

156-
4. Build using the Apply Renaming scheme, which applies the renaming to the sources.
156+
4. Build using the `Apply Renaming to ...` scheme, which applies the renaming to the sources.
157157

158158
5. Build using the original scheme.
159159

@@ -335,7 +335,7 @@ This error happens when `--analyze` is used on an already obfuscated binary. Thi
335335
Advanced Topics
336336
---------------
337337

338-
### Locating the Obfuscated Binary
338+
### Locate the Obfuscated Binary
339339

340340
When looking to verify obfuscation, you must first locate the obfuscated binary.
341341

@@ -357,7 +357,7 @@ If you build from the command line (e.g. `xcodebuild`), this will typically crea
357357

358358
* Binary: `Release-[iphoneos|iphonesimulator]/{AppName}.app/{AppName}`
359359

360-
### Verifying obfuscation
360+
### Verify obfuscation
361361

362362
To verify that your app has been obfuscated, use the `nm` utility, which is included in the Xcode Developer Tools. Run:
363363

@@ -374,13 +374,13 @@ This will show the symbols from your app. If you do this with an unobfuscated bu
374374
>Note: The `X__PPIOS_DOUBLE_OBFUSCATION_GUARD__` symbol is used to help ensure renaming is applied properly.
375375
376376

377-
### Reversing obfuscation in crash dumps
377+
### Reverse obfuscation in crash dumps
378378

379379
*PPiOS-Rename* lets you reverse the process of obfuscation for crash dump files. This is important so you can find the original classes and methods involved in a crash. It does this by using the information from a map file (e.g. `symbols.map`) to modify the crash dump text, replacing the obfuscated symbols with the original names. For example:
380380

381381
ppios-rename --translate-crashdump --symbols-map path/to/symbols_x.y.z.map path/to/crashdump path/to/output
382382

383-
### Analyzing Dynamic Frameworks
383+
### Analyze Dynamic Frameworks
384384

385385
Analyzing a dynamic framework is similar to analyzing an application, but will probably require many more filters. To start, use:
386386

@@ -399,7 +399,7 @@ You then need to determine and use the proper filters. You will need to choose o
399399

400400
Once you have run `ppios-rename --analyze` with the proper filters, continue with the standard `ppios-rename --obfuscate-sources` step and follow the rest of the instructions.
401401

402-
### Obfuscating Static Libraries
402+
### Obfuscate Static Libraries
403403

404404
Static libraries cannot be directly processed by *PPiOS-Rename*, but it is possible to work around the technical issue preventing direct processing. Although the initial setup is somewhat involved, once this is complete the build process is no more complicated than with other *PPiOS-Rename* projects. The basic idea is:
405405

@@ -434,33 +434,36 @@ The procedure is as follows:
434434
3. Select `Create`.
435435

436436
5. Select the WrappingApp target, then `Product` > `Build` to verify that the project builds.
437-
6. Go to the Project Navigator, select the `WrappingApp` project, and select the `WrappingApp` target.
438-
7. Select `General`, scroll to the bottom, and select the `+` to add to the list of `Linked Frameworks and Libraries`.
437+
6. Go to the Project navigator, select the `WrappingApp` project, and select the `WrappingApp` target.
438+
7. Select `General`, scroll to the bottom, and select the `+` to add to the list of `Frameworks, Libraries, and Embedded Content`.
439439
8. Add `libStaticLib.a`.
440440
9. Select `Build Settings`, search for `other linker`, and set `Other Linker Flags` to include `-ObjC`.
441-
10. Select `Product` > `Clean Build Folder` and build again to verify that the workspace builds correctly. It should build the static library first and then the app.
441+
10. Select `Product` > `Clean Build Folder` and build again to verify that the project still builds correctly. This time, building the app should also build the static library.
442442

443443
3. Setup *PPiOS-Rename* to analyze the app:
444444
1. Follow instructions [5-12 in `Project Setup` above](#configureAnalyze), but apply them to `WrappingApp`, rather than the static library, and modify the original `WrappingApp` target. Duplication of the target is unnecessary.
445445
2. <a name="countUniqueSymbols"></a>Clean and build the `Build and Analyze WrappingApp` target.
446-
3. Review the build log in the report navigator and look for the number of `Generated unique symbols`. This number should include all of the public and all of the non-public symbols from `StaticLib`. This will also include a small number of symbols from classes in the app itself. Symbols from the app should be benign, but can be excluded manually if necessary.
446+
3. Review the build log in the Report navigator and look for the number of `Generated unique symbols`. This number should include all of the public and all of the non-public symbols from `StaticLib`. This will also include a small number of symbols from classes in the app itself. Symbols from the app should be benign, but can be excluded manually if necessary.
447447
4. Create a list of public types for the static library named `public-types.list`. Either create the list using the following procedure, or create the list manually. The procedure requires that the names of the public header files match the names of the types, or follow the `AffectedType+CategoryName.h` convention.
448-
1. Go to the Report Navigator, review the log for a build of `StaticLib`, select a copy file task for one of the header files, right-click and `Copy`.
449-
2. Paste the result in a text editor.
450-
3. Select and copy the build output path. This should have the form: `<products-directory>/include/StaticLib`, and contain the string `/DerivedData/`.
451-
4. At a command line, run the following commands, from `someParentDir`:
452-
453-
# Replace ".../include/StaticLib" with the build output path
454-
# Replace "StaticLib" with the name of the umbrella header
455-
ls ".../include/StaticLib" | sed 's/.*+//' | sed 's/[.]h$//' | grep -v StaticLib > public-types.list
456-
# Or omit the grep -v part if you have no umbrella header
457-
ls ".../include/StaticLib" | sed 's/.*+//' | sed 's/[.]h$//' > public-types.list
458-
# verify the contents
459-
less public-types.list
460-
# SLAPublicClass
461-
# SLProtocolForSomething
462-
# SLSomeCategory
463-
# ...
448+
1. Get the build-output path from the last build log:
449+
1. Go to the Report navigator, select the last build of `WrappingApp`, and select `All` and `All Messages` at the top.
450+
2. Near the bottom of the part of the log that pertains to `StaticLib`, select one of the `Copy` tasks for the headers for `StaticLib`, right-click and select `Copy`.
451+
3. Paste the result in TextEdit (e.g. Command+Space "textedit").
452+
4. Select and copy the build-output path (the last argument to the `builtin-copy` command). This should have the form: `<products-directory>/include/StaticLib`, and `<products-directory>` should contain the string `/DerivedData/`.
453+
2. Construct the list of types from a list of files in the build-output path. Run the following commands in Terminal from the `someParentDir` directory:
454+
1. List the header files in the build-output path to verify it. Replace `<build-output>` with the path copied from TextEdit (keep the quotation marks to prevent embedded spaces from causing issues):
455+
456+
ls -1 "<build-output>"
457+
458+
2. If you have an umbrella header, replace `StaticLib` with the name of the umbrella header (no `.h`):
459+
460+
ls "<build-output>" | sed 's/.*+//' | sed 's/[.]h$//' | grep -v StaticLib > public-types.list
461+
462+
3. Otherwise, omit the `grep -v ...` part if you have no umbrella header:
463+
464+
ls "<build-output>" | sed 's/.*+//' | sed 's/[.]h$//' > public-types.list
465+
466+
4. Verify the contents of the `public-types.list` file by opening it in TextEdit.
464467

465468
>Note: This is an additional point of maintenance: as types are added to or removed from the public API of the library, the `public-types.list` will need to be updated accordingly.
466469
@@ -475,23 +478,23 @@ The procedure is as follows:
475478
"$BUILT_PRODUCTS_DIR/$EXECUTABLE_PATH"
476479

477480
6. Repeat steps [3.ii - 3.iii](#countUniqueSymbols). The number of unique symbols should decrease, but still be significant. This should be the count of all of the non-public symbols (non-public symbols for which there are not public symbols with the same name).
478-
7. Review the list of types that will be renamed by executing the following at a command line, from `someParentDir` (assumes all of the type names are prefixed with the two letters `SL`):
481+
7. Review the list of types that will be renamed by executing the following in Terminal, from the `someParentDir` directory. Replace `SL` with the two or three letter prefix of the types in the library:
479482

480483
cat WrappingApp/symbols.map | awk '{print $3}' | sed 's/[",]//g' | grep '^SL' > renamed-types.txt
481-
less renamed-types.txt
482484

483-
8. Adjust `public-types.list` as necessary to ensure that all public types are not renamed.
485+
8. Review the list of renamed types by opening `renamed-types.txt` in TextEdit.
486+
9. Adjust `public-types.list` as necessary to ensure that all public types are not renamed.
484487

485488
4. Modify the static library project to apply the renaming:
486489
1. Follow instructions [13-16 in `Project Setup` above](#configureRenaming), applying them to the `StaticLib` target (duplicating the target this time).
487-
2. The call to `ppios-rename` needs to reference the `symbols.map` file from the WrappingApp project, using the `--symbols-map` option. Use this script for the new Run Script phase (adjusting the path as necessary):
490+
2. For step 17, the call to `ppios-rename` needs to reference the `symbols.map` file from the WrappingApp project, using the `--symbols-map` option. Use this script for the new Run Script phase (adjusting the path as necessary):
488491

489492
PATH="$PATH:$HOME/Downloads/PPiOS-Rename-v1.4.0"
490493
ppios-rename --obfuscate-sources --symbols-map ../WrappingApp/symbols.map
491494

492495
3. Follow instruction [18 in `Project Setup` above](#renameApplyRenamingScheme).
493496

494-
5. All of these changes (to the static library, WrappingApp, and `public-types.list`) should be committed to source control at this point, since building the target to Apply Renaming will change the sources in ways that shouldn't generally be committed.
497+
5. All of these changes (to the static library, WrappingApp, the workspace, and `public-types.list`) should be committed to source control at this point, since building the target to Apply Renaming will change the sources in ways that shouldn't generally be committed. `renamed-types.txt` should not be committed. `WrappingApp/symbols.map` should not be committed at this point (but do commit to source control or otherwise preserve this file for release builds).
495498

496499
The process to build the static library with renaming becomes:
497500
1. Ensure that build environment is clean (e.g. all stale symbols files have been removed, and modifications to .xib files have been reverted).

0 commit comments

Comments
 (0)