├── .gitignore ├── Podfile ├── Podfile.lock ├── SimServeriOS.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── zhuowei.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── SimServeriOS.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── SimServeriOS ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── DataConversion.h ├── DataConversion.m ├── Info.plist ├── SceneDelegate.h ├── SceneDelegate.m ├── SimServeriOS.entitlements ├── SimServeriOS_real.entitlements ├── ViewController.h ├── ViewController.m └── main.m └── codesign_wrap.sh /.gitignore: -------------------------------------------------------------------------------- 1 | Pods/ 2 | xcuserdata 3 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | target 'SimServeriOS' do 5 | # Comment the next line if you don't want to use dynamic frameworks 6 | # use_frameworks! 7 | 8 | # Pods for SimServeriOS 9 | pod "GCDWebServer", "~> 3.0" 10 | end 11 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - GCDWebServer (3.5.4): 3 | - GCDWebServer/Core (= 3.5.4) 4 | - GCDWebServer/Core (3.5.4) 5 | 6 | DEPENDENCIES: 7 | - GCDWebServer (~> 3.0) 8 | 9 | SPEC REPOS: 10 | trunk: 11 | - GCDWebServer 12 | 13 | SPEC CHECKSUMS: 14 | GCDWebServer: 2c156a56c8226e2d5c0c3f208a3621ccffbe3ce4 15 | 16 | PODFILE CHECKSUM: c97f2cdd60ca3960c2f13412cf633cd79fcce934 17 | 18 | COCOAPODS: 1.11.3 19 | -------------------------------------------------------------------------------- /SimServeriOS.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 56; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 75DD0323661691A2B70891CA /* libPods-SimServeriOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A9B7BA8E2CAACBCF46A5B310 /* libPods-SimServeriOS.a */; }; 11 | C5AB33142873DE5900A6640B /* DataConversion.m in Sources */ = {isa = PBXBuildFile; fileRef = C5AB33122873DE5800A6640B /* DataConversion.m */; }; 12 | C5F80BC0287286FB00795B28 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C5F80BBF287286FB00795B28 /* AppDelegate.m */; }; 13 | C5F80BC3287286FB00795B28 /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C5F80BC2287286FB00795B28 /* SceneDelegate.m */; }; 14 | C5F80BC6287286FB00795B28 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C5F80BC5287286FB00795B28 /* ViewController.m */; }; 15 | C5F80BC9287286FB00795B28 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C5F80BC7287286FB00795B28 /* Main.storyboard */; }; 16 | C5F80BCB287286FE00795B28 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C5F80BCA287286FE00795B28 /* Assets.xcassets */; }; 17 | C5F80BCE287286FE00795B28 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C5F80BCC287286FE00795B28 /* LaunchScreen.storyboard */; }; 18 | C5F80BD1287286FE00795B28 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C5F80BD0287286FE00795B28 /* main.m */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXFileReference section */ 22 | 8FB37E5AC21BDCDF5E0590AC /* Pods-SimServeriOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SimServeriOS.debug.xcconfig"; path = "Target Support Files/Pods-SimServeriOS/Pods-SimServeriOS.debug.xcconfig"; sourceTree = ""; }; 23 | A9B7BA8E2CAACBCF46A5B310 /* libPods-SimServeriOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SimServeriOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | C5AB33122873DE5800A6640B /* DataConversion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DataConversion.m; sourceTree = ""; }; 25 | C5AB33132873DE5800A6640B /* DataConversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataConversion.h; sourceTree = ""; }; 26 | C5F80BBB287286FB00795B28 /* SimServeriOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SimServeriOS.app; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | C5F80BBE287286FB00795B28 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 28 | C5F80BBF287286FB00795B28 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 29 | C5F80BC1287286FB00795B28 /* SceneDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SceneDelegate.h; sourceTree = ""; }; 30 | C5F80BC2287286FB00795B28 /* SceneDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SceneDelegate.m; sourceTree = ""; }; 31 | C5F80BC4287286FB00795B28 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 32 | C5F80BC5287286FB00795B28 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 33 | C5F80BC8287286FB00795B28 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 34 | C5F80BCA287286FE00795B28 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 35 | C5F80BCD287286FE00795B28 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 36 | C5F80BCF287286FE00795B28 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 37 | C5F80BD0287286FE00795B28 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 38 | C5F80BD72872895300795B28 /* SimServeriOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SimServeriOS.entitlements; sourceTree = ""; }; 39 | EBE52041D50C1C449A0670FC /* Pods-SimServeriOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SimServeriOS.release.xcconfig"; path = "Target Support Files/Pods-SimServeriOS/Pods-SimServeriOS.release.xcconfig"; sourceTree = ""; }; 40 | /* End PBXFileReference section */ 41 | 42 | /* Begin PBXFrameworksBuildPhase section */ 43 | C5F80BB8287286FB00795B28 /* Frameworks */ = { 44 | isa = PBXFrameworksBuildPhase; 45 | buildActionMask = 2147483647; 46 | files = ( 47 | 75DD0323661691A2B70891CA /* libPods-SimServeriOS.a in Frameworks */, 48 | ); 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | /* End PBXFrameworksBuildPhase section */ 52 | 53 | /* Begin PBXGroup section */ 54 | 53BC25596D5EC27DDC09217F /* Pods */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | 8FB37E5AC21BDCDF5E0590AC /* Pods-SimServeriOS.debug.xcconfig */, 58 | EBE52041D50C1C449A0670FC /* Pods-SimServeriOS.release.xcconfig */, 59 | ); 60 | path = Pods; 61 | sourceTree = ""; 62 | }; 63 | BA7AAC2E88F71AFDDE934E72 /* Frameworks */ = { 64 | isa = PBXGroup; 65 | children = ( 66 | A9B7BA8E2CAACBCF46A5B310 /* libPods-SimServeriOS.a */, 67 | ); 68 | name = Frameworks; 69 | sourceTree = ""; 70 | }; 71 | C5F80BB2287286FB00795B28 = { 72 | isa = PBXGroup; 73 | children = ( 74 | C5F80BBD287286FB00795B28 /* SimServeriOS */, 75 | C5F80BBC287286FB00795B28 /* Products */, 76 | 53BC25596D5EC27DDC09217F /* Pods */, 77 | BA7AAC2E88F71AFDDE934E72 /* Frameworks */, 78 | ); 79 | sourceTree = ""; 80 | }; 81 | C5F80BBC287286FB00795B28 /* Products */ = { 82 | isa = PBXGroup; 83 | children = ( 84 | C5F80BBB287286FB00795B28 /* SimServeriOS.app */, 85 | ); 86 | name = Products; 87 | sourceTree = ""; 88 | }; 89 | C5F80BBD287286FB00795B28 /* SimServeriOS */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | C5AB33132873DE5800A6640B /* DataConversion.h */, 93 | C5AB33122873DE5800A6640B /* DataConversion.m */, 94 | C5F80BD72872895300795B28 /* SimServeriOS.entitlements */, 95 | C5F80BBE287286FB00795B28 /* AppDelegate.h */, 96 | C5F80BBF287286FB00795B28 /* AppDelegate.m */, 97 | C5F80BC1287286FB00795B28 /* SceneDelegate.h */, 98 | C5F80BC2287286FB00795B28 /* SceneDelegate.m */, 99 | C5F80BC4287286FB00795B28 /* ViewController.h */, 100 | C5F80BC5287286FB00795B28 /* ViewController.m */, 101 | C5F80BC7287286FB00795B28 /* Main.storyboard */, 102 | C5F80BCA287286FE00795B28 /* Assets.xcassets */, 103 | C5F80BCC287286FE00795B28 /* LaunchScreen.storyboard */, 104 | C5F80BCF287286FE00795B28 /* Info.plist */, 105 | C5F80BD0287286FE00795B28 /* main.m */, 106 | ); 107 | path = SimServeriOS; 108 | sourceTree = ""; 109 | }; 110 | /* End PBXGroup section */ 111 | 112 | /* Begin PBXNativeTarget section */ 113 | C5F80BBA287286FB00795B28 /* SimServeriOS */ = { 114 | isa = PBXNativeTarget; 115 | buildConfigurationList = C5F80BD4287286FE00795B28 /* Build configuration list for PBXNativeTarget "SimServeriOS" */; 116 | buildPhases = ( 117 | D42778C535E83E4D689206A0 /* [CP] Check Pods Manifest.lock */, 118 | C5F80BB7287286FB00795B28 /* Sources */, 119 | C5F80BB8287286FB00795B28 /* Frameworks */, 120 | C5F80BB9287286FB00795B28 /* Resources */, 121 | ); 122 | buildRules = ( 123 | ); 124 | dependencies = ( 125 | ); 126 | name = SimServeriOS; 127 | productName = SimServeriOS; 128 | productReference = C5F80BBB287286FB00795B28 /* SimServeriOS.app */; 129 | productType = "com.apple.product-type.application"; 130 | }; 131 | /* End PBXNativeTarget section */ 132 | 133 | /* Begin PBXProject section */ 134 | C5F80BB3287286FB00795B28 /* Project object */ = { 135 | isa = PBXProject; 136 | attributes = { 137 | BuildIndependentTargetsInParallel = 1; 138 | LastUpgradeCheck = 1400; 139 | TargetAttributes = { 140 | C5F80BBA287286FB00795B28 = { 141 | CreatedOnToolsVersion = 14.0; 142 | }; 143 | }; 144 | }; 145 | buildConfigurationList = C5F80BB6287286FB00795B28 /* Build configuration list for PBXProject "SimServeriOS" */; 146 | compatibilityVersion = "Xcode 14.0"; 147 | developmentRegion = en; 148 | hasScannedForEncodings = 0; 149 | knownRegions = ( 150 | en, 151 | Base, 152 | ); 153 | mainGroup = C5F80BB2287286FB00795B28; 154 | productRefGroup = C5F80BBC287286FB00795B28 /* Products */; 155 | projectDirPath = ""; 156 | projectRoot = ""; 157 | targets = ( 158 | C5F80BBA287286FB00795B28 /* SimServeriOS */, 159 | ); 160 | }; 161 | /* End PBXProject section */ 162 | 163 | /* Begin PBXResourcesBuildPhase section */ 164 | C5F80BB9287286FB00795B28 /* Resources */ = { 165 | isa = PBXResourcesBuildPhase; 166 | buildActionMask = 2147483647; 167 | files = ( 168 | C5F80BCE287286FE00795B28 /* LaunchScreen.storyboard in Resources */, 169 | C5F80BCB287286FE00795B28 /* Assets.xcassets in Resources */, 170 | C5F80BC9287286FB00795B28 /* Main.storyboard in Resources */, 171 | ); 172 | runOnlyForDeploymentPostprocessing = 0; 173 | }; 174 | /* End PBXResourcesBuildPhase section */ 175 | 176 | /* Begin PBXShellScriptBuildPhase section */ 177 | D42778C535E83E4D689206A0 /* [CP] Check Pods Manifest.lock */ = { 178 | isa = PBXShellScriptBuildPhase; 179 | buildActionMask = 2147483647; 180 | files = ( 181 | ); 182 | inputFileListPaths = ( 183 | ); 184 | inputPaths = ( 185 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 186 | "${PODS_ROOT}/Manifest.lock", 187 | ); 188 | name = "[CP] Check Pods Manifest.lock"; 189 | outputFileListPaths = ( 190 | ); 191 | outputPaths = ( 192 | "$(DERIVED_FILE_DIR)/Pods-SimServeriOS-checkManifestLockResult.txt", 193 | ); 194 | runOnlyForDeploymentPostprocessing = 0; 195 | shellPath = /bin/sh; 196 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 197 | showEnvVarsInLog = 0; 198 | }; 199 | /* End PBXShellScriptBuildPhase section */ 200 | 201 | /* Begin PBXSourcesBuildPhase section */ 202 | C5F80BB7287286FB00795B28 /* Sources */ = { 203 | isa = PBXSourcesBuildPhase; 204 | buildActionMask = 2147483647; 205 | files = ( 206 | C5F80BC6287286FB00795B28 /* ViewController.m in Sources */, 207 | C5AB33142873DE5900A6640B /* DataConversion.m in Sources */, 208 | C5F80BC0287286FB00795B28 /* AppDelegate.m in Sources */, 209 | C5F80BD1287286FE00795B28 /* main.m in Sources */, 210 | C5F80BC3287286FB00795B28 /* SceneDelegate.m in Sources */, 211 | ); 212 | runOnlyForDeploymentPostprocessing = 0; 213 | }; 214 | /* End PBXSourcesBuildPhase section */ 215 | 216 | /* Begin PBXVariantGroup section */ 217 | C5F80BC7287286FB00795B28 /* Main.storyboard */ = { 218 | isa = PBXVariantGroup; 219 | children = ( 220 | C5F80BC8287286FB00795B28 /* Base */, 221 | ); 222 | name = Main.storyboard; 223 | sourceTree = ""; 224 | }; 225 | C5F80BCC287286FE00795B28 /* LaunchScreen.storyboard */ = { 226 | isa = PBXVariantGroup; 227 | children = ( 228 | C5F80BCD287286FE00795B28 /* Base */, 229 | ); 230 | name = LaunchScreen.storyboard; 231 | sourceTree = ""; 232 | }; 233 | /* End PBXVariantGroup section */ 234 | 235 | /* Begin XCBuildConfiguration section */ 236 | C5F80BD2287286FE00795B28 /* Debug */ = { 237 | isa = XCBuildConfiguration; 238 | buildSettings = { 239 | ALWAYS_SEARCH_USER_PATHS = NO; 240 | CLANG_ANALYZER_NONNULL = YES; 241 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 242 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 243 | CLANG_ENABLE_MODULES = YES; 244 | CLANG_ENABLE_OBJC_ARC = YES; 245 | CLANG_ENABLE_OBJC_WEAK = YES; 246 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 247 | CLANG_WARN_BOOL_CONVERSION = YES; 248 | CLANG_WARN_COMMA = YES; 249 | CLANG_WARN_CONSTANT_CONVERSION = YES; 250 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 251 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 252 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 253 | CLANG_WARN_EMPTY_BODY = YES; 254 | CLANG_WARN_ENUM_CONVERSION = YES; 255 | CLANG_WARN_INFINITE_RECURSION = YES; 256 | CLANG_WARN_INT_CONVERSION = YES; 257 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 258 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 259 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 260 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 261 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 262 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 263 | CLANG_WARN_STRICT_PROTOTYPES = YES; 264 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 265 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 266 | CLANG_WARN_UNREACHABLE_CODE = YES; 267 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 268 | COPY_PHASE_STRIP = NO; 269 | DEBUG_INFORMATION_FORMAT = dwarf; 270 | ENABLE_STRICT_OBJC_MSGSEND = YES; 271 | ENABLE_TESTABILITY = YES; 272 | GCC_C_LANGUAGE_STANDARD = gnu11; 273 | GCC_DYNAMIC_NO_PIC = NO; 274 | GCC_NO_COMMON_BLOCKS = YES; 275 | GCC_OPTIMIZATION_LEVEL = 0; 276 | GCC_PREPROCESSOR_DEFINITIONS = ( 277 | "DEBUG=1", 278 | "$(inherited)", 279 | ); 280 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 281 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 282 | GCC_WARN_UNDECLARED_SELECTOR = YES; 283 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 284 | GCC_WARN_UNUSED_FUNCTION = YES; 285 | GCC_WARN_UNUSED_VARIABLE = YES; 286 | IPHONEOS_DEPLOYMENT_TARGET = 16.0; 287 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 288 | MTL_FAST_MATH = YES; 289 | ONLY_ACTIVE_ARCH = YES; 290 | SDKROOT = iphoneos; 291 | }; 292 | name = Debug; 293 | }; 294 | C5F80BD3287286FE00795B28 /* Release */ = { 295 | isa = XCBuildConfiguration; 296 | buildSettings = { 297 | ALWAYS_SEARCH_USER_PATHS = NO; 298 | CLANG_ANALYZER_NONNULL = YES; 299 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 300 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 301 | CLANG_ENABLE_MODULES = YES; 302 | CLANG_ENABLE_OBJC_ARC = YES; 303 | CLANG_ENABLE_OBJC_WEAK = YES; 304 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 305 | CLANG_WARN_BOOL_CONVERSION = YES; 306 | CLANG_WARN_COMMA = YES; 307 | CLANG_WARN_CONSTANT_CONVERSION = YES; 308 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 309 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 310 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 311 | CLANG_WARN_EMPTY_BODY = YES; 312 | CLANG_WARN_ENUM_CONVERSION = YES; 313 | CLANG_WARN_INFINITE_RECURSION = YES; 314 | CLANG_WARN_INT_CONVERSION = YES; 315 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 316 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 317 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 318 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 319 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 320 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 321 | CLANG_WARN_STRICT_PROTOTYPES = YES; 322 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 323 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 324 | CLANG_WARN_UNREACHABLE_CODE = YES; 325 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 326 | COPY_PHASE_STRIP = NO; 327 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 328 | ENABLE_NS_ASSERTIONS = NO; 329 | ENABLE_STRICT_OBJC_MSGSEND = YES; 330 | GCC_C_LANGUAGE_STANDARD = gnu11; 331 | GCC_NO_COMMON_BLOCKS = YES; 332 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 333 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 334 | GCC_WARN_UNDECLARED_SELECTOR = YES; 335 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 336 | GCC_WARN_UNUSED_FUNCTION = YES; 337 | GCC_WARN_UNUSED_VARIABLE = YES; 338 | IPHONEOS_DEPLOYMENT_TARGET = 16.0; 339 | MTL_ENABLE_DEBUG_INFO = NO; 340 | MTL_FAST_MATH = YES; 341 | SDKROOT = iphoneos; 342 | VALIDATE_PRODUCT = YES; 343 | }; 344 | name = Release; 345 | }; 346 | C5F80BD5287286FE00795B28 /* Debug */ = { 347 | isa = XCBuildConfiguration; 348 | baseConfigurationReference = 8FB37E5AC21BDCDF5E0590AC /* Pods-SimServeriOS.debug.xcconfig */; 349 | buildSettings = { 350 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 351 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 352 | CODESIGN = "$(SRCROOT)/codesign_wrap.sh"; 353 | CODE_SIGN_ENTITLEMENTS = SimServeriOS/SimServeriOS.entitlements; 354 | CODE_SIGN_STYLE = Automatic; 355 | CURRENT_PROJECT_VERSION = 1; 356 | DEVELOPMENT_TEAM = 3D7RY4393N; 357 | GENERATE_INFOPLIST_FILE = YES; 358 | INFOPLIST_FILE = SimServeriOS/Info.plist; 359 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 360 | INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; 361 | INFOPLIST_KEY_UIMainStoryboardFile = Main; 362 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 363 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 364 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 365 | LD_RUNPATH_SEARCH_PATHS = ( 366 | "$(inherited)", 367 | "@executable_path/Frameworks", 368 | ); 369 | MARKETING_VERSION = 1.0; 370 | PRODUCT_BUNDLE_IDENTIFIER = com.worthdoingbadly.SimServeriOS; 371 | PRODUCT_NAME = "$(TARGET_NAME)"; 372 | SWIFT_EMIT_LOC_STRINGS = YES; 373 | TARGETED_DEVICE_FAMILY = "1,2"; 374 | }; 375 | name = Debug; 376 | }; 377 | C5F80BD6287286FE00795B28 /* Release */ = { 378 | isa = XCBuildConfiguration; 379 | baseConfigurationReference = EBE52041D50C1C449A0670FC /* Pods-SimServeriOS.release.xcconfig */; 380 | buildSettings = { 381 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 382 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 383 | CODESIGN = "$(SRCROOT)/codesign_wrap.sh"; 384 | CODE_SIGN_ENTITLEMENTS = SimServeriOS/SimServeriOS.entitlements; 385 | CODE_SIGN_STYLE = Automatic; 386 | CURRENT_PROJECT_VERSION = 1; 387 | DEVELOPMENT_TEAM = 3D7RY4393N; 388 | GENERATE_INFOPLIST_FILE = YES; 389 | INFOPLIST_FILE = SimServeriOS/Info.plist; 390 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 391 | INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; 392 | INFOPLIST_KEY_UIMainStoryboardFile = Main; 393 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 394 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 395 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 396 | LD_RUNPATH_SEARCH_PATHS = ( 397 | "$(inherited)", 398 | "@executable_path/Frameworks", 399 | ); 400 | MARKETING_VERSION = 1.0; 401 | PRODUCT_BUNDLE_IDENTIFIER = com.worthdoingbadly.SimServeriOS; 402 | PRODUCT_NAME = "$(TARGET_NAME)"; 403 | SWIFT_EMIT_LOC_STRINGS = YES; 404 | TARGETED_DEVICE_FAMILY = "1,2"; 405 | }; 406 | name = Release; 407 | }; 408 | /* End XCBuildConfiguration section */ 409 | 410 | /* Begin XCConfigurationList section */ 411 | C5F80BB6287286FB00795B28 /* Build configuration list for PBXProject "SimServeriOS" */ = { 412 | isa = XCConfigurationList; 413 | buildConfigurations = ( 414 | C5F80BD2287286FE00795B28 /* Debug */, 415 | C5F80BD3287286FE00795B28 /* Release */, 416 | ); 417 | defaultConfigurationIsVisible = 0; 418 | defaultConfigurationName = Release; 419 | }; 420 | C5F80BD4287286FE00795B28 /* Build configuration list for PBXNativeTarget "SimServeriOS" */ = { 421 | isa = XCConfigurationList; 422 | buildConfigurations = ( 423 | C5F80BD5287286FE00795B28 /* Debug */, 424 | C5F80BD6287286FE00795B28 /* Release */, 425 | ); 426 | defaultConfigurationIsVisible = 0; 427 | defaultConfigurationName = Release; 428 | }; 429 | /* End XCConfigurationList section */ 430 | }; 431 | rootObject = C5F80BB3287286FB00795B28 /* Project object */; 432 | } 433 | -------------------------------------------------------------------------------- /SimServeriOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SimServeriOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SimServeriOS.xcodeproj/xcuserdata/zhuowei.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SimServeriOS.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 2 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /SimServeriOS.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /SimServeriOS.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SimServeriOS/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // SimServeriOS 4 | // 5 | // Created by Zhuowei Zhang on 2022-07-03. 6 | // 7 | 8 | #import 9 | 10 | @interface AppDelegate : UIResponder 11 | 12 | 13 | @end 14 | 15 | -------------------------------------------------------------------------------- /SimServeriOS/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // SimServeriOS 4 | // 5 | // Created by Zhuowei Zhang on 2022-07-03. 6 | // 7 | 8 | #import "AppDelegate.h" 9 | 10 | @interface AppDelegate () 11 | 12 | @end 13 | 14 | @implementation AppDelegate 15 | 16 | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 18 | // Override point for customization after application launch. 19 | return YES; 20 | } 21 | 22 | 23 | #pragma mark - UISceneSession lifecycle 24 | 25 | 26 | - (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options { 27 | // Called when a new scene session is being created. 28 | // Use this method to select a configuration to create the new scene with. 29 | return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role]; 30 | } 31 | 32 | 33 | - (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet *)sceneSessions { 34 | // Called when the user discards a scene session. 35 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 36 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 37 | } 38 | 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /SimServeriOS/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /SimServeriOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "platform" : "ios", 6 | "size" : "1024x1024" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SimServeriOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /SimServeriOS/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SimServeriOS/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /SimServeriOS/DataConversion.h: -------------------------------------------------------------------------------- 1 | // 2 | // DataConversion.h 3 | // CertificateTool 4 | // 5 | // Copyright (c) 2013-2015 Apple Inc. All Rights Reserved. 6 | // 7 | 8 | #import 9 | 10 | /*! ========================================================================= 11 | @class NSData 12 | 13 | @abstract Extend the NSData object to convert to a hex string 14 | ========================================================================= */ 15 | @interface NSData (DataConversion) 16 | 17 | /*! ------------------------------------------------------------------------- 18 | @method toHexString 19 | 20 | @result returns a NSString object with the hex characters that 21 | represent the value of the NSData object. 22 | ------------------------------------------------------------------------- */ 23 | - (NSString *)toHexString; 24 | 25 | @end 26 | 27 | 28 | /*! ========================================================================= 29 | @class NSString 30 | 31 | @abstract Extend the NSString object to convert hex string into a 32 | binary value in a NSData object. 33 | ========================================================================= */ 34 | @interface NSString (DataConversion) 35 | 36 | /*! ------------------------------------------------------------------------- 37 | @method hextStringToData 38 | 39 | @result Convert a NSString that contains a set of hex characters 40 | into a binary value. If the conversion cannot be done then 41 | nil will be returned. 42 | ------------------------------------------------------------------------- */ 43 | - (NSData *)hexStringToData; 44 | 45 | @end 46 | 47 | 48 | -------------------------------------------------------------------------------- /SimServeriOS/DataConversion.m: -------------------------------------------------------------------------------- 1 | // 2 | // DataConversion.m 3 | // CertificateTool 4 | // 5 | // Copyright (c) 2013-2015 Apple Inc. All Rights Reserved. 6 | // 7 | 8 | #import "DataConversion.h" 9 | #import 10 | 11 | /* ========================================================================== 12 | Static data used to convert between binary and HEX data 13 | ========================================================================== */ 14 | 15 | static char byteMap[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; 16 | static int byteMapLen = sizeof(byteMap); 17 | 18 | /* ========================================================================== 19 | Static functions to lookup the appropriate hex value from binary data ot 20 | binary data from a hex value 21 | ========================================================================== */ 22 | 23 | static uint8_t nibbleFromChar(char c) 24 | { 25 | if(c >= '0' && c <= '9') return c - '0'; 26 | if(c >= 'a' && c <= 'f') return c - 'a' + 10; 27 | if(c >= 'A' && c <= 'F') return c - 'A' + 10; 28 | return 255; 29 | } 30 | 31 | static char nibbleToChar(uint8_t nibble) 32 | { 33 | if(nibble < byteMapLen) return byteMap[nibble]; 34 | return '*'; 35 | } 36 | 37 | /* ========================================================================== 38 | Extend the NSData class to convert a binary value into a hex string 39 | ========================================================================== */ 40 | @implementation NSData (DataConversion) 41 | 42 | - (NSString *)toHexString 43 | { 44 | NSString* result = nil; 45 | 46 | unsigned char* data_bytes = (unsigned char*)[self bytes]; 47 | int data_len = (int)[self length]; 48 | int len = ((data_len * 2) + 1); 49 | 50 | unsigned char buffer[len]; 51 | int iCnt; 52 | for (iCnt = 0; iCnt < data_len; iCnt++) 53 | { 54 | buffer[iCnt * 2] = nibbleToChar(data_bytes[iCnt] >> 4); 55 | buffer[iCnt * 2 + 1] = nibbleToChar(data_bytes[iCnt] & 0x0F); 56 | } 57 | 58 | buffer[data_len * 2] = 0; 59 | result = [NSString stringWithUTF8String:(const char *)buffer]; 60 | return result; 61 | } 62 | 63 | @end 64 | 65 | /* ========================================================================== 66 | Extend the NSString class to convert a hex string into a binary value 67 | ========================================================================== */ 68 | 69 | @implementation NSString (DataConversion) 70 | 71 | - (NSData *)hexStringToData 72 | { 73 | NSData* result = nil; 74 | 75 | const char* utf8_str = [self UTF8String]; 76 | int len = (int)(strlen(utf8_str) / 2); 77 | uint8_t buffer[len]; 78 | uint8_t* p = NULL; 79 | 80 | memset(buffer, 0, len); 81 | int iCnt; 82 | for (iCnt = 0, (p = (uint8_t*)utf8_str); iCnt < len; iCnt++) 83 | { 84 | buffer[iCnt] = (nibbleFromChar(*p) << 4) | nibbleFromChar(*(p+1)); 85 | p += 2; 86 | } 87 | buffer[len] = 0; 88 | result = [NSData dataWithBytes:buffer length:len]; 89 | return result; 90 | } 91 | 92 | @end 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /SimServeriOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIApplicationSceneManifest 6 | 7 | UIApplicationSupportsMultipleScenes 8 | 9 | UISceneConfigurations 10 | 11 | UIWindowSceneSessionRoleApplication 12 | 13 | 14 | UISceneConfigurationName 15 | Default Configuration 16 | UISceneDelegateClassName 17 | SceneDelegate 18 | UISceneStoryboardFile 19 | Main 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SimServeriOS/SceneDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.h 3 | // SimServeriOS 4 | // 5 | // Created by Zhuowei Zhang on 2022-07-03. 6 | // 7 | 8 | #import 9 | 10 | @interface SceneDelegate : UIResponder 11 | 12 | @property (strong, nonatomic) UIWindow * window; 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /SimServeriOS/SceneDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.m 3 | // SimServeriOS 4 | // 5 | // Created by Zhuowei Zhang on 2022-07-03. 6 | // 7 | 8 | #import "SceneDelegate.h" 9 | 10 | @interface SceneDelegate () 11 | 12 | @end 13 | 14 | @implementation SceneDelegate 15 | 16 | 17 | - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions { 18 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 19 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 20 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 21 | } 22 | 23 | 24 | - (void)sceneDidDisconnect:(UIScene *)scene { 25 | // Called as the scene is being released by the system. 26 | // This occurs shortly after the scene enters the background, or when its session is discarded. 27 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 28 | // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). 29 | } 30 | 31 | 32 | - (void)sceneDidBecomeActive:(UIScene *)scene { 33 | // Called when the scene has moved from an inactive state to an active state. 34 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 35 | } 36 | 37 | 38 | - (void)sceneWillResignActive:(UIScene *)scene { 39 | // Called when the scene will move from an active state to an inactive state. 40 | // This may occur due to temporary interruptions (ex. an incoming phone call). 41 | } 42 | 43 | 44 | - (void)sceneWillEnterForeground:(UIScene *)scene { 45 | // Called as the scene transitions from the background to the foreground. 46 | // Use this method to undo the changes made on entering the background. 47 | } 48 | 49 | 50 | - (void)sceneDidEnterBackground:(UIScene *)scene { 51 | // Called as the scene transitions from the foreground to the background. 52 | // Use this method to save data, release shared resources, and store enough scene-specific state information 53 | // to restore the scene back to its current state. 54 | } 55 | 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /SimServeriOS/SimServeriOS.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /SimServeriOS/SimServeriOS_real.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.CommCenter.fine-grained 6 | 7 | spi 8 | sim-authentication 9 | identity 10 | bb-xpc 11 | preferences-reset 12 | voice 13 | identity 14 | phone 15 | carrier-settings 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /SimServeriOS/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // SimServeriOS 4 | // 5 | // Created by Zhuowei Zhang on 2022-07-03. 6 | // 7 | 8 | #import 9 | 10 | @interface ViewController : UIViewController 11 | 12 | 13 | @end 14 | 15 | -------------------------------------------------------------------------------- /SimServeriOS/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // SimServeriOS 4 | // 5 | // Created by Zhuowei Zhang on 2022-07-03. 6 | // 7 | 8 | #import "ViewController.h" 9 | 10 | @interface ViewController () 11 | 12 | @end 13 | 14 | @implementation ViewController 15 | 16 | - (void)viewDidLoad { 17 | [super viewDidLoad]; 18 | // Do any additional setup after loading the view. 19 | } 20 | 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /SimServeriOS/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SimServeriOS 4 | // 5 | // Created by Zhuowei Zhang on 2022-07-03. 6 | // 7 | 8 | #import 9 | #import "AppDelegate.h" 10 | #import 11 | #import 12 | #import "DataConversion.h" 13 | @import CoreTelephony; 14 | 15 | extern NSString* kCTSimSupportUICCAuthenticationTypeKey; 16 | extern NSString* kCTSimSupportUICCAuthenticationTypeEAPAKA; 17 | extern NSString* kCTSimSupportUICCAuthenticationAutnKey; 18 | extern NSString* kCTSimSupportUICCAuthenticationRandKey; 19 | extern NSString* kCTSimSupportUICCAuthenticationCkKey; 20 | extern NSString* kCTSimSupportUICCAuthenticationIkKey; 21 | extern NSString* kCTSimSupportUICCAuthenticationKcKey; 22 | extern NSString* kCTSimSupportUICCAuthenticationResKey; 23 | extern NSString* kCTSimSupportUICCAuthenticationAutsKey; 24 | 25 | @interface CTSubscriberAuthDataHolder: NSObject 26 | - (instancetype)initWithData:(NSDictionary*)data; 27 | - (NSDictionary*)dict; 28 | @end 29 | 30 | @interface CTXPCServiceSubscriptionContext: NSObject 31 | @end 32 | 33 | @interface CTXPCServiceSubscriptionInfo: NSObject 34 | @property (readonly, nonatomic) NSArray* subscriptions; 35 | @end 36 | 37 | @interface CoreTelephonyClient: NSObject 38 | - (CTXPCServiceSubscriptionInfo*)getSubscriptionInfoWithError:(NSError**)error; 39 | - (NSString*)copyMobileSubscriberIdentity:(CTXPCServiceSubscriptionContext*)subscriptionContext error:(NSError**)error; 40 | - (void)generateAuthenticationInfoUsingSim:(CTXPCServiceSubscriptionContext*)subscriptionContext authParams:(CTSubscriberAuthDataHolder*)authParams completion:(void (^)(CTSubscriberAuthDataHolder *authInfo, NSError *error))completion; 41 | @end 42 | 43 | static NSString* GetImsi(void); 44 | 45 | static void CreateAuthResponse(NSData* randData, NSData* autnData, void (^completion)(NSDictionary* response, NSError* error)) { 46 | // https://github.com/apple-oss-distributions/eap8021x/blob/4dee95a5037b6330a6539cc53a79f176fc084b26/EAP8021X.fproj/SIMAccess.m#L387 47 | NSError* error = nil; 48 | CoreTelephonyClient *coreTelephonyclient = [CoreTelephonyClient new]; 49 | 50 | CTXPCServiceSubscriptionInfo* subscriptionInfo = [coreTelephonyclient getSubscriptionInfoWithError:&error]; 51 | if (error) { 52 | completion(nil, error); 53 | return; 54 | } 55 | CTXPCServiceSubscriptionContext* preferredSubscriptionCtx = subscriptionInfo.subscriptions[0]; 56 | CTSubscriberAuthDataHolder* authInputParams = [[CTSubscriberAuthDataHolder alloc] initWithData:@{ 57 | kCTSimSupportUICCAuthenticationRandKey: randData, 58 | kCTSimSupportUICCAuthenticationAutnKey: autnData, 59 | kCTSimSupportUICCAuthenticationTypeKey: kCTSimSupportUICCAuthenticationTypeEAPAKA, 60 | }]; 61 | [coreTelephonyclient generateAuthenticationInfoUsingSim:preferredSubscriptionCtx 62 | authParams:authInputParams completion:^(CTSubscriberAuthDataHolder *authInfo, NSError *error) { 63 | (void)coreTelephonyclient; 64 | NSDictionary* authDict = authInfo.dict; 65 | NSLog(@"authInfo: %@ error: %@", authDict, error); 66 | if (error) { 67 | completion(nil, error); 68 | return; 69 | } 70 | NSDictionary* outputDict = nil; 71 | if (authDict[kCTSimSupportUICCAuthenticationAutsKey]) { 72 | outputDict = @{ 73 | @"auts": [(NSData*)authDict[kCTSimSupportUICCAuthenticationAutsKey] toHexString], 74 | }; 75 | } else if (authDict[kCTSimSupportUICCAuthenticationAutsKey]) { 76 | outputDict = @{ 77 | @"ik": [(NSData*)authDict[kCTSimSupportUICCAuthenticationIkKey] toHexString], 78 | @"ck": [(NSData*)authDict[kCTSimSupportUICCAuthenticationCkKey] toHexString], 79 | @"res": [(NSData*)authDict[kCTSimSupportUICCAuthenticationResKey] toHexString], 80 | }; 81 | } else { 82 | outputDict = @{ 83 | @"err": @"empty response?", 84 | }; 85 | } 86 | completion(outputDict, nil); 87 | }]; 88 | } 89 | 90 | static void StartServer(int port) { 91 | static GCDWebServer* webServer; 92 | webServer = [GCDWebServer new]; 93 | [webServer addDefaultHandlerForMethod:@"GET" requestClass:[GCDWebServerRequest class] asyncProcessBlock:^(GCDWebServerRequest* request, GCDWebServerCompletionBlock completionBlock) { 94 | NSString* method = request.query[@"type"]; 95 | if ([method isEqualToString:@"imsi"]) { 96 | completionBlock([GCDWebServerDataResponse responseWithJSONObject:@{ 97 | @"imsi": GetImsi(), 98 | }]); 99 | } else if ([method isEqualToString:@"rand-autn"]) { 100 | NSData* randData = [request.query[@"rand"] hexStringToData]; 101 | NSData* autnData = [request.query[@"autn"] hexStringToData]; 102 | if (!randData || !autnData) { 103 | completionBlock([GCDWebServerDataResponse responseWithJSONObject:@{ 104 | @"err": @"missing params", 105 | }]); 106 | return; 107 | } 108 | CreateAuthResponse(randData, autnData, ^(NSDictionary *response, NSError *error) { 109 | if (error) { 110 | NSLog(@"Error: %@", error); 111 | completionBlock([GCDWebServerDataResponse responseWithJSONObject:@{ 112 | @"err": @"fail", 113 | }]); 114 | return; 115 | } 116 | completionBlock([GCDWebServerDataResponse responseWithJSONObject:response]); 117 | }); 118 | } else { 119 | completionBlock([GCDWebServerDataResponse responseWithJSONObject:@{ 120 | @"err": @"invalid command", 121 | }]); 122 | } 123 | }]; 124 | [webServer startWithPort:port bonjourName:nil]; 125 | } 126 | 127 | static NSString* GetImsi(void) { 128 | NSError* error = nil; 129 | CoreTelephonyClient *coreTelephonyclient = [CoreTelephonyClient new]; 130 | 131 | CTXPCServiceSubscriptionInfo* subscriptionInfo = [coreTelephonyclient getSubscriptionInfoWithError:&error]; 132 | if (error) { 133 | NSLog(@"%@", error); 134 | return nil; 135 | } 136 | CTXPCServiceSubscriptionContext* preferredSubscriptionCtx = subscriptionInfo.subscriptions[0]; 137 | NSString* imsi = [coreTelephonyclient copyMobileSubscriberIdentity:preferredSubscriptionCtx error:&error]; 138 | if (error) { 139 | NSLog(@"%@", error); 140 | return nil; 141 | } 142 | return imsi; 143 | } 144 | 145 | static void PrintImsi(void) { 146 | NSString* imsi = GetImsi(); 147 | if (imsi) { 148 | printf("%s", imsi.UTF8String); 149 | } 150 | } 151 | 152 | static void PerformAuthBase64(char* base64String) { 153 | NSData* randAutnData = [[NSData alloc]initWithBase64EncodedString:[NSString stringWithUTF8String:base64String] options:0]; 154 | if (!randAutnData) { 155 | fprintf(stderr, "fail to decode base64\n"); 156 | exit(1); 157 | return; 158 | } 159 | if (randAutnData.length < 32) { 160 | fprintf(stderr, "wrong length\n"); 161 | exit(1); 162 | return; 163 | } 164 | CreateAuthResponse([randAutnData subdataWithRange:NSMakeRange(0, 16)], [randAutnData subdataWithRange:NSMakeRange(16, 16)], ^(NSDictionary *response, NSError *error) { 165 | printf("made it\n"); 166 | exit(0); 167 | }); 168 | } 169 | 170 | int main(int argc, char** argv) { 171 | if (argc < 2) { 172 | fprintf(stderr, "usage:\n" 173 | "imsi: prints imsi\n" 174 | "auth : authenticates with EAP_AKA on ISIM\n" 175 | "serve : serves web server\n"); 176 | return 0; 177 | } 178 | if (!strcmp(argv[1], "imsi")) { 179 | PrintImsi(); 180 | return 0; 181 | } else if (!strcmp(argv[1], "auth")) { 182 | PerformAuthBase64(argv[2]); 183 | } else if (!strcmp(argv[1], "serve")) { 184 | StartServer(argc == 3? atoi(argv[2]): 3333); 185 | } else { 186 | fprintf(stderr, "wrong arg\n"); 187 | return 1; 188 | } 189 | CFRunLoopRun(); 190 | return 0; 191 | } 192 | 193 | #if 0 194 | int main(int argc, char * argv[]) { 195 | NSString * appDelegateClassName; 196 | @autoreleasepool { 197 | // Setup code that might create autoreleased objects goes here. 198 | appDelegateClassName = NSStringFromClass([AppDelegate class]); 199 | } 200 | return UIApplicationMain(argc, argv, nil, appDelegateClassName); 201 | } 202 | #endif 203 | -------------------------------------------------------------------------------- /codesign_wrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | exec codesign "$1" "$2" "$3" "$4" /Users/zhuowei/Documents/Projects/SimServeriOS/SimServeriOS/SimServeriOS_real.entitlements "$5" "$6" "$7" "$8" 3 | --------------------------------------------------------------------------------