├── .gitignore ├── Makefile ├── control └── main.mm /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | _ 3 | IOKit 4 | theos 5 | .theos 6 | obj 7 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | include theos/makefiles/common.mk 2 | 3 | TOOL_NAME = ECID 4 | ECID_FILES = main.mm 5 | ECID_FRAMEWORKS = IOKit Foundation UIKit 6 | ECID_LDFLAGS = -llockdown 7 | 8 | include $(THEOS_MAKE_PATH)/tool.mk 9 | -------------------------------------------------------------------------------- /control: -------------------------------------------------------------------------------- 1 | Package: com.innoying.ecid 2 | Name: ECID 3 | Depends: 4 | Version: 1.0.0 5 | Architecture: iphoneos-arm 6 | Description: A simple tool to print out the devices ecid. 7 | Maintainer: innoying 8 | Author: innoying 9 | Section: System 10 | Tag: role::Developer 11 | -------------------------------------------------------------------------------- /main.mm: -------------------------------------------------------------------------------- 1 | #include "IOKit/IOKitLib.h" 2 | 3 | int main(int argc, char *argv[]) { 4 | if (CFMutableDictionaryRef dict = IOServiceMatching("IOPlatformExpertDevice")) { 5 | if (io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, dict)) { 6 | if (CFTypeRef ecid = IORegistryEntrySearchCFProperty(service, kIODeviceTreePlane, CFSTR("unique-chip-id"), kCFAllocatorDefault, kIORegistryIterateRecursively)) { 7 | NSData *data((NSData *) ecid); 8 | size_t length([data length]); 9 | uint8_t bytes[length]; 10 | [data getBytes:bytes]; 11 | char string[length * 2 + 1]; 12 | for (size_t i(0); i != length; ++i) 13 | sprintf(string + i * 2, "%.2X", bytes[length - i - 1]); 14 | printf("%s", string); 15 | CFRelease(ecid); 16 | } 17 | IOObjectRelease(service); 18 | } 19 | } 20 | return 0; 21 | } 22 | --------------------------------------------------------------------------------