mirror of
https://github.com/NohamR/MasterPDFEditor-patch.git
synced 2026-11-25 15:19:58 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba926d781c | ||
|
|
acdbd1a3a2 | ||
|
|
c77cb47e51 |
No files matched your search
@@ -2,3 +2,6 @@
|
|||||||
*.a
|
*.a
|
||||||
!tinyhook/*.a
|
!tinyhook/*.a
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
/src
|
||||||
|
/build
|
||||||
|
.vscode/settings.json
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# Master PDF Editor Patch
|
# Master PDF Editor Patch
|
||||||
|
|
||||||
Bypasses license validation for **Master PDF Editor 5.9.98** using inline hooking via [tinyhook](https://github.com/Antibioticss/tinyhook).
|
Bypasses license validation for **Master PDF Editor 5.9.99** using inline hooking via [tinyhook](https://github.com/Antibioticss/tinyhook).
|
||||||
|
|
||||||
Supports both **Apple Silicon (arm64)** and **Intel (x86_64)** architectures.
|
Supports both **Apple Silicon (arm64)** and **Intel (x86_64)** architectures.
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ The dylib hooks `MainWindow::ValidateLicense` to force license flags, then calls
|
|||||||
## Build
|
## Build
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone --recurse-submodules https://github.com/nohamelin/MasterPDFEditor-patch.git
|
git clone --recurse-submodules https://github.com/NohamR/MasterPDFEditor-patch.git
|
||||||
cd MasterPDFEditor-patch
|
cd MasterPDFEditor-patch
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
@@ -20,10 +20,20 @@ Output: `MasterPDFEditor.dylib`
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
To use the dylib, you have two options:
|
||||||
|
|
||||||
|
**Option 1 — DYLD_INSERT_LIBRARIES** (requires SIP to be turned off; refer to [Apple's documentation](https://developer.apple.com/documentation/security/disabling-and-enabling-system-integrity-protection)):
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
DYLD_INSERT_LIBRARIES=/path/to/MasterPDFEditor.dylib '/Applications/Master PDF Editor.app/Contents/MacOS/Master PDF Editor'
|
DYLD_INSERT_LIBRARIES=/path/to/MasterPDFEditor.dylib '/Applications/Master PDF Editor.app/Contents/MacOS/Master PDF Editor'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Option 2 — Permanent injection** (uses [optool](https://github.com/alexzielenski/optool) to inject the dylib into the app bundle):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./inject.sh /path/to/MasterPDFEditor.dylib '/Applications/Master PDF Editor.app'
|
||||||
|
```
|
||||||
|
|
||||||
## Analysis
|
## Analysis
|
||||||
|
|
||||||
Full reverse engineering write-up: [noham.dev](https://noh.am/en/posts/master-pdf-editor-patch-analysis/)
|
Full reverse engineering write-up: [noh.am](https://noh.am/en/posts/master-pdf-editor-patch-analysis/)
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e # Exit immediately if a command exits with a non-zero status
|
||||||
|
|
||||||
|
# Function to display usage instructions
|
||||||
|
usage() {
|
||||||
|
echo "Usage: $0 <dylib> <app_path>"
|
||||||
|
echo " dylib - The dynamic library to inject."
|
||||||
|
echo " app_path - The path to the .app bundle."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ensure required arguments are provided
|
||||||
|
if [ "$#" -ne 2 ]; then
|
||||||
|
echo "[ERROR] Incorrect number of arguments."
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
DYLIB=$1
|
||||||
|
APP_PATH=$2
|
||||||
|
|
||||||
|
# Validate inputs
|
||||||
|
if [ ! -f "$DYLIB" ]; then
|
||||||
|
echo "[ERROR] The specified dynamic library ($DYLIB) does not exist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$APP_PATH" ]; then
|
||||||
|
echo "[ERROR] The specified app path ($APP_PATH) does not exist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
INFO_PLIST_PATH="$APP_PATH/Contents/Info.plist"
|
||||||
|
if [ ! -f "$INFO_PLIST_PATH" ]; then
|
||||||
|
echo "[ERROR] Info.plist not found at $INFO_PLIST_PATH"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get the executable name from Info.plist
|
||||||
|
APP_NAME=$(/usr/libexec/PlistBuddy -c "Print CFBundleExecutable" "$INFO_PLIST_PATH")
|
||||||
|
if [ -z "$APP_NAME" ]; then
|
||||||
|
echo "[ERROR] Could not read CFBundleExecutable from $INFO_PLIST_PATH"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[INFO] Executable name: $APP_NAME"
|
||||||
|
|
||||||
|
EXECUTABLE_PATH="$APP_PATH/Contents/MacOS/$APP_NAME"
|
||||||
|
if [ ! -f "$EXECUTABLE_PATH" ]; then
|
||||||
|
echo "[ERROR] The specified executable ($EXECUTABLE_PATH) does not exist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ensure Resources folder exists
|
||||||
|
mkdir -p "$APP_PATH/Contents/Resources/"
|
||||||
|
|
||||||
|
# Copy the dylib to the Resources folder
|
||||||
|
cp "$DYLIB" "$APP_PATH/Contents/Resources/"
|
||||||
|
echo "[INFO] Copied $DYLIB to $APP_PATH/Contents/Resources/"
|
||||||
|
|
||||||
|
# # Remove existing code signature
|
||||||
|
# codesign --remove-signature "$EXECUTABLE_PATH"
|
||||||
|
# echo "[INFO] Removed existing code signature from $EXECUTABLE_PATH"
|
||||||
|
|
||||||
|
# Inject the dylib using optool
|
||||||
|
optool install -c load -p "@executable_path/../Resources/$(basename "$DYLIB")" -t "$EXECUTABLE_PATH"
|
||||||
|
echo "[INFO] Injected $DYLIB into $EXECUTABLE_PATH"
|
||||||
|
|
||||||
|
# Re-sign the application
|
||||||
|
sudo codesign -f -s - --timestamp=none --all-architectures --deep "$APP_PATH"
|
||||||
|
sudo xattr -cr "$APP_PATH"
|
||||||
|
echo "[INFO] Re-signed $APP_PATH"
|
||||||
|
|
||||||
|
exit 0
|
||||||
@@ -3,11 +3,11 @@
|
|||||||
#include "tinyhook/include/tinyhook.h"
|
#include "tinyhook/include/tinyhook.h"
|
||||||
|
|
||||||
#if defined(__arm64__) || defined(__aarch64__)
|
#if defined(__arm64__) || defined(__aarch64__)
|
||||||
#define kValidateLicenseAddress 0x10034D4F0
|
#define kValidateLicenseAddress 0x10034E5B8
|
||||||
#define kSetRegProgramAddress 0x10026C430
|
#define kSetRegProgramAddress 0x10026D1AC
|
||||||
#elif defined(__x86_64__)
|
#elif defined(__x86_64__)
|
||||||
#define kValidateLicenseAddress 0x10038E2D0
|
#define kValidateLicenseAddress 0x10038F630
|
||||||
#define kSetRegProgramAddress 0x100296D90
|
#define kSetRegProgramAddress 0x100297DA0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define kGuardFlagOffset 107
|
#define kGuardFlagOffset 107
|
||||||
|
|||||||
Reference in new issue
Block a user