关于sbutils中的sblaunch插件的疑惑

一、sbutils介绍

  sbutils是一个开源的越狱手机基础功能的插件包,其中包含sblaunch这个启动插件,该插件可以实现命令行下面打开app并传递一个url。

  sbutils下载地址:http://cydia.ppios.com/2013/06/sbutils-v1-0-2-1.html

  sbutils的开源代码:https://github.com/innoying/iOS-sbutils

二、sblaunch的开源代码

  

 1 #include <CoreFoundation/CoreFoundation.h>
 2 #include <stdbool.h>
 3 #define SBSApplicationLaunchUnlockDevice 4
 4 #define SBSApplicationDebugOnNextLaunch_plus_SBSApplicationLaunchWaitForDebugger 0x402
 5
 6 bool SBSProcessIDForDisplayIdentifier(CFStringRef id, pid_t *pid);
 7 int SBSLaunchApplicationWithIdentifier(CFStringRef id, char flags);
 8 int SBSLaunchApplicationForDebugging(CFStringRef bundleID, CFURLRef openURL, CFArrayRef arguments, CFDictionaryRef environment, CFStringRef stdout, CFStringRef stderr, char flags);
 9
10 int main(int argc, char **argv) {
11     bool p = false;
12     const char *url = NULL;
13     const char *bundle;
14     int flags = SBSApplicationLaunchUnlockDevice;
15
16     int c;
17     while((c = getopt(argc, argv, "pdbu:")) != -1)
18     switch(c) {
19         case ‘p‘: p = true; break;
20         case ‘d‘: flags |= SBSApplicationDebugOnNextLaunch_plus_SBSApplicationLaunchWaitForDebugger; break;
21         case ‘b‘: flags |= 1; break;
22         case ‘u‘: url = optarg; break;
23         default: goto usage;
24     }
25     if(optind == argc) goto usage;
26     bundle = argv[optind];
27
28     CFMutableArrayRef arguments = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
29     while(++optind != argc) CFArrayAppendValue(arguments, CFStringCreateWithCString(NULL, argv[optind], kCFStringEncodingUTF8));
30
31
32     CFStringRef cs = CFStringCreateWithCString(NULL, bundle, kCFStringEncodingUTF8);
33     CFURLRef cu = url ? CFURLCreateWithBytes(NULL, (UInt8*)url, strlen(url), kCFStringEncodingUTF8, NULL) : NULL;
34     if(url && !cu) {
35         fprintf(stderr, "invalid URL\n");
36         return 1;
37     }
38     int err;
39     if((err = SBSLaunchApplicationForDebugging(cs, cu, arguments, NULL, NULL, NULL, flags))) {
40         fprintf(stderr, "SBSLaunchApplicationWithIdentifier failed: %d\n", err);
41         return 1;
42     }
43     if(p) {
44         pid_t pid;
45         while(!SBSProcessIDForDisplayIdentifier(cs, &pid)) {
46             usleep(50000);
47         }
48         printf("%d\n", (int) pid);
49     }
50     return 0;
51
52     usage:
53     fprintf(stderr, "Usage: sblaunch [-p] [-d] [-b] [-u url] <bundle> [arguments...]\n"
54                     "  -p: print pid\n"
55                     "  -d: launch for debugging\n"
56                     "  -b: launch in background\n"
57                     );
58     return 1;
59 }

其中着色的函数是关键函数,找了好多资料没有发现这个函数的出处,没有资料显示这里的标准参数是什么。

仿照这个函数的用法,自己写了一段代码,发现同样调用中是可以打开一个app的,但是传递的url无论怎么传递都没有效果。

添加签名:

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.springboard.launchapplications</key> <true/> </dict> </plist> 

