gpt4 book ai didi

ios - iOS 中的私有(private)唯一设备标识符

转载 作者:IT王子 更新时间:2023-10-29 07:47:36 34 4
gpt4 key购买 nike

我们正在与我的同事一起开展一个项目,其中涉及使用大量私有(private)和非官方代码。这旨在供 AppStore 使用。

我们的第一个也是唯一的要求是使用越狱。

首先,UDIDOpenUDID 或任何其他解决方案在这里不起作用,而且它们也不应该起作用。

我们做了很多背景研究和测试,首先是尝试获取 IMEI , ICCID, IMSI和序列号以编程方式。如果没有越狱,上述方法均不适用于 iOS 7 及更高版本。

我们还花了几个 来使用著名的IOKitBrowser 来使用IOKit 框架。并转储 iOS 内部的全部内容。不幸的是,we discoverediOS 8.3 中它停止工作了。

我们在这里讨论的不是获取 UDID 或任何其他“主流”的东西,而是一般来说我们需要一种方法来获取

any permanent hardware identifier unique enough to identify a device that would persist in spite of device wipes and amongst different iOS versions

这个问题与其他问题没有重复(例如 no solutions are found here)并且仅针对私有(private) API

如有任何帮助,我们将不胜感激。

最佳答案

我很遗憾地说,显然从 iOS 8.3 开始,要获得任何唯一标识符,您需要比普通用户更高的访问级别。

在不利用任何东西的情况下,仅使用私有(private)框架、库和内核请求,任何对唯一标识符的请求都会返回 null。

说明:

尝试使用 IOKit:

void *IOKit = dlopen("/System/Library/Frameworks/IOKit.framework/IOKit", RTLD_NOW);
if (IOKit)
{
mach_port_t *kIOMasterPortDefault = dlsym(IOKit, "kIOMasterPortDefault");
CFMutableDictionaryRef (*IOServiceMatching)(const char *name) = dlsym(IOKit, "IOServiceMatching");
mach_port_t (*IOServiceGetMatchingService)(mach_port_t masterPort, CFDictionaryRef matching) = dlsym(IOKit, "IOServiceGetMatchingService");
CFTypeRef (*IORegistryEntryCreateCFProperty)(mach_port_t entry, CFStringRef key, CFAllocatorRef allocator, uint32_t options) = dlsym(IOKit, "IORegistryEntryCreateCFProperty");
kern_return_t (*IOObjectRelease)(mach_port_t object) = dlsym(IOKit, "IOObjectRelease");

if (kIOMasterPortDefault && IOServiceGetMatchingService && IORegistryEntryCreateCFProperty && IOObjectRelease)
{
mach_port_t platformExpertDevice = IOServiceGetMatchingService(*kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"));
if (platformExpertDevice)
{
CFTypeRef platformSerialNumber = IORegistryEntryCreateCFProperty(platformExpertDevice, CFSTR("IOPlatformSerialNumber"), kCFAllocatorDefault, 0);
if (platformSerialNumber && CFGetTypeID(platformSerialNumber) == CFStringGetTypeID())
{
serialNumber = [NSString stringWithString:(__bridge NSString *)platformSerialNumber];
CFRelease(platformSerialNumber);
}
IOObjectRelease(platformExpertDevice);
}
}
dlclose(IOKit);
}

失败。原因:IOPlatformSerialNumber 不可访问。许多其他请求工作正常。

尝试使用 Mach 调用获取网络适配器硬件 ID:

int         mib[6], len;
char *buf;
unsigned char *ptr;
struct if_msghdr *ifm;
struct sockaddr_dl *sdl;

mib[0] = CTL_NET;
mib[1] = AF_ROUTE;
mib[2] = 0;
mib[3] = AF_LINK;
mib[4] = NET_RT_IFLIST;
if ((mib[5] = if_nametoindex("en0")) == 0) {
perror("if_nametoindex error");
exit(2);
}

if (sysctl(mib, 6, NULL, &len, NULL, 0) < 0) {
perror("sysctl 1 error");
exit(3);
}

if ((buf = malloc(len)) == NULL) {
perror("malloc error");
exit(4);
}

if (sysctl(mib, 6, buf, &len, NULL, 0) < 0) {
perror("sysctl 2 error");
exit(5);
}

ifm = (struct if_msghdr *)buf;
sdl = (struct sockaddr_dl *)(ifm + 1);
ptr = (unsigned char *)LLADDR(sdl);
printf("%02x:%02x:%02x:%02x:%02x:%02x\n", *ptr, *(ptr+1), *(ptr+2),
*(ptr+3), *(ptr+4), *(ptr+5));

失败。原因:为任何网络适配器返回 02:00:00:00:00:00

尝试连接到 lockdownd:

void *libHandle = dlopen("/usr/lib/liblockdown.dylib", RTLD_LAZY);
if (libHandle)
{
lockdown_connect = dlsym(libHandle, "lockdown_connect");
lockdown_copy_value = dlsym(libHandle, "lockdown_copy_value");

id connection = lockdown_connect();
NSString *kLockdownDeviceColorKey
NSString *color = lockdown_copy_value(connection, nil, kLockdownDeviceColorKey);
NSLog(@"color = %@", color);
lockdown_disconnect(connection);

dlclose(libHandle);
}
else {
printf("[%s] Unable to open liblockdown.dylib: %s\n",
__FILE__, dlerror());
}

失败。原因:lockdown_connect() 失败,返回 null

尝试使用 libMobileGestalt:

void *libHandle = dlopen("/usr/lib/libMobileGestalt.dylib", RTLD_LAZY);
if (libHandle)
{
MGCopyAnswer = dlsym(libHandle, "MGCopyAnswer");

NSString* value = MGCopyAnswer(CFSTR("SerialNumber"));
NSLog(@"Value: %@", value);
CFRelease(value);
}

失败。原因:对唯一标识符的请求返回 null。任何其他请求都可以正常工作。

我的建议是使用一些特权升级技术来获得 super 用户访问权限,然后运行此处列出的任何方法来获取该属性。

此外,扩展对 liblockdown 的研究。如果它可以在用户级别访问(使用 lockdown_connect 以外的东西),则可能会读取这些内容。

关于ios - iOS 中的私有(private)唯一设备标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29760472/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com