Quantcast
Channel: Essence Sharing | 干货分享 - iOSRE
Viewing all articles
Browse latest Browse all 301

iOS11上面debugserver+lldb配置。感谢@Ouroboros 大佬的解答

$
0
0

@LuaSaltFish wrote:

iOS11越狱发行半年有余,Cycript这个最好用的运行时刻更新似乎因为神仙打架的原因而不支持iOS11.笔者只能将目光投入到lldb+debugserver。

按照debugserver的配置办法从设备中拷贝debugserver到电脑,除了小黄书提到的4个权限需要额外签名 platform-application 否则会被直接干掉。原本以为就此结束可以开心的用debugserver调试。但是现实中做到这一步确实可以运行debugserver但基本会出现以下问题
debugserver-@(#)PROGRAM:debugserver PROJECT:debugserver-360.0.26.14
for arm64.
Attaching to process Preferences…
error: failed to attach to process named: “” (os/kern) invalid argument
按照@Ouroboros大佬提示的原因,需要使用jailbreak_client提权。

按照大佬给的代码。

#include <spawn.h>

int  main(int argc, char *argv[], char *envp[])
{
    if (argc < 2)
    {
   fprintf(stderr, "usage: %s program args...\n", argv[0]);
       
       return EXIT_FAILURE;
    }
    
    int ret, status;
    pid_t pid;
    posix_spawnattr_t attr;
    
    posix_spawnattr_init(&attr);
    posix_spawnattr_setflags(&attr, POSIX_SPAWN_START_SUSPENDED);
    
    ret = posix_spawnp(&pid, argv[1], NULL, &attr, &argv[1], envp);
    
    posix_spawnattr_destroy(&attr);
    
    if (ret != 0)
    {
        printf("posix_spawnp failed with %d: %s\n", ret, strerror(ret));
        return ret;
    }
    
    char buf[200];
    
    snprintf(buf, sizeof(buf), "/electra/jailbreakd_client %d 1", pid);
    system(buf);
    
    kill(pid, SIGCONT);
    waitpid(pid, &status, 0);
    
    return 0;
}

使用theos的tool模版制作一个小的命令行工具,我这里用的名字是JBDO。make package install 后ssh进入设备


执行命令JBDO debugserver *:1234 -a “Preferences”

提示如下

 debugserver-@(#)PROGRAM:debugserver  PROJECT:debugserver-360.0.26.14
 for arm64.
Attaching to process Preferences...
Listening to port 1234 for a connection from *...
Failed to get connection from a remote gdb process.
Exiting.

还是不行。通过简单搜索,发现debugserver只能绑定iOS设备本地ip。可是lldb for ios同样没有iOS11的版本。只好祭出usbmux


使用python运行tcp tcprelay.py 监听端口:监听端口

新建另一个终端窗口 lldb

process connect connect://localhost:监听端口

挺卡的,即使usb有线也用了数十秒

  Process 2788 stopped
* thread #1: tid = 0xb3313, 0x0000000181bd4bc4 libsystem_kernel.dylib`mach_msg_trap + 8, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x0000000181bd4bc4 libsystem_kernel.dylib`mach_msg_trap + 8
libsystem_kernel.dylib`mach_msg_trap:
->  0x181bd4bc4 <+8>: ret    

libsystem_kernel.dylib`mach_msg_overwrite_trap:
    0x181bd4bc8 <+0>: movn   x16, #0x1f
    0x181bd4bcc <+4>: svc    #0x80
    0x181bd4bd0 <+8>: ret    
(lldb)  

至此,iOS11上面的lldb+debugserver就完成了。感谢群里大佬们的指点。希望能帮到遇到同样问题的坛友。

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 301

Trending Articles