遂怀疑是参数的问题,用IDA反编译sblaunch,得到以下的C代码

  1 int __cdecl main(int argc, const char **argv, const char **envp)
  2 {
  3   const char **v3; // [email protected]
  4   signed int v4; // [email protected]
  5   int v5; // [email protected]
  6   int v6; // [email protected]
  7   int v7; // [email protected]
  8   int i; // [email protected]
  9   int v9; // [email protected]
 10   int v10; // [email protected]
 11   size_t v11; // [email protected]
 12   FILE **v12; // [email protected]
 13   const void *v13; // [email protected]
 14   int v14; // [email protected]
 15   int v15; // [email protected]
 16   FILE *v16; // [email protected]
 17   const char *v18; // [sp+Ch] [bp-2Ch]@14
 18   int v19; // [sp+10h] [bp-28h]@14
 19   char v20; // [sp+14h] [bp-24h]@1
 20   const char *v21; // [sp+18h] [bp-20h]@1
 21   int v22; // [sp+1Ch] [bp-1Ch]@22
 22
 23   v3 = argv;
 24   v4 = 4;
 25   v20 = 0;
 26   v21 = 0;
 27   v5 = argc;
 28   while ( 1 )
 29   {
 30     v6 = getopt(v5, (char *const *)v3, "pdbu:");
 31     if ( v6 <= 97 )
 32       break;
 33     if ( v6 > 111 )
 34     {
 35       if ( v6 == 112 )
 36       {
 37         v20 = 1;
 38       }
 39       else
 40       {
 41         if ( v6 != 117 )
 42           goto LABEL_25;
 43         v21 = optarg;
 44       }
 45     }
 46     else if ( v6 == 98 )
 47     {
 48       v4 |= 1u;
 49     }
 50     else
 51     {
 52       if ( v6 != 100 )
 53         goto LABEL_25;
 54       v4 |= 0x402u;
 55     }
 56   }
 57   if ( v6 != -1 || optind == v5 )
 58   {
 59 LABEL_25:
 60     v11 = 134;
 61     v12 = (FILE **)&__stderrp;
 62     v13 = "Usage: sblaunch [-p] [-d] [-b] [-u url] <bundle> [arguments...]\n  -p: print pid\n  -d: launch for debugging\n  -b: launch in background\n";
 63     goto LABEL_26;
 64   }
 65   v18 = v3[optind];
 66   v19 = 0;
 67   v7 = CFArrayCreateMutable(0);
 68   ++optind;
 69   for ( i = optind; i != v5; optind = i )
 70   {
 71     v9 = CFStringCreateWithCString(0, v3[i], 134217984);
 72     CFArrayAppendValue(v7, v9);
 73     i = optind + 1;
 74   }
 75   v10 = CFStringCreateWithCString(0, v18, 134217984);
 76   if ( v21 )
 77   {
 78     strlen(v21);
 79     v19 = CFURLCreateWithBytes(0);
 80     if ( !v19 )
 81     {
 82       v11 = 12;
 83       v12 = (FILE **)&__stderrp;
 84       v13 = "invalid URL\n";
 85 LABEL_26:
 86       v16 = *v12;
 87       v14 = 1;
 88       fwrite(v13, 1u, v11, v16);
 89       return v14;
 90     }
 91   }
 92   v14 = 0;
 93   v15 = SBSLaunchApplicationForDebugging(v10, v19, v7, 0);
 94   if ( v15 )
 95   {
 96     fprintf(__stderrp, "SBSLaunchApplicationWithIdentifier failed: %d\n", v15);
 97     v14 = 1;
 98   }
 99   else if ( v20 )
100   {
101     while ( !SBSProcessIDForDisplayIdentifier(v10, &v22) )
102       usleep(0xC350u);
103     v14 = 0;
104     printf("%d\n", v22);
105   }
106   return v14;
107 }

显示是4个参数,这个函数是位于以下目录中文件中

可是在越狱的手机中找了很久也找不到这个文件,不知道这个库的文件在哪里?

时间: 2024-08-07 00:12:51

关于sbutils中的sblaunch插件的疑惑的相关文章

Notepad++中常用的插件【转】

转自:http://www.crifan.com/files/doc/docbook/rec_soft_npp/release/htmls/npp_common_plugins.html 1.4. Notepad++中常用的插件 1.4.1. 插件管理器: Plugin Manager 插件功能:此插件可以帮你管理插件,包括查看当前已经安装的插件有哪些,以及自动帮你下载相应的插件. 插件用途:主要用于管理(安装和卸载)插件 插件安装:在安装过程中,默认已选择安装此插件:图 2.2 “Notepa

