Skip to content

Commit 188e71b

Browse files
committed
修复运行 xcode 的 app 问题
1 parent 16950e9 commit 188e71b

5 files changed

Lines changed: 33 additions & 14 deletions

File tree

README.assets/20241008172148.jpg

-320 KB
Binary file not shown.

README.assets/20241008172148.png

1.26 MB
Loading

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# XcodeAnyDebugRootless
22

3-
![20241008172148](README.assets/20241008172148.jpg)
3+
![20241008172148](README.assets/20241008172148.png)
44

55
## 简介
66

@@ -12,6 +12,7 @@
1212
- 完全兼容 Dopamine 越狱环境
1313
- 采用无根设计,安全可靠
1414
- 无需配置直接使用
15+
- 不影响正常的 Xcode 安装调试 App
1516

1617
## 安装
1718

Tweak.x

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,47 @@
1-
#import <Foundation/Foundation.h>
21
#include <dlfcn.h>
2+
#include <time.h>
3+
#import <Foundation/Foundation.h>
34

45
static void* _SMJobSubmit;
6+
static int last_inst_time = 0;
7+
static void nouse(){}
8+
static void* _CFPropertyListCreateData = (void*)nouse;
9+
10+
%hookf(CFDataRef, _CFPropertyListCreateData, CFAllocatorRef allocator, CFPropertyListRef propertyList, CFPropertyListFormat format, CFOptionFlags options, CFErrorRef* error) {
11+
if (CFGetTypeID(propertyList) == CFDictionaryGetTypeID()) {
12+
NSDictionary* info = (__bridge NSDictionary*)propertyList;
13+
if (info[@"Service"] != nil && [info[@"Service"] isEqualToString:@"com.apple.mobile.installation_proxy"]) {
14+
last_inst_time = time(0);
15+
}
16+
NSLog(@"_SMJobSubmit => _CFPropertyListCreateData info: %@", info);
17+
}
18+
return %orig;
19+
}
520

621
%hookf(Boolean, _SMJobSubmit, CFStringRef domain, CFDictionaryRef job, CFTypeID auth, CFErrorRef *outError)
722
{
823
NSMutableDictionary* mjob = [(__bridge NSDictionary*)job mutableCopy];
924
if (job != nil && mjob[@"ProgramArguments"] != nil)
1025
{
1126
NSArray* argv = mjob[@"ProgramArguments"];
12-
1327
NSLog(@"_SMJobSubmit argv=%@", argv);
1428

15-
if ([argv[0] hasSuffix:@"/debugserver"])
16-
{
17-
NSMutableArray* new_argv = [argv mutableCopy];
18-
19-
new_argv[0] = @"/var/jb/usr/bin/debugserver_xcode";
29+
NSString *path = argv.firstObject;
30+
NSLog(@"_SMJobSubmit path=%@", path);
2031

21-
mjob[@"UserName"] = @"root";
22-
mjob[@"ProgramArguments"] = new_argv;
23-
}
24-
25-
job = (__bridge_retained CFDictionaryRef)mjob;
32+
if (time(0) - last_inst_time > 3) // 防止影响Xcode安装调试普通App
33+
{
34+
if ([path hasSuffix:@"/debugserver"])
35+
{
36+
NSMutableArray* new_argv = [argv mutableCopy];
37+
new_argv[0] = @"/var/jb/usr/bin/debugserver_xcode";
38+
mjob[@"UserName"] = @"root";
39+
mjob[@"ProgramArguments"] = new_argv;
40+
job = (__bridge_retained CFDictionaryRef)mjob;
41+
}
42+
}
2643
}
44+
2745
return %orig;
2846
}
2947

control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: com.yourcompany.xcodeanydebugrootless
22
Name: XcodeAnyDebugRootless
3-
Version: 0.0.1
3+
Version: 0.1.0
44
Architecture: iphoneos-arm
55
Description: debug any process with xcode (jailbroken required)
66
Maintainer: Harlans

0 commit comments

Comments
 (0)