Skip to content

Commit

Permalink
fixed: ProxyMan 5.8
Browse files Browse the repository at this point in the history
close #29
  • Loading branch information
marlkiller committed Sep 21, 2024
1 parent a0da743 commit 82ead81
Show file tree
Hide file tree
Showing 9 changed files with 216 additions and 27 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
| AnyGo | 7.* ||| https://itoolab.com/gps-location-changer/ | | |
| Downie | 4.* ||| https://software.charliemonroe.net/downie/ | | |
| Permute | 3.* ||| https://software.charliemonroe.net/permute/ | | |
| ProxyMan | 5. ||| https://proxyman.io/ | | |
| ProxyMan | 5. ||| https://proxyman.io/ | ON | |
| Movist Pro | 2.* ||| https://movistprime.com/ | | |
| Surge | 5.7.* ||| https://nssurge.com/ | ON | |
| Surge | 5.8.* ||| https://nssurge.com/ | ON | |
| Infuse | 7.7.* ||| App Store | | |
| MacUpdater | 3. ||| https://www.corecode.io/macupdater/#download | | |
| CleanShotX | 4. ||| https://updates.getcleanshot.com/v3/ | | |
Expand Down
4 changes: 4 additions & 0 deletions dylib_dobby_hook.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
B57F200F2C5DD70700C87201 /* MockCKDatabase.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MockCKDatabase.m; sourceTree = "<group>"; };
B58160112BE88569001DDB9B /* EncryptionUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EncryptionUtils.m; sourceTree = "<group>"; };
B58160162BE88569001DDB9B /* EncryptionUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EncryptionUtils.h; sourceTree = "<group>"; };
B59751F52C9DAF8600617629 /* fix_helper.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = fix_helper.sh; sourceTree = "<group>"; };
B59751F62C9DB54E00617629 /* fix_helper_and_inject.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = fix_helper_and_inject.sh; sourceTree = "<group>"; };
B5A7D30E2C548B71003D4C7F /* HackProtocolDefault.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HackProtocolDefault.h; sourceTree = "<group>"; };
B5A7D3102C548BAB003D4C7F /* HackProtocolDefault.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HackProtocolDefault.m; sourceTree = "<group>"; };
B5A7D3132C549130003D4C7F /* ForkLiftHelperHack.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ForkLiftHelperHack.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -281,6 +283,8 @@
B5BE2D572C52A4530056B3E2 /* apps */ = {
isa = PBXGroup;
children = (
B59751F52C9DAF8600617629 /* fix_helper.sh */,
B59751F62C9DB54E00617629 /* fix_helper_and_inject.sh */,
B57AEDBA2C5009E400B9C5FB /* forklift_hack.sh */,
);
path = apps;
Expand Down
7 changes: 3 additions & 4 deletions dylib_dobby_hook/dylib_dobby_hook.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,15 @@ + (void) load {


// initTest();

if ([Constant isFirstOpen]) {
NSLog(@">>>>>> dylib_dobby_hook load");
if ([Constant isFirstOpen] && ![Constant isHelper]) {
NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:@"Cracked By\n[marlkiller/dylib_dobby_hook]"];
[alert setInformativeText:@"仅供研究学习使用,请勿用于非法用途"];
[alert addButtonWithTitle:@"OK"];
[alert runModal];
}

if (SHOW_ALARM) {
if (SHOW_ALARM && ![Constant isHelper]) {
NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:@"FBI warning"];
[alert setInformativeText:@"Please confirm if the app has been backed up.\nIf there are any issues, please restore it yourself!"];
Expand Down
20 changes: 12 additions & 8 deletions dylib_dobby_hook/utils/Constant.m
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ + (void)initialize {
NSLog(@">>>>>> [app bundlePath] %@",currentAppPath);
// /Library/PrivilegedHelperTools
if ([currentAppPath isEqualToString:@"/Library/PrivilegedHelperTools"]) {
NSLog(@">>>>>> helper is True");
helper = YES;
}

Expand Down Expand Up @@ -208,21 +209,24 @@ + (BOOL)isSubclassOfClass:(Class)class parentClass:(Class)parentClass {

+ (void)doHack {
NSArray<Class> *personClasses = [Constant getAllHackClasses];

for (Class class in personClasses) {

id<HackProtocol> it = [[class alloc] init];

NSLog(@">>>>>> Constant: Initiating doHack operation...");
for (Class class in personClasses) {
NSLog(@">>>>>> Constant: Processing class - %@", NSStringFromClass(class));
id<HackProtocol> it = [[class alloc] init];
if ([it shouldInject:currentAppName]) {
NSString *supportAppVersion = [it getSupportAppVersion];
if (supportAppVersion!=nil && supportAppVersion.length>0 && ![currentAppVersion hasPrefix:supportAppVersion]){
if (supportAppVersion==NULL ||
supportAppVersion.length==0 ||
currentAppVersion==NULL ||
[currentAppVersion hasPrefix:supportAppVersion] ) {
[it hack];
}else{
NSAlert *alert = [[NSAlert alloc] init];
[alert addButtonWithTitle:@"OK"];
alert.messageText = [NSString stringWithFormat:@"Unsupported current appVersion !!\nSuppert appVersion: [%s]\nCurrent appVersion: [%s]",[it getSupportAppVersion].UTF8String, currentAppVersion.UTF8String];;
[alert runModal];
return;
}
[it hack];
}
return;
}
}
Expand Down
8 changes: 3 additions & 5 deletions dylib_dobby_hook/utils/MemoryUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ + (void)writeMachineCodeString:(NSString *)codeString toAddress:(uintptr_t)addre
+ (void)saveMachineCodeOffsetsToUserDefaults:(NSString *)searchMachineCode offsets:(NSArray<NSNumber *> *)offsets {
NSString *appVersion = [Constant getCurrentAppCFBundleVersion];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

NSMutableDictionary *allOffsetsMap = [NSMutableDictionary dictionaryWithDictionary:[defaults objectForKey:CACHE_MACHINE_CODE_KEY]];

NSLog(@">>>>>> Offset information saved to UserDefaults for %@ machine code: %@",appVersion, offsets);

// Make sure versionMap is mutable
NSMutableDictionary *versionMap = [allOffsetsMap objectForKey:appVersion];
if (!versionMap) {
Expand All @@ -143,8 +143,6 @@ + (void)saveMachineCodeOffsetsToUserDefaults:(NSString *)searchMachineCode offse

[defaults setObject:allOffsetsMap forKey:CACHE_MACHINE_CODE_KEY];
[defaults synchronize];

NSLog(@">>>>>> Offset information saved to UserDefaults for machine code: %@", offsets);
}

+ (NSArray<NSNumber *> *)loadMachineCodeOffsetsFromUserDefaults:(NSString *)searchMachineCode {
Expand All @@ -156,7 +154,7 @@ + (void)saveMachineCodeOffsetsToUserDefaults:(NSString *)searchMachineCode offse

if (versionMap) {
NSArray<NSNumber *> *offsets = [versionMap objectForKey:searchMachineCode];
NSLog(@">>>>>> Offset information loaded from UserDefaults for machine code: %@", offsets);
NSLog(@">>>>>> Offset information loaded from UserDefaults %@ for machine code: %@",appVersion, offsets);
return offsets ?: nil;
}
return nil;
Expand Down
79 changes: 79 additions & 0 deletions script/apps/fix_helper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash

RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m'

##################################################################
# 1. Configuration
##################################################################

current_path=$PWD
mac_patch_helper="$current_path/../tools/mac_patch_helper"
mac_patch_helper_config="$current_path/../tools/patch.json"
SMJobBlessUtil="$current_path/../tools/SMJobBlessUtil-python3.py"

app_name="$1"
helper_name="$2"

echo -e "${GREEN}Helper name: ${helper_name}${NC}"

##################################################################
# 2. Backup
##################################################################

helper_executable_path="/Applications/${app_name}.app/Contents/Library/LaunchServices/${helper_name}"
helper_executable_backup_path="${helper_executable_path}_Backup"
echo -e "${GREEN}Helper executable path: ${helper_executable_path}${NC}"

if [ ! -f "$helper_executable_backup_path" ]; then
cp "$helper_executable_path" "$helper_executable_backup_path"
echo -e "${YELLOW}🔄 Backup created.${NC}"
fi


##################################################################
# 3. Patch
##################################################################

echo -e "${GREEN}🔧 Running mac_patch_helper to apply patch...${NC}"
sudo chmod a+x "$mac_patch_helper"
$mac_patch_helper "$app_name" "$mac_patch_helper_config"

app_path="/Applications/${app_name}.app"
app_helper_path="/Applications/${app_name}.app/Contents/Library/LaunchServices/${helper_name}"

echo -e "${YELLOW}Updating permissions for ${app_helper_path}${NC}"
sudo chmod a+rwx "$app_helper_path"
/usr/bin/xattr -cr "$app_helper_path"

echo -e "${GREEN}🔄 Removing old $helper_name files...${NC}"
sudo launchctl unload "/Library/LaunchDaemons/com.binarynights.ForkLiftHelper.plist" 2>/dev/null
sudo /usr/bin/killall -u root -9 "com.binarynights.ForkLiftHelper" 2>/dev/null
sudo /bin/rm "/Library/LaunchDaemons/com.binarynights.ForkLiftHelper.plist" 2>/dev/null
sudo /bin/rm "/Library/PrivilegedHelperTools/com.binarynights.ForkLiftHelper" 2>/dev/null
sudo rm -rf "~/Library/Preferences/com.binarynights.ForkLift.plist" 2>/dev/null
sudo rm -rf "~/Library/Application Support/com.binarynights.ForkLift" 2>/dev/null
sudo /bin/rm "/Library/PrivilegedHelperTools/com.binarynights.ForkLiftHelper" 2>/dev/null

echo -e "${GREEN}🔧 Modifying Info.plist for $app_name...${NC}"
identifier_name="identifier \\\"$helper_name\\\""
requirements_name="$identifier_name"
sudo /usr/libexec/PlistBuddy -c 'Print SMPrivilegedExecutables' "/Applications/$app_name.app/Contents/Info.plist"
sudo /usr/libexec/PlistBuddy -c "Set :SMPrivilegedExecutables:$helper_name \"$requirements_name\"" "/Applications/$app_name.app/Contents/Info.plist"
sudo /usr/libexec/PlistBuddy -c 'Print SMPrivilegedExecutables' "/Applications/$app_name.app/Contents/Info.plist"

##################################################################
# 4. Code Signing
##################################################################

echo -e "${GREEN}🔍 Checking code signature before re-signing${NC}"
sudo codesign -d -r- "$app_helper_path"

echo -e "${GREEN}🔏 Re-signing $app_name and $helper_name...${NC}"
sudo codesign -f -s - --all-architectures --deep "$app_path"
sudo codesign -f -s - --all-architectures --deep "$app_helper_path"

echo -e "${GREEN}🔍 Checking code signature after re-signing${NC}"
sudo codesign -d -r- "$app_helper_path"
99 changes: 99 additions & 0 deletions script/apps/fix_helper_and_inject.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#!/bin/bash

RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m'

##################################################################
# 1. Configuration
##################################################################

current_path=$PWD
mac_patch_helper="$current_path/../tools/mac_patch_helper"
mac_patch_helper_config="$current_path/../tools/patch.json"
SMJobBlessUtil="$current_path/../tools/SMJobBlessUtil-python3.py"

app_name="$1"
helper_name="$2"

echo -e "${GREEN}Helper name: ${helper_name}${NC}"


##################################################################
# 2. Backup
##################################################################

helper_executable_path="/Applications/${app_name}.app/Contents/Library/LaunchServices/${helper_name}"
helper_executable_backup_path="${helper_executable_path}_Backup"
echo -e "${GREEN}Helper executable path: ${helper_executable_path}${NC}"

if [ ! -f "$helper_executable_backup_path" ]; then
cp "$helper_executable_path" "$helper_executable_backup_path"
echo -e "${YELLOW}🔄 Backup created.${NC}"
fi

##################################################################
# 3. Helper Injection
##################################################################
dylib_name="dylib_dobby_hook"
prefix="lib"
insert_dylib="${current_path}/../tools/insert_dylib"

chmod a+x "${insert_dylib}"

BUILT_PRODUCTS_DIR="${current_path}/../release"
app_bundle_framework="/Applications/${app_name}.app/Contents/Frameworks/"
echo -e "${GREEN}App bundle framework directory: ${app_bundle_framework}${NC}"

if [ ! -d "$app_bundle_framework" ]; then
mkdir -p "$app_bundle_framework"
echo -e "${YELLOW}📁 Created framework directory.${NC}"
fi
echo -e "${GREEN}🚀 Injecting dylib into ${helper_executable_path}${NC}"
"${insert_dylib}" --weak --all-yes "${app_bundle_framework}/${prefix}${dylib_name}.dylib" "$helper_executable_backup_path" "$helper_executable_path"

##################################################################
# 4. Patch
##################################################################

echo -e "${GREEN}🔧 Running mac_patch_helper to apply patch...${NC}"
sudo chmod a+x "$mac_patch_helper"
$mac_patch_helper "$app_name" "$mac_patch_helper_config"

app_path="/Applications/${app_name}.app"
app_helper_path="/Applications/${app_name}.app/Contents/Library/LaunchServices/${helper_name}"

echo -e "${YELLOW}Updating permissions for ${app_helper_path}${NC}"
sudo chmod a+rwx "$app_helper_path"
/usr/bin/xattr -cr "$app_helper_path"

echo -e "${GREEN}🔄 Removing old $helper_name files...${NC}"
sudo launchctl unload "/Library/LaunchDaemons/com.binarynights.ForkLiftHelper.plist" 2>/dev/null
sudo /usr/bin/killall -u root -9 "com.binarynights.ForkLiftHelper" 2>/dev/null
sudo /bin/rm "/Library/LaunchDaemons/com.binarynights.ForkLiftHelper.plist" 2>/dev/null
sudo /bin/rm "/Library/PrivilegedHelperTools/com.binarynights.ForkLiftHelper" 2>/dev/null
sudo rm -rf "~/Library/Preferences/com.binarynights.ForkLift.plist" 2>/dev/null
sudo rm -rf "~/Library/Application Support/com.binarynights.ForkLift" 2>/dev/null
sudo /bin/rm "/Library/PrivilegedHelperTools/com.binarynights.ForkLiftHelper" 2>/dev/null

echo -e "${GREEN}🔧 Modifying Info.plist for $app_name...${NC}"
identifier_name="identifier \\\"$helper_name\\\""
requirements_name="$identifier_name"
sudo /usr/libexec/PlistBuddy -c 'Print SMPrivilegedExecutables' "/Applications/$app_name.app/Contents/Info.plist"
sudo /usr/libexec/PlistBuddy -c "Set :SMPrivilegedExecutables:$helper_name \"$requirements_name\"" "/Applications/$app_name.app/Contents/Info.plist"
sudo /usr/libexec/PlistBuddy -c 'Print SMPrivilegedExecutables' "/Applications/$app_name.app/Contents/Info.plist"

##################################################################
# 5. Code Signing
##################################################################

echo -e "${GREEN}🔍 Checking code signature before re-signing${NC}"
sudo codesign -d -r- "$app_helper_path"

echo -e "${GREEN}🔏 Re-signing $app_name and $helper_name...${NC}"
sudo codesign -f -s - --all-architectures --deep "$app_path"
sudo codesign -f -s - --all-architectures --deep "$app_helper_path"

echo -e "${GREEN}🔍 Checking code signature after re-signing${NC}"
sudo codesign -d -r- "$app_helper_path"
15 changes: 8 additions & 7 deletions script/auto_hack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ ALL_APPS_LIST=(
"Navicat Premium|/Applications/Navicat Premium.app/Contents/Frameworks/EE.framework/Versions/A/EE"
"Transmit"
# "AnyGo"
"Proxyman|/Applications/Proxyman.app/Contents/Frameworks/HexFiend.framework/Versions/A/HexFiend"
"AirBuddy|/Applications/AirBuddy.app/Contents/Frameworks/LetsMove.framework/Versions/A/LetsMove"
"Infuse|/Applications/Infuse.app/Contents/Frameworks/Differentiator.framework/Versions/A/Differentiator"
"MacUpdater|/Applications/MacUpdater.app/Contents/Frameworks/Sparkle.framework/Versions/B/Sparkle"
Expand All @@ -30,7 +29,8 @@ ALL_APPS_LIST=(

## fixed with helper
"IDA Professional 9.0|/Applications/IDA Professional 9.0.app/Contents/Frameworks/QtDBus.framework/Versions/5/QtDBus|apps/ida_hack.sh"
"ForkLift|/Applications/ForkLift.app/Contents/Frameworks/UniversalDetector.framework/Versions/A/UniversalDetector|apps/forklift_hack.sh"
"ForkLift|/Applications/ForkLift.app/Contents/Frameworks/UniversalDetector.framework/Versions/A/UniversalDetector|apps/fix_helper_and_inject.sh|com.binarynights.ForkLiftHelper"
"Proxyman|/Applications/Proxyman.app/Contents/Frameworks/HexFiend.framework/Versions/A/HexFiend|apps/fix_helper.sh|com.proxyman.NSProxy.HelperTool"
# "Surge|/Applications/Surge.app/Contents/Frameworks/MMMarkdown.framework/Versions/A/MMMarkdown|apps/surge_hack.sh"
)

Expand Down Expand Up @@ -79,8 +79,9 @@ find_paddle_apps() {

inject_dobby_hook() {
app_name="$1"
app_path="$2"
inject_path="$2"
script_after="$3"
helper_name="$4"
if [ -d "/Applications/${app_name}.app" ]; then
version=$(defaults read "/Applications/${app_name}.app/Contents/Info.plist" CFBundleShortVersionString)
bundle_id=$(defaults read "/Applications/${app_name}.app/Contents/Info.plist" CFBundleIdentifier)
Expand All @@ -92,9 +93,9 @@ inject_dobby_hook() {
fi
if [ "$user_input" = "Y" ] || [ "$user_input" = "y" ]; then
printf "\n${GREEN}🚀 [${app_name}] - dylib_dobby_hook Injection starting...${NC}\n"
bash all_in_one.sh "$app_name" "$app_path"
bash all_in_one.sh "$app_name" "$inject_path"
if [ -n "$script_after" ]; then
bash "$script_after"
bash "$script_after" "$app_name" "$helper_name"
fi
else
printf "${YELLOW}😒 App skipped on user demand.${NC}\n"
Expand All @@ -107,8 +108,8 @@ inject_dobby_hook() {
start() {
find_paddle_apps
for app_entry in "${ALL_APPS_LIST[@]}"; do
IFS="|" read -r app_name app_path script_after <<<"$app_entry"
inject_dobby_hook "$app_name" "$app_path" "$script_after"
IFS="|" read -r app_name inject_path script_after helper_name<<<"$app_entry"
inject_dobby_hook "$app_name" "$inject_path" "$script_after" "$helper_name"
done
}

Expand Down
7 changes: 6 additions & 1 deletion tools/patch.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Surge": {
"patch": {
"//patch": {
"/Applications/Surge.app/Contents/Library/LaunchServices/com.nssurge.surge-mac.helper": {
"x86": {
"55 48 89 E5 41 57 41 56 41 55 41 54 53 48 83 EC 58 48 89 FB 4C 8D 7D C0 49 C7 07 00 00 00 00 48 8B .. .. .. .. .. 48 8B 53 20 48 8B .. .. .. .. .. 4C 8B .. .. .. .. .. 41 FF D6": "6A 01 58 C3"
Expand All @@ -24,6 +24,11 @@
"/Applications/SMJobBlessApp.app/Contents/Library/LaunchServices/com.apple.bsd.SMJobBlessHelper"
]
},
"Proxyman":{
"helper_plist_resign":[
"/Applications/Proxyman.app/Contents/Library/LaunchServices/com.proxyman.NSProxy.HelperTool"
]
},
"IDA":{
"patch":{
"/Applications/IDA Professional 9.0.app/Contents/MacOS/libida.dylib":{
Expand Down

1 comment on commit 82ead81

@marlkiller
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

close: #30

Please sign in to comment.