【问题标题】:Compile a command line script for iOS为 iOS 编译一个命令行脚本
【发布时间】:2016-07-18 18:10:30
【问题描述】:

我为 iOS 编写了一个 iOKit 模糊器。代码如下:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mach/mach.h>
#include <mach/vm_map.h>
#include <IOKit/IOKitLib.h>

int main()
{
  io_service_t service = IOServiceGetMatching(kIOMasterPortDefault, IOserviceMatching("IOUSBHIDDriver")); // change service each time
  if(!service)
  {
    return -1;
  }
  io_connect_t connect;
  kern_return_t kr = IOServiceOpen(service, mach_task_self(), 0, &connect);
  if(kr != kIOReturnSuccess)
  {
    return -1;
  }

  uint32_t selector =3;
  uint64_t input[0];
        input[0] = 0x44444444444;
  IOConnectCallMethod(connect, selector, input, 1, 0, 0, NULL, NULL, NULL, NULL);
  printf("Did it crash? No? Do it again! -Toxic\n");
}

我已经尝试用 GCC 编译它一段时间了,但我得到了各种各样的错误。我想知道是否有人确切知道如何为 iOS 编译命令行工具。谢谢。

【问题讨论】:

    标签: ios command jailbreak iokit fuzzer


    【解决方案1】:

    据我所知,没有用于(非越狱)iOS 的命令行工具,尽管您可以使用应用程序中的 NSLog 输出到日志。此外,Apple 的 iOS 工具链使用 clang (llvm),尽管“gcc”命令通常别名为 clang。获取脚本最简单的方法是在 Xcode 中创建一个测试项目,构建它并查看构建日志。这会向您显示使用哪些参数运行的所有命令。

    【讨论】:

    • 啊,对不起。在那里帮不了你,虽然我怀疑你仍然可以通过检查 Xcode 的构建步骤来完成大部分工作。
    【解决方案2】:

    我知道您是否找到了解决方案,但无论如何。 如果要在设备类型上使用 clang 进行编译: clang -framework IOKit your_app.c -isysroot /var/theos/sdks/iPhoneos_whatever_sdk_you_have -o output

    这应该可以编译。 在没有 isysroot 和 /var 的 mac 上同样...

    如果您在 xcode 中尝试,请确保驱动程序可以在沙箱内运行并包含 iokit 标头

    :D

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-10-27
      • 1970-01-01
      • 1970-01-01
      • 2016-05-22
      • 2017-12-16
      • 2013-10-12
      • 1970-01-01
      相关资源
      最近更新 更多