在Eclipse mars 4.5.2 中安装spring 插件 spring tool suite

最近在学习spring,用到的IDE 有eclipse,也有用到 IDEA. 目前对spring还不是很了解,跟着网上的视频来,先学会了spring,然后再选IDE. 题归正转,下面说说怎么在Eclipse mars 4.5.2 中安装spring 插件 spring tool suite. 打开eclipse,然后在菜单栏中点击Help,选中Eclipse MarketPlace: 然后搜索STS(也就是spring tool suite的缩写),回车: 点击Install即可 由于是在线安装

在vs code中使用ftp-sync插件实现客户端与服务器端代码的同步

在vs code中使用ftp-sync插件实现客户端与服务器端代码的同步 下载安装 vscode-ftp-sync 插件. 安装方法1. Ctrl+Shift+P 输入 ext install [插件关键字/名称] 安装方法2. Ctrl+Shift+P (或F1) 输入 Extensions, 选中 Install Extension然后输入插件名称/关键字 若安装不在插件商店的插件, 则可以放置到用户目录下的 .vscode/extensions 文件夹中.然后重启 VS Code 即可生效

Android中Parcelable的插件使用

在Android开发的过程中,针对对象的序列化推荐使用Parcelable,而不是Seralizable,因为Parceable的效率比较高. 这样,针对Android中大量的对象,手写实现Parcelable的代价,就比较高了.楼主github上发现一个针对Intelij和AndroidStudio的Parcelable的插件,只需集成,然后直接快捷键,实现Parcelable的接口,这样不是很爽么?... 1. Parcelable插件地址:https://github.com/mcharm

总结eclipse中安装maven插件

当自己越来越多的接触到开源项目时,发现大多数的开源项目都是用maven来够建的.并且在开发应用时,也越来越意识到maven的确会解决很多问题,如果你要了解maven,可以参考:Maven入门指南(一)和 Maven入门指南(二).所以自己也学着使用maven.以下均参考的互联网上的内容,有的做了一些小的修改,并注明了出处. 第一部分:原文链接 maven3 安装: 安装 Maven 之前要求先确定你的 JDK 已经安装配置完成.Maven是 Apache 下的一个项目,目前最新版本是 3.0.4

Vim 中文件目录浏览插件——NERD tree

说明 :vim的插件NERDTree用于使得vim窗口分左右窗口显示的用法说明.其中,左侧为目录的树形界面,简称为NERDTree界面,右则为vim界面. 一.配置步骤 下载地址: http://www.vim.org/scripts/script.php?script_id=1658 或者 http://download.csdn.net/detail/caoyingsdhzcx/5752889 树形目录插件NERDTree的安装方法,如下: 1. 在当前用户文件夹(例如simpman)下,建

eclipse中安装tomcat插件

一.软件下载 Eclipse3.6 IDE for Java EE Developers: 下载地址:http://eclipse.org/downloads/ Tomcat Eclipse Plugin, 下载地址:http://www.eclipsetotale.com/tomcatPlugin.html 二.软件安装和配置(图文) 1.解压Eclipse到某个目录,例如/usr/local/eclipse 即可. 2. 解压Tomcat 插件到eclipse目录下的plugins目录中.

unity中使用FingerGestures插件3.0

FingerGestures是一个unity3D插件,用来处理用户动作,手势. 译自FingerGestures官方文档 目录 FingerGestures包结构 FingerGestures例子列表 设置场景 教程:识别一个轻敲手势 教程:手势识别器 教程:轻击手势识别器 教程:拖拽手势识别器 教程:滑动手势识别器 教程:长按手势识别器 教程:缩放手势识别器 教程:旋转手势识别器 教程:自定义手势识别器 教程:识别手势事件 建议:使用.net代理事件 fingerGestures包结构 路径,

atitit.MyEclipse10 中增加svn插件故障排除

atitit.MyEclipse10 中增加svn插件故障排除 删除\configuration \org.eclipse.update 不行... 二. 在configuration下的config.ini文件中org.eclipse.update.reconcile=false改为org.eclipse.update.reconcile=true 为了启动速度, 在插件加载成功后,可以再把它还原成false 韩式不行.... 查看bundles.info,黑头subversion 一瓦韩式c