From dd66355488aa0bd2eac44c8c098eb62523f522ed Mon Sep 17 00:00:00 2001 From: Jackson Coxson Date: Wed, 2 Nov 2022 17:58:59 -0700 Subject: [PATCH] Implement emotional damage (#95) * Implement em_proxy * Update libimobiledevice * Add minimuxer library to Xcode * Build missing C files for libimobiledevice * Remove objective C library * Add pairing file to Info.plist * Heartbeat self on startup * Enable JIT on-device * Implement on-device installation * Fix OpenSSL header errors * Random submodule bullcrap go * Search release folder for emotional damage * Clean dependencies * Build Rust dependencies attempt 1/999 * Update em_proxy * Implement refreshing apps * Clean up old operations * Remove all AltServer code * Remove files from Xcode project * Implement auto mounting the developer DMG * Recover from app being backgrounded * Fixed keeping pairing file in app after updating SideStore (#3) * Use compliant error handling for minimuxer * Fix app failing to install * Don't kill proxy on backgrounding * Makes sure the ALTPairingFile gets transferred even if team IDs change (#4) * Step 1 to allow SideStore to resign itself * Update ResignAppOperation.swift * Adding cache for action runner (#5) * Start caching commit for actions Signed-off-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> * Update build.yml Signed-off-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> * Update build.yml Signed-off-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> * Use rust lib directories to cache Signed-off-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> * Cache cargo also Signed-off-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> * Fix spacing Signed-off-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> * Replace cargo id for caching Signed-off-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> * Remove cache if statements Signed-off-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> Signed-off-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> * Add disconnected WireGuard detection * Add minimuxer logging Signed-off-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> Co-authored-by: jawshoeadan <62785552+jawshoeadan@users.noreply.github.com> Co-authored-by: Joelle Stickney Co-authored-by: Spidy123222 <64176728+Spidy123222@users.noreply.github.com> --- .github/workflows/build.yml | 50 ++ .gitmodules | 11 +- AltStore.xcodeproj/project.pbxproj | 429 ++++++++++++++++-- AltStore/AppDelegate.swift | 15 +- AltStore/Info.plist | 2 + AltStore/LaunchViewController.swift | 8 + AltStore/Managing Apps/AppManager.swift | 57 +-- .../BackgroundRefreshAppsOperation.swift | 20 +- .../Operations/DeactivateAppOperation.swift | 64 +-- AltStore/Operations/EnableJITOperation.swift | 101 +---- AltStore/Operations/FindServerOperation.swift | 131 ------ AltStore/Operations/InstallAppOperation.swift | 71 +-- AltStore/Operations/OperationContexts.swift | 9 +- AltStore/Operations/OperationError.swift | 72 +++ AltStore/Operations/RefreshAppOperation.swift | 91 ++-- AltStore/Operations/RemoveAppOperation.swift | 56 +-- AltStore/Operations/ResignAppOperation.swift | 3 + AltStore/Operations/SendAppOperation.swift | 97 +--- AltStore/SceneDelegate.swift | 5 +- AltStore/Server/Server.swift | 73 --- AltStore/Server/ServerConnection.swift | 110 ----- AltStore/Server/ServerManager.swift | 366 --------------- Dependencies/MarkdownAttributedString | 2 +- Dependencies/Roxas | 2 +- Dependencies/em_proxy | 1 + Dependencies/libimobiledevice | 2 +- Dependencies/libimobiledevice-glue | 1 + Dependencies/libplist | 2 +- Dependencies/libusbmuxd | 2 +- Dependencies/minimuxer | 1 + EmotionalDamage/EmotionalDamage.swift | 18 + EmotionalDamage/em_proxy.h | 31 ++ Shared/Extensions/Bundle+AltStore.swift | 2 +- minimuxer/minimuxer.swift | 81 ++++ 34 files changed, 811 insertions(+), 1175 deletions(-) delete mode 100644 AltStore/Operations/FindServerOperation.swift delete mode 100644 AltStore/Server/Server.swift delete mode 100644 AltStore/Server/ServerConnection.swift delete mode 100644 AltStore/Server/ServerManager.swift create mode 160000 Dependencies/em_proxy create mode 160000 Dependencies/libimobiledevice-glue create mode 160000 Dependencies/minimuxer create mode 100644 EmotionalDamage/EmotionalDamage.swift create mode 100644 EmotionalDamage/em_proxy.h create mode 100644 minimuxer/minimuxer.swift diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 193cabeb..fd5d1e01 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,8 +22,58 @@ jobs: uses: actions/checkout@v2 with: submodules: recursive + + - name: Cache rust cargo + id: cache-rust-cargo + uses: actions/cache@v3 + env: + cache-name: cache-rust-cargo + with: + path: ~/.cargo + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Cache rust minimuxer + id: cache-rust-minimuxer + uses: actions/cache@v3 + env: + cache-name: cache-rust-minimuxer + with: + path: ./Dependencies/minimuxer/target + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Cache rust em_proxy + id: cache-rust-em_proxy + uses: actions/cache@v3 + env: + cache-name: cache-rust-em_proxy + with: + path: ./Dependencies/em_proxy/target + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Install dependencies run: brew install ldid + - name: Install rustup + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + target: aarch64-apple-ios + - name: Create emotional damage + run: cd Dependencies/em_proxy && cargo build --release --target aarch64-apple-ios + - name: Build minimuxer + run: cd Dependencies/minimuxer && cargo build --release --target aarch64-apple-ios - name: Setup Xcode uses: maxim-lobanov/setup-xcode@v1.4.1 with: diff --git a/.gitmodules b/.gitmodules index 30be057f..5e8a821f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,7 +3,7 @@ url = https://github.com/rileytestut/Roxas.git [submodule "Dependencies/libimobiledevice"] path = Dependencies/libimobiledevice - url = https://github.com/SideStore/libimobiledevice.git + url = https://github.com/libimobiledevice/libimobiledevice [submodule "Dependencies/libusbmuxd"] path = Dependencies/libusbmuxd url = https://github.com/libimobiledevice/libusbmuxd.git @@ -13,3 +13,12 @@ [submodule "Dependencies/MarkdownAttributedString"] path = Dependencies/MarkdownAttributedString url = https://github.com/chockenberry/MarkdownAttributedString.git +[submodule "Dependencies/em_proxy"] + path = Dependencies/em_proxy + url = https://github.com/jkcoxson/em_proxy +[submodule "Dependencies/libimobiledevice-glue"] + path = Dependencies/libimobiledevice-glue + url = https://github.com/libimobiledevice/libimobiledevice-glue +[submodule "Dependencies/minimuxer"] + path = Dependencies/minimuxer + url = https://github.com/jkcoxson/minimuxer diff --git a/AltStore.xcodeproj/project.pbxproj b/AltStore.xcodeproj/project.pbxproj index 1ecf19f9..cfa1b19d 100644 --- a/AltStore.xcodeproj/project.pbxproj +++ b/AltStore.xcodeproj/project.pbxproj @@ -7,6 +7,28 @@ objects = { /* Begin PBXBuildFile section */ + 19104D952909BAEA00C49C7B /* libimobiledevice.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BF45872B2298D31600BD7491 /* libimobiledevice.a */; }; + 19104DB52909C06D00C49C7B /* EmotionalDamage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19104DB42909C06D00C49C7B /* EmotionalDamage.swift */; }; + 19104DBB2909C11700C49C7B /* libem_proxy.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 19104DA32909BC1000C49C7B /* libem_proxy.a */; }; + 19104DBC2909C4E500C49C7B /* libEmotionalDamage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 19104DB22909C06C00C49C7B /* libEmotionalDamage.a */; }; + 191E5FAE290A5D92001A3B7C /* minimuxer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191E5FAD290A5D92001A3B7C /* minimuxer.swift */; }; + 191E5FB4290A5DA0001A3B7C /* libminimuxer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 191E5FAB290A5D92001A3B7C /* libminimuxer.a */; }; + 191E5FB6290A5E1F001A3B7C /* libminimuxer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 191E5FB5290A5E1F001A3B7C /* libminimuxer.a */; }; + 191E5FDC290AFA5C001A3B7C /* OpenSSL in Frameworks */ = {isa = PBXBuildFile; productRef = 191E5FDB290AFA5C001A3B7C /* OpenSSL */; }; + 191E6066290B2DB1001A3B7C /* cbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = 191E605E290B2D6B001A3B7C /* cbuf.c */; }; + 191E6067290B2DB3001A3B7C /* collection.c in Sources */ = {isa = PBXBuildFile; fileRef = 191E6060290B2D6B001A3B7C /* collection.c */; }; + 191E6068290B2DB5001A3B7C /* glue.c in Sources */ = {isa = PBXBuildFile; fileRef = 191E605D290B2D6B001A3B7C /* glue.c */; }; + 191E6069290B2DB7001A3B7C /* opack.c in Sources */ = {isa = PBXBuildFile; fileRef = 191E6061290B2D6B001A3B7C /* opack.c */; }; + 191E606A290B2DC4001A3B7C /* socket.c in Sources */ = {isa = PBXBuildFile; fileRef = 191E6064290B2D6B001A3B7C /* socket.c */; }; + 191E606B290B2DC6001A3B7C /* termcolors.c in Sources */ = {isa = PBXBuildFile; fileRef = 191E6065290B2D6B001A3B7C /* termcolors.c */; }; + 191E606C290B2DC8001A3B7C /* thread.c in Sources */ = {isa = PBXBuildFile; fileRef = 191E6063290B2D6B001A3B7C /* thread.c */; }; + 191E606D290B2DCA001A3B7C /* tlv.c in Sources */ = {isa = PBXBuildFile; fileRef = 191E6062290B2D6B001A3B7C /* tlv.c */; }; + 191E606E290B2DCB001A3B7C /* utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 191E605F290B2D6B001A3B7C /* utils.c */; }; + 191E6075290B2E46001A3B7C /* companion_proxy.c in Sources */ = {isa = PBXBuildFile; fileRef = 191E6073290B2E02001A3B7C /* companion_proxy.c */; }; + 191E6076290B2E48001A3B7C /* preboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 191E6074290B2E02001A3B7C /* preboard.c */; }; + 191E607D290B2EA5001A3B7C /* jsmn.c in Sources */ = {isa = PBXBuildFile; fileRef = 191E5FD0290A651D001A3B7C /* jsmn.c */; }; + 191E607E290B2EA7001A3B7C /* jplist.c in Sources */ = {isa = PBXBuildFile; fileRef = 191E5FCF290A651D001A3B7C /* jplist.c */; }; + 191E6087290C7B50001A3B7C /* libminimuxer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 191E5FB5290A5E1F001A3B7C /* libminimuxer.a */; }; 19B9B7452845E6DF0076EF69 /* SelectTeamViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B9B7442845E6DF0076EF69 /* SelectTeamViewController.swift */; }; 4879A95F2861046500FC1BBD /* AltSign in Frameworks */ = {isa = PBXBuildFile; productRef = 4879A95E2861046500FC1BBD /* AltSign */; }; 4879A9622861049C00FC1BBD /* OpenSSL in Frameworks */ = {isa = PBXBuildFile; productRef = 4879A9612861049C00FC1BBD /* OpenSSL */; }; @@ -106,16 +128,11 @@ BF4588342298D3C100BD7491 /* userpref.h in Headers */ = {isa = PBXBuildFile; fileRef = BF45882A2298D3C000BD7491 /* userpref.h */; }; BF4588352298D3C100BD7491 /* userpref.c in Sources */ = {isa = PBXBuildFile; fileRef = BF45882B2298D3C000BD7491 /* userpref.c */; }; BF4588362298D3C100BD7491 /* debug.h in Headers */ = {isa = PBXBuildFile; fileRef = BF45882C2298D3C000BD7491 /* debug.h */; }; - BF4588372298D3C100BD7491 /* utils.c in Sources */ = {isa = PBXBuildFile; fileRef = BF45882D2298D3C000BD7491 /* utils.c */; }; - BF4588392298D3C100BD7491 /* socket.c in Sources */ = {isa = PBXBuildFile; fileRef = BF45882F2298D3C000BD7491 /* socket.c */; }; BF45883A2298D3C100BD7491 /* debug.c in Sources */ = {isa = PBXBuildFile; fileRef = BF4588302298D3C000BD7491 /* debug.c */; }; BF45883C2298D3C100BD7491 /* utils.h in Headers */ = {isa = PBXBuildFile; fileRef = BF4588322298D3C100BD7491 /* utils.h */; }; BF4588402298D3F800BD7491 /* collection.h in Headers */ = {isa = PBXBuildFile; fileRef = BF45883E2298D3F800BD7491 /* collection.h */; }; - BF4588412298D3F800BD7491 /* collection.c in Sources */ = {isa = PBXBuildFile; fileRef = BF45883F2298D3F800BD7491 /* collection.c */; }; BF4588432298D40000BD7491 /* libusbmuxd.c in Sources */ = {isa = PBXBuildFile; fileRef = BF4588422298D40000BD7491 /* libusbmuxd.c */; }; BF4588472298D4B000BD7491 /* libimobiledevice.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BF45872B2298D31600BD7491 /* libimobiledevice.a */; }; - BF45884A2298D55000BD7491 /* thread.c in Sources */ = {isa = PBXBuildFile; fileRef = BF4588482298D55000BD7491 /* thread.c */; }; - BF45884B2298D55000BD7491 /* thread.h in Headers */ = {isa = PBXBuildFile; fileRef = BF4588492298D55000BD7491 /* thread.h */; }; BF4588882298DD3F00BD7491 /* libxml2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = BF4588872298DD3F00BD7491 /* libxml2.tbd */; }; BF4B78FE24B3D1DB008AB4AC /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF4B78FD24B3D1DB008AB4AC /* SceneDelegate.swift */; }; BF541C0B25E5A5FA00CD46B2 /* FileManager+URLs.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF541C0A25E5A5FA00CD46B2 /* FileManager+URLs.swift */; }; @@ -184,7 +201,6 @@ BF74989B23621C0700CED65F /* ForwardingNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF74989A23621C0700CED65F /* ForwardingNavigationController.swift */; }; BF770E5122BB1CF6002A40FE /* InstallAppOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF770E5022BB1CF6002A40FE /* InstallAppOperation.swift */; }; BF770E5422BC044E002A40FE /* OperationContexts.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF770E5322BC044E002A40FE /* OperationContexts.swift */; }; - BF770E5622BC3C03002A40FE /* Server.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF770E5522BC3C02002A40FE /* Server.swift */; }; BF770E5822BC3D0F002A40FE /* RefreshGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF770E5722BC3D0F002A40FE /* RefreshGroup.swift */; }; BF770E6722BD57C4002A40FE /* BackgroundTaskManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF770E6622BD57C3002A40FE /* BackgroundTaskManager.swift */; }; BF770E6922BD57DD002A40FE /* Silence.m4a in Resources */ = {isa = PBXBuildFile; fileRef = BF770E6822BD57DD002A40FE /* Silence.m4a */; }; @@ -210,7 +226,6 @@ BF9ABA4922DD0742008935CF /* ScreenshotCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF9ABA4822DD0742008935CF /* ScreenshotCollectionViewCell.swift */; }; BF9ABA4B22DD1380008935CF /* NavigationBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF9ABA4A22DD137F008935CF /* NavigationBar.swift */; }; BF9ABA4D22DD16DE008935CF /* PillButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF9ABA4C22DD16DE008935CF /* PillButton.swift */; }; - BFA8172923C56042001B5953 /* ServerConnection.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFA8172823C56042001B5953 /* ServerConnection.swift */; }; BFA8172B23C5633D001B5953 /* FetchAnisetteDataOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFA8172A23C5633D001B5953 /* FetchAnisetteDataOperation.swift */; }; BFAD678E25E0649500D4C4D1 /* ALTDebugConnection.mm in Sources */ = {isa = PBXBuildFile; fileRef = BFAD678D25E0649500D4C4D1 /* ALTDebugConnection.mm */; }; BFAD67A325E0854500D4C4D1 /* DeveloperDiskManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFAD67A225E0854500D4C4D1 /* DeveloperDiskManager.swift */; }; @@ -229,7 +244,6 @@ BFAECC5E2501B0BF00528F27 /* CFNotificationName+AltStore.h in Headers */ = {isa = PBXBuildFile; fileRef = BF718BC723C919CC00A89F2D /* CFNotificationName+AltStore.h */; settings = {ATTRIBUTES = (Public, ); }; }; BFAECC5F2501B0BF00528F27 /* ALTConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = BFD52BD222A06EFB000B7ED1 /* ALTConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; BFAECC602501B0BF00528F27 /* NSError+ALTServerError.h in Headers */ = {isa = PBXBuildFile; fileRef = BF1E314822A060F400370A3C /* NSError+ALTServerError.h */; settings = {ATTRIBUTES = (Public, ); }; }; - BFB3645A2325985F00CD0EB1 /* FindServerOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFB364592325985F00CD0EB1 /* FindServerOperation.swift */; }; BFB39B5C252BC10E00D1BE50 /* Managed.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFB39B5B252BC10E00D1BE50 /* Managed.swift */; }; BFB4323F22DE852000B7F8BC /* UpdateCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = BFB4323E22DE852000B7F8BC /* UpdateCollectionViewCell.xib */; }; BFB49AAA23834CF900D542D9 /* ALTAnisetteData.m in Sources */ = {isa = PBXBuildFile; fileRef = BFB49AA823834CF900D542D9 /* ALTAnisetteData.m */; }; @@ -257,7 +271,6 @@ BFD2477A2284B9A700981D42 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BFD247782284B9A700981D42 /* LaunchScreen.storyboard */; }; BFD2478C2284C4C300981D42 /* AppIconImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFD2478B2284C4C300981D42 /* AppIconImageView.swift */; }; BFD2478F2284C8F900981D42 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFD2478E2284C8F900981D42 /* Button.swift */; }; - BFD52BD422A0800A000B7ED1 /* ServerManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFD52BD322A0800A000B7ED1 /* ServerManager.swift */; }; BFD52C0122A1A9CB000B7ED1 /* ptrarray.c in Sources */ = {isa = PBXBuildFile; fileRef = BFD52BE522A1A9CA000B7ED1 /* ptrarray.c */; }; BFD52C0222A1A9CB000B7ED1 /* base64.c in Sources */ = {isa = PBXBuildFile; fileRef = BFD52BE622A1A9CA000B7ED1 /* base64.c */; }; BFD52C0322A1A9CB000B7ED1 /* hashtable.c in Sources */ = {isa = PBXBuildFile; fileRef = BFD52BE722A1A9CA000B7ED1 /* hashtable.c */; }; @@ -368,6 +381,27 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 19104D932909BADB00C49C7B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFD247622284B9A500981D42 /* Project object */; + proxyType = 1; + remoteGlobalIDString = BF45872A2298D31600BD7491; + remoteInfo = libimobiledevice; + }; + 19104DB92909C0F200C49C7B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFD247622284B9A500981D42 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 19104DB12909C06C00C49C7B; + remoteInfo = EmotionalDamage; + }; + 191E5FB2290A5D9B001A3B7C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFD247622284B9A500981D42 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 191E5FAA290A5D92001A3B7C; + remoteInfo = minimuxer; + }; B3146ECC284F580500BBC3FD /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = B3146EC6284F580500BBC3FD /* Roxas.xcodeproj */; @@ -427,6 +461,24 @@ /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ + 19104DB02909C06C00C49C7B /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/$(PRODUCT_NAME)"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 191E5FA9290A5D92001A3B7C /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/$(PRODUCT_NAME)"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; BF0201BC22C2EFA3000B93E4 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -484,6 +536,28 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 19104DA32909BC1000C49C7B /* libem_proxy.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libem_proxy.a; path = "Dependencies/em_proxy/target/aarch64-apple-ios/debug/libem_proxy.a"; sourceTree = ""; }; + 19104DA92909BC7100C49C7B /* em_proxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = em_proxy.h; sourceTree = ""; }; + 19104DB22909C06C00C49C7B /* libEmotionalDamage.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libEmotionalDamage.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 19104DB42909C06D00C49C7B /* EmotionalDamage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmotionalDamage.swift; sourceTree = ""; }; + 191E5FAB290A5D92001A3B7C /* libminimuxer.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libminimuxer.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 191E5FAD290A5D92001A3B7C /* minimuxer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = minimuxer.swift; sourceTree = ""; }; + 191E5FB5290A5E1F001A3B7C /* libminimuxer.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libminimuxer.a; path = "Dependencies/minimuxer/target/aarch64-apple-ios/debug/libminimuxer.a"; sourceTree = ""; }; + 191E5FCF290A651D001A3B7C /* jplist.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = jplist.c; path = Dependencies/libplist/src/jplist.c; sourceTree = SOURCE_ROOT; }; + 191E5FD0290A651D001A3B7C /* jsmn.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = jsmn.c; path = Dependencies/libplist/src/jsmn.c; sourceTree = SOURCE_ROOT; }; + 191E5FD1290A651D001A3B7C /* jsmn.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = jsmn.h; path = Dependencies/libplist/src/jsmn.h; sourceTree = SOURCE_ROOT; }; + 191E5FD7290A6EFB001A3B7C /* minimuxer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = minimuxer.h; path = ../Dependencies/minimuxer/minimuxer.h; sourceTree = ""; }; + 191E605D290B2D6B001A3B7C /* glue.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = glue.c; path = "../Dependencies/libimobiledevice-glue/src/glue.c"; sourceTree = ""; }; + 191E605E290B2D6B001A3B7C /* cbuf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = cbuf.c; path = "../Dependencies/libimobiledevice-glue/src/cbuf.c"; sourceTree = ""; }; + 191E605F290B2D6B001A3B7C /* utils.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = utils.c; path = "../Dependencies/libimobiledevice-glue/src/utils.c"; sourceTree = ""; }; + 191E6060290B2D6B001A3B7C /* collection.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = collection.c; path = "../Dependencies/libimobiledevice-glue/src/collection.c"; sourceTree = ""; }; + 191E6061290B2D6B001A3B7C /* opack.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = opack.c; path = "../Dependencies/libimobiledevice-glue/src/opack.c"; sourceTree = ""; }; + 191E6062290B2D6B001A3B7C /* tlv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = tlv.c; path = "../Dependencies/libimobiledevice-glue/src/tlv.c"; sourceTree = ""; }; + 191E6063290B2D6B001A3B7C /* thread.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = thread.c; path = "../Dependencies/libimobiledevice-glue/src/thread.c"; sourceTree = ""; }; + 191E6064290B2D6B001A3B7C /* socket.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = socket.c; path = "../Dependencies/libimobiledevice-glue/src/socket.c"; sourceTree = ""; }; + 191E6065290B2D6B001A3B7C /* termcolors.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = termcolors.c; path = "../Dependencies/libimobiledevice-glue/src/termcolors.c"; sourceTree = ""; }; + 191E6073290B2E02001A3B7C /* companion_proxy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = companion_proxy.c; path = ../Dependencies/libimobiledevice/src/companion_proxy.c; sourceTree = ""; }; + 191E6074290B2E02001A3B7C /* preboard.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = preboard.c; path = ../Dependencies/libimobiledevice/src/preboard.c; sourceTree = ""; }; 19B9B7442845E6DF0076EF69 /* SelectTeamViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectTeamViewController.swift; sourceTree = ""; }; B3146EC6284F580500BBC3FD /* Roxas.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Roxas.xcodeproj; path = Dependencies/Roxas/Roxas.xcodeproj; sourceTree = ""; }; B39575F4284F29E20080B4FF /* Roxas.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Roxas.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -692,7 +766,6 @@ BF74989A23621C0700CED65F /* ForwardingNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForwardingNavigationController.swift; sourceTree = ""; }; BF770E5022BB1CF6002A40FE /* InstallAppOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstallAppOperation.swift; sourceTree = ""; }; BF770E5322BC044E002A40FE /* OperationContexts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OperationContexts.swift; sourceTree = ""; }; - BF770E5522BC3C02002A40FE /* Server.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Server.swift; sourceTree = ""; }; BF770E5722BC3D0F002A40FE /* RefreshGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RefreshGroup.swift; sourceTree = ""; }; BF770E6622BD57C3002A40FE /* BackgroundTaskManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BackgroundTaskManager.swift; sourceTree = ""; }; BF770E6822BD57DD002A40FE /* Silence.m4a */ = {isa = PBXFileReference; lastKnownFileType = file; path = Silence.m4a; sourceTree = ""; }; @@ -720,14 +793,12 @@ BF9ABA4822DD0742008935CF /* ScreenshotCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScreenshotCollectionViewCell.swift; sourceTree = ""; }; BF9ABA4A22DD137F008935CF /* NavigationBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationBar.swift; sourceTree = ""; }; BF9ABA4C22DD16DE008935CF /* PillButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PillButton.swift; sourceTree = ""; }; - BFA8172823C56042001B5953 /* ServerConnection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerConnection.swift; sourceTree = ""; }; BFA8172A23C5633D001B5953 /* FetchAnisetteDataOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FetchAnisetteDataOperation.swift; sourceTree = ""; }; BFAD678C25E0649500D4C4D1 /* ALTDebugConnection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ALTDebugConnection.h; sourceTree = ""; }; BFAD678D25E0649500D4C4D1 /* ALTDebugConnection.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ALTDebugConnection.mm; sourceTree = ""; }; BFAD679525E064D400D4C4D1 /* ALTDebugConnection+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ALTDebugConnection+Private.h"; sourceTree = ""; }; BFAD67A225E0854500D4C4D1 /* DeveloperDiskManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeveloperDiskManager.swift; sourceTree = ""; }; BFB1169C22932DB100BB457C /* apps.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = apps.json; sourceTree = ""; }; - BFB364592325985F00CD0EB1 /* FindServerOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FindServerOperation.swift; sourceTree = ""; }; BFB39B5B252BC10E00D1BE50 /* Managed.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Managed.swift; sourceTree = ""; }; BFB4323E22DE852000B7F8BC /* UpdateCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = UpdateCollectionViewCell.xib; sourceTree = ""; }; BFB49AA823834CF900D542D9 /* ALTAnisetteData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ALTAnisetteData.m; path = "Dependencies/AltSign/AltSign/Model/Apple API/ALTAnisetteData.m"; sourceTree = SOURCE_ROOT; }; @@ -761,7 +832,6 @@ BFD2479E2284FBD000981D42 /* UIColor+AltStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+AltStore.swift"; sourceTree = ""; }; BFD44605241188C300EAB90A /* CodableServerError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodableServerError.swift; sourceTree = ""; }; BFD52BD222A06EFB000B7ED1 /* ALTConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ALTConstants.h; sourceTree = ""; }; - BFD52BD322A0800A000B7ED1 /* ServerManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerManager.swift; sourceTree = ""; }; BFD52BE522A1A9CA000B7ED1 /* ptrarray.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ptrarray.c; path = Dependencies/libplist/src/ptrarray.c; sourceTree = SOURCE_ROOT; }; BFD52BE622A1A9CA000B7ED1 /* base64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = base64.c; path = Dependencies/libplist/src/base64.c; sourceTree = SOURCE_ROOT; }; BFD52BE722A1A9CA000B7ED1 /* hashtable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = hashtable.c; path = Dependencies/libplist/src/hashtable.c; sourceTree = SOURCE_ROOT; }; @@ -858,10 +928,27 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 19104DAF2909C06C00C49C7B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 19104DBB2909C11700C49C7B /* libem_proxy.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 191E5FA8290A5D92001A3B7C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 191E5FB6290A5E1F001A3B7C /* libminimuxer.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 678E094C3184B66357EAA4AF /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 191E5FDC290AFA5C001A3B7C /* OpenSSL in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -921,6 +1008,10 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 191E6087290C7B50001A3B7C /* libminimuxer.a in Frameworks */, + 191E5FB4290A5DA0001A3B7C /* libminimuxer.a in Frameworks */, + 19104DBC2909C4E500C49C7B /* libEmotionalDamage.a in Frameworks */, + 19104D952909BAEA00C49C7B /* libimobiledevice.a in Frameworks */, B3146ED2284F581E00BBC3FD /* Roxas.framework in Frameworks */, D533E8B72727841800A9B5DD /* libAppleArchive.tbd in Frameworks */, B3C395F9284F362400DA9E2F /* AppCenterCrashes in Frameworks */, @@ -944,6 +1035,40 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 19104DB32909C06D00C49C7B /* EmotionalDamage */ = { + isa = PBXGroup; + children = ( + 19104DA92909BC7100C49C7B /* em_proxy.h */, + 19104DB42909C06D00C49C7B /* EmotionalDamage.swift */, + ); + path = EmotionalDamage; + sourceTree = ""; + }; + 191E5FAC290A5D92001A3B7C /* minimuxer */ = { + isa = PBXGroup; + children = ( + 191E5FD7290A6EFB001A3B7C /* minimuxer.h */, + 191E5FAD290A5D92001A3B7C /* minimuxer.swift */, + ); + path = minimuxer; + sourceTree = ""; + }; + 191E5FF4290B2663001A3B7C /* libimobiledevice-glue */ = { + isa = PBXGroup; + children = ( + 191E605E290B2D6B001A3B7C /* cbuf.c */, + 191E6060290B2D6B001A3B7C /* collection.c */, + 191E605D290B2D6B001A3B7C /* glue.c */, + 191E6061290B2D6B001A3B7C /* opack.c */, + 191E6064290B2D6B001A3B7C /* socket.c */, + 191E6065290B2D6B001A3B7C /* termcolors.c */, + 191E6063290B2D6B001A3B7C /* thread.c */, + 191E6062290B2D6B001A3B7C /* tlv.c */, + 191E605F290B2D6B001A3B7C /* utils.c */, + ); + name = "libimobiledevice-glue"; + sourceTree = ""; + }; B3146EC7284F580500BBC3FD /* Products */ = { isa = PBXGroup; children = ( @@ -1052,6 +1177,7 @@ BF45872C2298D31600BD7491 /* libimobiledevice */ = { isa = PBXGroup; children = ( + 191E5FF4290B2663001A3B7C /* libimobiledevice-glue */, BF4588562298DC6D00BD7491 /* libplist */, BF4587972298D36400BD7491 /* libimobiledevice */, BF45883D2298D3E800BD7491 /* libusbmuxd */, @@ -1068,6 +1194,8 @@ BF4587DF2298D3A900BD7491 /* debugserver.c */, BF4587DE2298D3A900BD7491 /* debugserver.h */, BF4587E42298D3A900BD7491 /* device_link_service.c */, + 191E6073290B2E02001A3B7C /* companion_proxy.c */, + 191E6074290B2E02001A3B7C /* preboard.c */, BF4587EF2298D3AA00BD7491 /* device_link_service.h */, BF4587C92298D3A800BD7491 /* diagnostics_relay.c */, BF4587CA2298D3A800BD7491 /* diagnostics_relay.h */, @@ -1150,6 +1278,9 @@ BFD52BE622A1A9CA000B7ED1 /* base64.c */, BFD52BF622A1A9CA000B7ED1 /* base64.h */, BFD52BF222A1A9CA000B7ED1 /* Boolean.cpp */, + 191E5FD1290A651D001A3B7C /* jsmn.h */, + 191E5FD0290A651D001A3B7C /* jsmn.c */, + 191E5FCF290A651D001A3B7C /* jplist.c */, BFD52BEA22A1A9CA000B7ED1 /* bplist.c */, BFD52BF522A1A9CA000B7ED1 /* bytearray.c */, BFD52BFA22A1A9CB000B7ED1 /* bytearray.h */, @@ -1481,16 +1612,6 @@ path = Plugin; sourceTree = ""; }; - BFC51D7922972F1F00388324 /* Server */ = { - isa = PBXGroup; - children = ( - BFD52BD322A0800A000B7ED1 /* ServerManager.swift */, - BF770E5522BC3C02002A40FE /* Server.swift */, - BFA8172823C56042001B5953 /* ServerConnection.swift */, - ); - path = Server; - sourceTree = ""; - }; BFC84A4B2421A13000853474 /* Sources */ = { isa = PBXGroup; children = ( @@ -1529,6 +1650,8 @@ BF18BFE824857D7900DD5981 /* AltDaemon */, BF98916C250AABF3002ACF50 /* AltWidget */, BFF7C905257844C900E55F36 /* AltXPC */, + 19104DB32909C06D00C49C7B /* EmotionalDamage */, + 191E5FAC290A5D92001A3B7C /* minimuxer */, BFD247852284BB3300981D42 /* Frameworks */, B3146EC6284F580500BBC3FD /* Roxas.xcodeproj */, BFD2476B2284B9A500981D42 /* Products */, @@ -1547,6 +1670,8 @@ BF66EE7E2501AE50007EE018 /* AltStoreCore.framework */, BF989167250AABF3002ACF50 /* AltWidgetExtension.appex */, BFF7C904257844C900E55F36 /* AltXPC.xpc */, + 19104DB22909C06C00C49C7B /* libEmotionalDamage.a */, + 191E5FAB290A5D92001A3B7C /* libminimuxer.a */, ); name = Products; sourceTree = ""; @@ -1569,7 +1694,6 @@ BFD2478A2284C49000981D42 /* Managing Apps */, BF56D2AD23DF9E170006506D /* App IDs */, BFC84A4B2421A13000853474 /* Sources */, - BFC51D7922972F1F00388324 /* Server */, BF0DCA642433BDE200E3A595 /* Analytics */, BFF00D2E2501BD4B00746320 /* Intents */, BFDB6A0922AAEDA1007EA6D6 /* Operations */, @@ -1586,6 +1710,8 @@ BFD247852284BB3300981D42 /* Frameworks */ = { isa = PBXGroup; children = ( + 191E5FB5290A5E1F001A3B7C /* libminimuxer.a */, + 19104DA32909BC1000C49C7B /* libem_proxy.a */, B39575F4284F29E20080B4FF /* Roxas.framework */, D533E8B62727841800A9B5DD /* libAppleArchive.tbd */, BF580497246A3D19008AE704 /* UIKit.framework */, @@ -1700,7 +1826,6 @@ BF770E5722BC3D0F002A40FE /* RefreshGroup.swift */, BF770E5322BC044E002A40FE /* OperationContexts.swift */, BFE6326B22A86FF300F30809 /* AuthenticationOperation.swift */, - BFB364592325985F00CD0EB1 /* FindServerOperation.swift */, BFC1F38C22AEE3A4003AC21A /* DownloadAppOperation.swift */, BFDB6A0722AAED73007EA6D6 /* ResignAppOperation.swift */, BF3BEFBE2408673400DE7D55 /* FetchProvisioningProfilesOperation.swift */, @@ -1813,6 +1938,13 @@ /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ + 191E5FD4290A6EE0001A3B7C /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; BF4587272298D31600BD7491 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -1835,7 +1967,6 @@ BF45881F2298D3AB00BD7491 /* device_link_service.h in Headers */, BFD52C1A22A1A9CB000B7ED1 /* time64_limits.h in Headers */, BF45880E2298D3AB00BD7491 /* debugserver.h in Headers */, - BF45884B2298D55000BD7491 /* thread.h in Headers */, BF4588102298D3AB00BD7491 /* heartbeat.h in Headers */, BF4587FA2298D3AB00BD7491 /* diagnostics_relay.h in Headers */, BFD52C1622A1A9CB000B7ED1 /* bytearray.h in Headers */, @@ -1876,6 +2007,41 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ + 19104DB12909C06C00C49C7B /* EmotionalDamage */ = { + isa = PBXNativeTarget; + buildConfigurationList = 19104DB62909C06D00C49C7B /* Build configuration list for PBXNativeTarget "EmotionalDamage" */; + buildPhases = ( + 19104DAE2909C06C00C49C7B /* Sources */, + 19104DAF2909C06C00C49C7B /* Frameworks */, + 19104DB02909C06C00C49C7B /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = EmotionalDamage; + productName = EmotionalDamage; + productReference = 19104DB22909C06C00C49C7B /* libEmotionalDamage.a */; + productType = "com.apple.product-type.library.static"; + }; + 191E5FAA290A5D92001A3B7C /* minimuxer */ = { + isa = PBXNativeTarget; + buildConfigurationList = 191E5FAF290A5D92001A3B7C /* Build configuration list for PBXNativeTarget "minimuxer" */; + buildPhases = ( + 191E5FD4290A6EE0001A3B7C /* Headers */, + 191E5FA7290A5D92001A3B7C /* Sources */, + 191E5FA8290A5D92001A3B7C /* Frameworks */, + 191E5FA9290A5D92001A3B7C /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = minimuxer; + productName = minimuxer; + productReference = 191E5FAB290A5D92001A3B7C /* libminimuxer.a */; + productType = "com.apple.product-type.library.static"; + }; BF18BFE624857D7900DD5981 /* AltDaemon */ = { isa = PBXNativeTarget; buildConfigurationList = BF18BFEB24857D7900DD5981 /* Build configuration list for PBXNativeTarget "AltDaemon" */; @@ -1931,8 +2097,12 @@ buildRules = ( ); dependencies = ( + 191E5FDA290AFA49001A3B7C /* PBXTargetDependency */, ); name = libimobiledevice; + packageProductDependencies = ( + 191E5FDB290AFA5C001A3B7C /* OpenSSL */, + ); productName = libimobiledevice; productReference = BF45872B2298D31600BD7491 /* libimobiledevice.a */; productType = "com.apple.product-type.library.static"; @@ -2025,6 +2195,9 @@ buildRules = ( ); dependencies = ( + 191E5FB3290A5D9B001A3B7C /* PBXTargetDependency */, + 19104DBA2909C0F200C49C7B /* PBXTargetDependency */, + 19104D942909BADB00C49C7B /* PBXTargetDependency */, BF66EE842501AE50007EE018 /* PBXTargetDependency */, BF989176250AABF4002ACF50 /* PBXTargetDependency */, ); @@ -2062,10 +2235,16 @@ BFD247622284B9A500981D42 /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 1200; + LastSwiftUpdateCheck = 1400; LastUpgradeCheck = 1020; ORGANIZATIONNAME = "Riley Testut"; TargetAttributes = { + 19104DB12909C06C00C49C7B = { + CreatedOnToolsVersion = 14.0; + }; + 191E5FAA290A5D92001A3B7C = { + CreatedOnToolsVersion = 14.0; + }; BF18BFE624857D7900DD5981 = { CreatedOnToolsVersion = 11.5; LastSwiftMigration = 1150; @@ -2155,6 +2334,8 @@ BF66EE7D2501AE50007EE018 /* AltStoreCore */, BF989166250AABF3002ACF50 /* AltWidgetExtension */, BFF7C903257844C900E55F36 /* AltXPC */, + 19104DB12909C06C00C49C7B /* EmotionalDamage */, + 191E5FAA290A5D92001A3B7C /* minimuxer */, ); }; /* End PBXProject section */ @@ -2258,6 +2439,22 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 19104DAE2909C06C00C49C7B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 19104DB52909C06D00C49C7B /* EmotionalDamage.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 191E5FA7290A5D92001A3B7C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 191E5FAE290A5D92001A3B7C /* minimuxer.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; BF18BFE324857D7900DD5981 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -2328,14 +2525,25 @@ BFD52C0622A1A9CB000B7ED1 /* bplist.c in Sources */, BF4588232298D3AB00BD7491 /* mobilesync.c in Sources */, BF4588072298D3AB00BD7491 /* afc.c in Sources */, + 191E6066290B2DB1001A3B7C /* cbuf.c in Sources */, + 191E607D290B2EA5001A3B7C /* jsmn.c in Sources */, + 191E6067290B2DB3001A3B7C /* collection.c in Sources */, + 191E6075290B2E46001A3B7C /* companion_proxy.c in Sources */, + 191E607E290B2EA7001A3B7C /* jplist.c in Sources */, + 191E6076290B2E48001A3B7C /* preboard.c in Sources */, BF4588082298D3AB00BD7491 /* mobile_image_mounter.c in Sources */, + 191E6068290B2DB5001A3B7C /* glue.c in Sources */, BFD52C1122A1A9CB000B7ED1 /* bytearray.c in Sources */, BF4588022298D3AB00BD7491 /* file_relay.c in Sources */, + 191E6069290B2DB7001A3B7C /* opack.c in Sources */, + 191E606A290B2DC4001A3B7C /* socket.c in Sources */, + 191E606E290B2DCB001A3B7C /* utils.c in Sources */, + 191E606B290B2DC6001A3B7C /* termcolors.c in Sources */, + 191E606C290B2DC8001A3B7C /* thread.c in Sources */, + 191E606D290B2DCA001A3B7C /* tlv.c in Sources */, BF45880F2298D3AB00BD7491 /* debugserver.c in Sources */, BF4588162298D3AB00BD7491 /* restore.c in Sources */, BFD52C0422A1A9CB000B7ED1 /* Dictionary.cpp in Sources */, - BF4588412298D3F800BD7491 /* collection.c in Sources */, - BF4588372298D3C100BD7491 /* utils.c in Sources */, BFD52C0222A1A9CB000B7ED1 /* base64.c in Sources */, BFD52C2022A1A9EC000B7ED1 /* node.c in Sources */, BF4588092298D3AB00BD7491 /* installation_proxy.c in Sources */, @@ -2353,7 +2561,6 @@ BFD52C1322A1A9CB000B7ED1 /* Data.cpp in Sources */, BF45883A2298D3C100BD7491 /* debug.c in Sources */, BFD52C0F22A1A9CB000B7ED1 /* Real.cpp in Sources */, - BF45884A2298D55000BD7491 /* thread.c in Sources */, BF4587FB2298D3AB00BD7491 /* notification_proxy.c in Sources */, BF4588352298D3C100BD7491 /* userpref.c in Sources */, BFD52C0122A1A9CB000B7ED1 /* ptrarray.c in Sources */, @@ -2364,7 +2571,6 @@ BF4588242298D3AB00BD7491 /* property_list_service.c in Sources */, BF45881E2298D3AB00BD7491 /* misagent.c in Sources */, BF4587FC2298D3AB00BD7491 /* sbservices.c in Sources */, - BF4588392298D3C100BD7491 /* socket.c in Sources */, BFD52C1522A1A9CB000B7ED1 /* Node.cpp in Sources */, BF4588142298D3AB00BD7491 /* device_link_service.c in Sources */, BF4588172298D3AB00BD7491 /* screenshotr.c in Sources */, @@ -2541,7 +2747,6 @@ BF08858322DE795100DE9F1E /* MyAppsViewController.swift in Sources */, BFC84A4D2421A19100853474 /* SourcesViewController.swift in Sources */, BFF0B696232242D3007A79E1 /* LicensesViewController.swift in Sources */, - BFD52BD422A0800A000B7ED1 /* ServerManager.swift in Sources */, BFBE0007250AD0E70080826E /* ViewAppIntentHandler.swift in Sources */, BFDB6A0822AAED73007EA6D6 /* ResignAppOperation.swift in Sources */, D593F1942717749A006E82DE /* PatchAppOperation.swift in Sources */, @@ -2565,12 +2770,9 @@ BF663C4F2433ED8200DAA738 /* FileManager+DirectorySize.swift in Sources */, D57DF63F271E51E400677701 /* ALTAppPatcher.m in Sources */, BFB6B220231870B00022A802 /* NewsCollectionViewCell.swift in Sources */, - BFB3645A2325985F00CD0EB1 /* FindServerOperation.swift in Sources */, BF3BEFBF2408673400DE7D55 /* FetchProvisioningProfilesOperation.swift in Sources */, BFF0B69023219C6D007A79E1 /* PatreonComponents.swift in Sources */, BFBE0004250ACFFB0080826E /* ViewApp.intentdefinition in Sources */, - BF770E5622BC3C03002A40FE /* Server.swift in Sources */, - BFA8172923C56042001B5953 /* ServerConnection.swift in Sources */, BF56D2AF23DF9E310006506D /* AppIDsViewController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -2589,6 +2791,25 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 19104D942909BADB00C49C7B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = BF45872A2298D31600BD7491 /* libimobiledevice */; + targetProxy = 19104D932909BADB00C49C7B /* PBXContainerItemProxy */; + }; + 19104DBA2909C0F200C49C7B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 19104DB12909C06C00C49C7B /* EmotionalDamage */; + targetProxy = 19104DB92909C0F200C49C7B /* PBXContainerItemProxy */; + }; + 191E5FB3290A5D9B001A3B7C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 191E5FAA290A5D92001A3B7C /* minimuxer */; + targetProxy = 191E5FB2290A5D9B001A3B7C /* PBXContainerItemProxy */; + }; + 191E5FDA290AFA49001A3B7C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + productRef = 191E5FD9290AFA49001A3B7C /* OpenSSL */; + }; BF4588452298D48B00BD7491 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = BF45872A2298D31600BD7491 /* libimobiledevice */; @@ -2652,6 +2873,108 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ + 19104DB72909C06D00C49C7B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CODE_SIGN_STYLE = Automatic; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = 4FW3Q8784L; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Dependencies/em_proxy/target/aarch64-apple-ios/release", + "$(PROJECT_DIR)/Dependencies/em_proxy/target/aarch64-apple-ios/debug", + ); + MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)"; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OBJC_BRIDGING_HEADER = Dependencies/em_proxy/em_proxy.h; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TVOS_DEPLOYMENT_TARGET = 14.0; + WATCHOS_DEPLOYMENT_TARGET = 7.0; + }; + name = Debug; + }; + 19104DB82909C06D00C49C7B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 4FW3Q8784L; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Dependencies/em_proxy/target/aarch64-apple-ios/release", + "$(PROJECT_DIR)/Dependencies/em_proxy/target/aarch64-apple-ios/debug", + ); + MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)"; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_OBJC_BRIDGING_HEADER = Dependencies/em_proxy/em_proxy.h; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TVOS_DEPLOYMENT_TARGET = 14.0; + WATCHOS_DEPLOYMENT_TARGET = 7.0; + }; + name = Release; + }; + 191E5FB0290A5D92001A3B7C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CODE_SIGN_STYLE = Automatic; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = 4FW3Q8784L; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Dependencies/minimuxer/target/aarch64-apple-ios/release", + "$(PROJECT_DIR)/Dependencies/minimuxer/target/aarch64-apple-ios/debug", + ); + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OBJC_BRIDGING_HEADER = Dependencies/minimuxer/minimuxer.h; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 191E5FB1290A5D92001A3B7C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 4FW3Q8784L; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Dependencies/minimuxer/target/aarch64-apple-ios/release", + "$(PROJECT_DIR)/Dependencies/minimuxer/target/aarch64-apple-ios/debug", + ); + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_OBJC_BRIDGING_HEADER = Dependencies/minimuxer/minimuxer.h; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; BF18BFEC24857D7900DD5981 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -2854,6 +3177,7 @@ HAVE_ASPRINTF, "\"PACKAGE_STRING=\\\"AltServer 1.0\\\"\"", HAVE_GETIFADDRS, + HAVE_STRNDUP, ); GCC_WARN_INHIBIT_ALL_WARNINGS = YES; HEADER_SEARCH_PATHS = ( @@ -2866,6 +3190,7 @@ "\"$(SRCROOT)/Dependencies/libplist/libcnary/include\"", "\"${SDKROOT}/usr/include/libxml2\"", "\"$(SRCROOT)/Dependencies/AltSign/Dependencies/libzip/xcode\"", + "\"$(SRCROOT)/Dependencies/libimobiledevice-glue/include\"/**", ); MACOSX_DEPLOYMENT_TARGET = 10.14; PRODUCT_NAME = imobiledevice; @@ -2892,6 +3217,7 @@ HAVE_ASPRINTF, "\"PACKAGE_STRING=\\\"AltServer 1.0\\\"\"", HAVE_GETIFADDRS, + HAVE_STRNDUP, ); GCC_WARN_INHIBIT_ALL_WARNINGS = YES; HEADER_SEARCH_PATHS = ( @@ -2904,6 +3230,7 @@ "\"$(SRCROOT)/Dependencies/libplist/libcnary/include\"", "\"${SDKROOT}/usr/include/libxml2\"", "\"$(SRCROOT)/Dependencies/AltSign/Dependencies/libzip/xcode\"", + "\"$(SRCROOT)/Dependencies/libimobiledevice-glue/include\"/**", ); MACOSX_DEPLOYMENT_TARGET = 10.14; PRODUCT_NAME = imobiledevice; @@ -3302,6 +3629,8 @@ "$(inherited)", "$(PROJECT_DIR)/Dependencies/fragmentzip", "$(PROJECT_DIR)/Dependencies/libcurl", + "$(PROJECT_DIR)/Dependencies/minimuxer/target/aarch64-apple-ios/debug", + "$(PROJECT_DIR)/Dependencies/minimuxer/target/aarch64-apple-ios/release", ); MARKETING_VERSION = 1.5.1b; PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER)"; @@ -3337,6 +3666,8 @@ "$(inherited)", "$(PROJECT_DIR)/Dependencies/fragmentzip", "$(PROJECT_DIR)/Dependencies/libcurl", + "$(PROJECT_DIR)/Dependencies/minimuxer/target/aarch64-apple-ios/debug", + "$(PROJECT_DIR)/Dependencies/minimuxer/target/aarch64-apple-ios/release", ); MARKETING_VERSION = 1.5.1b; PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER)"; @@ -3412,6 +3743,24 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 19104DB62909C06D00C49C7B /* Build configuration list for PBXNativeTarget "EmotionalDamage" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 19104DB72909C06D00C49C7B /* Debug */, + 19104DB82909C06D00C49C7B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 191E5FAF290A5D92001A3B7C /* Build configuration list for PBXNativeTarget "minimuxer" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 191E5FB0290A5D92001A3B7C /* Debug */, + 191E5FB1290A5D92001A3B7C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; BF18BFEB24857D7900DD5981 /* Build configuration list for PBXNativeTarget "AltDaemon" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -3572,6 +3921,16 @@ /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ + 191E5FD9290AFA49001A3B7C /* OpenSSL */ = { + isa = XCSwiftPackageProductDependency; + package = 4879A9602861049C00FC1BBD /* XCRemoteSwiftPackageReference "OpenSSL" */; + productName = OpenSSL; + }; + 191E5FDB290AFA5C001A3B7C /* OpenSSL */ = { + isa = XCSwiftPackageProductDependency; + package = 4879A9602861049C00FC1BBD /* XCRemoteSwiftPackageReference "OpenSSL" */; + productName = OpenSSL; + }; 4879A95E2861046500FC1BBD /* AltSign */ = { isa = XCSwiftPackageProductDependency; package = 4879A95D2861046500FC1BBD /* XCRemoteSwiftPackageReference "AltSign" */; diff --git a/AltStore/AppDelegate.swift b/AltStore/AppDelegate.swift index 1e5f2dcb..7fc07b1e 100644 --- a/AltStore/AppDelegate.swift +++ b/AltStore/AppDelegate.swift @@ -14,6 +14,7 @@ import Intents import AltStoreCore import AltSign import Roxas +import EmotionalDamage extension AppDelegate { @@ -75,8 +76,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate { self.setTintColor() - ServerManager.shared.startDiscovering() - SecureValueTransformer.register() if UserDefaults.standard.firstLaunch == nil @@ -95,18 +94,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate { return true } - + func applicationDidEnterBackground(_ application: UIApplication) - { - ServerManager.shared.stopDiscovering() - } + { + + } func applicationWillEnterForeground(_ application: UIApplication) { AppManager.shared.update() - ServerManager.shared.startDiscovering() - - PatreonAPI.shared.refreshPatreonAccount() + start_em_proxy(bind_addr: "127.0.0.1:51820") } func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any]) -> Bool diff --git a/AltStore/Info.plist b/AltStore/Info.plist index dc8c42d5..c601a7e8 100644 --- a/AltStore/Info.plist +++ b/AltStore/Info.plist @@ -11,6 +11,8 @@ 00008101-000129D63698001E ALTServerID 1F7D5B55-79CE-4546-A029-D4DDC4AF3B6D + ALTPairingFile + <insert pairing file here> CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDocumentTypes diff --git a/AltStore/LaunchViewController.swift b/AltStore/LaunchViewController.swift index ff3330c9..fbd98848 100644 --- a/AltStore/LaunchViewController.swift +++ b/AltStore/LaunchViewController.swift @@ -8,6 +8,8 @@ import UIKit import Roxas +import EmotionalDamage +import minimuxer import AltStoreCore @@ -36,6 +38,12 @@ class LaunchViewController: RSTLaunchViewController override func viewDidLoad() { super.viewDidLoad() + start_em_proxy(bind_addr: "127.0.0.1:51820") + + let pf = Bundle.main.object(forInfoDictionaryKey: "ALTPairingFile") as? String + set_usbmuxd_socket() + start_minimuxer(pairing_file: pf.unsafelyUnwrapped) + auto_mount_dev_image() // Create destinationViewController now so view controllers can register for receiving Notifications. self.destinationViewController = self.storyboard!.instantiateViewController(withIdentifier: "tabBarController") as! TabBarController diff --git a/AltStore/Managing Apps/AppManager.swift b/AltStore/Managing Apps/AppManager.swift index a440824a..8bc9a16c 100644 --- a/AltStore/Managing Apps/AppManager.swift +++ b/AltStore/Managing Apps/AppManager.swift @@ -217,23 +217,6 @@ extension AppManager } } - @discardableResult - func findServer(context: OperationContext = OperationContext(), completionHandler: @escaping (Result) -> Void) -> FindServerOperation - { - let findServerOperation = FindServerOperation(context: context) - findServerOperation.resultHandler = { (result) in - switch result - { - case .failure(let error): context.error = error - case .success(let server): context.server = server - } - } - - self.run([findServerOperation], context: context) - - return findServerOperation - } - @discardableResult func authenticate(presentingViewController: UIViewController?, context: AuthenticatedOperationContext = AuthenticatedOperationContext(), completionHandler: @escaping (Result<(ALTTeam, ALTCertificate, ALTAppleAPISession), Error>) -> Void) -> AuthenticationOperation { @@ -242,8 +225,6 @@ extension AppManager return operation } - let findServerOperation = self.findServer(context: context) { _ in } - let authenticationOperation = AuthenticationOperation(context: context, presentingViewController: presentingViewController) authenticationOperation.resultHandler = { (result) in switch result @@ -254,7 +235,6 @@ extension AppManager completionHandler(result) } - authenticationOperation.addDependency(findServerOperation) self.run([authenticationOperation], context: context) @@ -555,13 +535,10 @@ extension AppManager // authentication, so we keep it separate. let context = OperationContext() - let findServerOperation = self.findServer(context: context) { _ in } - let deactivateAppOperation = DeactivateAppOperation(app: installedApp, context: context) deactivateAppOperation.resultHandler = { (result) in completionHandler(result) } - deactivateAppOperation.addDependency(findServerOperation) self.run([deactivateAppOperation], context: context, requiresSerialQueue: true) } @@ -695,13 +672,11 @@ extension AppManager let context = Context() context.installedApp = installedApp - let findServerOperation = self.findServer(context: context) { _ in } let enableJITOperation = EnableJITOperation(context: context) enableJITOperation.resultHandler = { (result) in completionHandler(result) } - enableJITOperation.addDependency(findServerOperation) self.run([enableJITOperation], context: context, requiresSerialQueue: true) } @@ -747,7 +722,7 @@ extension AppManager switch result { case .failure(let error): context.error = error - case .success(let installationConnection): context.installationConnection = installationConnection + case .success(_): print("App sent over AFC") } } sendAppOperation.addDependency(patchAppOperation) @@ -900,8 +875,7 @@ private extension AppManager if app.certificateSerialNumber != group.context.certificate?.serialNumber || uti != nil || - app.needsResign || - (group.context.server?.connectionType == .local && !UserDefaults.standard.localServerSupportsRefreshing) + app.needsResign { // Resign app instead of just refreshing profiles because either: // * Refreshing using different certificate @@ -1147,7 +1121,7 @@ private extension AppManager presentingViewController?.dismiss(animated: true, completion: nil) } } - presentingViewController.present(navigationController, animated: true, completion: nil) + presentingViewController.present(navigationController, animated: true, completion: nil) } } catch @@ -1204,7 +1178,7 @@ private extension AppManager switch result { case .failure(let error): context.error = error - case .success(let installationConnection): context.installationConnection = installationConnection + case .success(_): print("App reported as installed") } } sendAppOperation.addDependency(resignAppOperation) @@ -1649,27 +1623,6 @@ private extension AppManager func finish(_ operation: AppOperation, result: Result, group: RefreshGroup, progress: Progress?) { - let result = result.mapError { (resultError) -> Error in - guard let error = resultError as? ALTServerError else { return resultError } - - switch error.code - { - case .deviceNotFound, .lostConnection: - if let server = group.context.server, server.isPreferred || server.connectionType != .wireless - { - // Preferred server (or not random wireless connection), so report errors normally. - return error - } - else - { - // Not preferred server, so ignore these specific errors and throw serverNotFound instead. - return ConnectionError.serverNotFound - } - - default: return error - } - } - // Must remove before saving installedApp. if let currentProgress = self.progress(for: operation), currentProgress == progress { @@ -1709,7 +1662,7 @@ private extension AppManager } if #available(iOS 14, *) - { + { WidgetCenter.shared.getCurrentConfigurations { (result) in guard case .success(let widgets) = result else { return } diff --git a/AltStore/Operations/BackgroundRefreshAppsOperation.swift b/AltStore/Operations/BackgroundRefreshAppsOperation.swift index ee8eb0de..e26cf8ef 100644 --- a/AltStore/Operations/BackgroundRefreshAppsOperation.swift +++ b/AltStore/Operations/BackgroundRefreshAppsOperation.swift @@ -10,6 +10,7 @@ import UIKit import CoreData import AltStoreCore +import EmotionalDamage enum RefreshError: LocalizedError { @@ -80,10 +81,11 @@ class BackgroundRefreshAppsOperation: ResultOperation<[String: Result @@ -36,54 +37,27 @@ class DeactivateAppOperation: ResultOperation return } - guard let server = self.context.server else { return self.finish(.failure(OperationError.invalidParameters)) } - guard let udid = Bundle.main.object(forInfoDictionaryKey: Bundle.Info.deviceID) as? String else { return self.finish(.failure(OperationError.unknownUDID)) } - - ServerManager.shared.connect(to: server) { (result) in - switch result - { - case .failure(let error): self.finish(.failure(error)) - case .success(let connection): - print("Sending deactivate app request...") - - DatabaseManager.shared.persistentContainer.performBackgroundTask { (context) in - let installedApp = context.object(with: self.app.objectID) as! InstalledApp - - let appExtensionProfiles = installedApp.appExtensions.map { $0.resignedBundleIdentifier } - let allIdentifiers = [installedApp.resignedBundleIdentifier] + appExtensionProfiles - - let request = RemoveProvisioningProfilesRequest(udid: udid, bundleIdentifiers: Set(allIdentifiers)) - connection.send(request) { (result) in - print("Sent deactive app request!") - - switch result - { - case .failure(let error): self.finish(.failure(error)) - case .success: - print("Waiting for deactivate app response...") - connection.receiveResponse() { (result) in - print("Receiving deactivate app response:", result) - - switch result - { - case .failure(let error): self.finish(.failure(error)) - case .success(.error(let response)): self.finish(.failure(response.error)) - case .success(.removeProvisioningProfiles): - DatabaseManager.shared.persistentContainer.performBackgroundTask { (context) in - self.progress.completedUnitCount += 1 - - let installedApp = context.object(with: self.app.objectID) as! InstalledApp - installedApp.isActive = false - self.finish(.success(installedApp)) - } - - case .success: self.finish(.failure(ALTServerError(.unknownResponse))) - } - } - } + DatabaseManager.shared.persistentContainer.performBackgroundTask { (context) in + let installedApp = context.object(with: self.app.objectID) as! InstalledApp + let appExtensionProfiles = installedApp.appExtensions.map { $0.resignedBundleIdentifier } + let allIdentifiers = [installedApp.resignedBundleIdentifier] + appExtensionProfiles + + for profile in allIdentifiers { + do { + let res = try remove_provisioning_profile(id: profile) + if case Uhoh.Bad(let code) = res { + self.finish(.failure(minimuxer_to_operation(code: code))) } + } catch Uhoh.Bad(let code) { + self.finish(.failure(minimuxer_to_operation(code: code))) + } catch { + self.finish(.failure(ALTServerError(.unknownResponse))) } } + + self.progress.completedUnitCount += 1 + installedApp.isActive = false + self.finish(.success(installedApp)) } } } diff --git a/AltStore/Operations/EnableJITOperation.swift b/AltStore/Operations/EnableJITOperation.swift index 9aa5ebee..da4da7da 100644 --- a/AltStore/Operations/EnableJITOperation.swift +++ b/AltStore/Operations/EnableJITOperation.swift @@ -8,13 +8,13 @@ import UIKit import Combine +import minimuxer import AltStoreCore @available(iOS 14, *) protocol EnableJITContext { - var server: Server? { get } var installedApp: InstalledApp? { get } var error: Error? { get } @@ -42,95 +42,26 @@ class EnableJITOperation: ResultOperation return } - guard let server = self.context.server, let installedApp = self.context.installedApp else { return self.finish(.failure(OperationError.invalidParameters)) } - guard let udid = Bundle.main.object(forInfoDictionaryKey: Bundle.Info.deviceID) as? String else { return self.finish(.failure(OperationError.unknownUDID)) } + guard let installedApp = self.context.installedApp else { return self.finish(.failure(OperationError.invalidParameters)) } installedApp.managedObjectContext?.perform { - guard let bundle = Bundle(url: installedApp.fileURL), - let processName = bundle.executableURL?.lastPathComponent - else { return self.finish(.failure(OperationError.invalidApp)) } - - let appName = installedApp.name - let openAppURL = installedApp.openAppURL - - ServerManager.shared.connect(to: server) { result in - switch result - { - case .failure(let error): self.finish(.failure(error)) - case .success(let connection): - print("Sending enable JIT request...") - - DispatchQueue.main.async { + let v = minimuxer_to_operation(code: 1) - // Launch app to make sure it is running in foreground. - UIApplication.shared.open(openAppURL) { success in - guard success else { return self.finish(.failure(OperationError.openAppFailed(name: appName))) } - - // Combine immediately finishes if an error is thrown, but we want to wait at least until app enters background. - // As a workaround, we set error type to Never and use Result as the value type instead. - let result = Future, Never> { promise in - let request = EnableUnsignedCodeExecutionRequest(udid: udid, processName: processName) - connection.send(request) { result in - print("Sent enable JIT request!") - - switch result - { - case .failure(let error): promise(.success(.failure(error))) - case .success: - print("Waiting for enable JIT response...") - connection.receiveResponse() { result in - print("Received enable JIT response:", result) - - switch result - { - case .failure(let error): promise(.success(.failure(error))) - case .success(.error(let response)): promise(.success(.failure(response.error))) - case .success(.enableUnsignedCodeExecution): promise(.success(.success(()))) - case .success: promise(.success(.failure(ALTServerError(.unknownResponse)))) - } - } - } - } - } - - //TODO: Handle case where app does not enter background (e.g. iPad multitasking). - self.cancellable = result - .combineLatest(NotificationCenter.default.publisher(for: UIApplication.didEnterBackgroundNotification, object: nil)) - .first() - .receive(on: DispatchQueue.main) - .sink { (result, _) in - let content = UNMutableNotificationContent() - - switch result - { - case .failure(let error): - content.title = String(format: NSLocalizedString("Could not enable JIT for %@", comment: ""), appName) - content.body = error.localizedDescription - - UIDevice.current.vibrate(pattern: .error) - - case .success: - content.title = String(format: NSLocalizedString("Enabled JIT for %@", comment: ""), appName) - content.body = String(format: NSLocalizedString("JIT will remain enabled until you quit the app.", comment: "")) - - UIDevice.current.vibrate(pattern: .success) - } - - if UIApplication.shared.applicationState == .background - { - // For some reason, notification won't show up reliably unless we provide a trigger (as of iOS 15). - let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 0.1, repeats: false) - - let request = UNNotificationRequest(identifier: AppManager.enableJITResultNotificationID, content: content, trigger: trigger) - UNUserNotificationCenter.current().add(request) - } - - self.finish(result) - } - } - } + do { + var x = try debug_app(app_id: installedApp.resignedBundleIdentifier) + switch x { + case .Good: + self.finish(.success(())) + case .Bad(let code): + self.finish(.failure(minimuxer_to_operation(code: code))) } + } catch Uhoh.Bad(let code) { + self.finish(.failure(minimuxer_to_operation(code: code))) + } catch { + self.finish(.failure(OperationError.unknown)) } + + } } } diff --git a/AltStore/Operations/FindServerOperation.swift b/AltStore/Operations/FindServerOperation.swift deleted file mode 100644 index 35d8727d..00000000 --- a/AltStore/Operations/FindServerOperation.swift +++ /dev/null @@ -1,131 +0,0 @@ -// -// FindServerOperation.swift -// AltStore -// -// Created by Riley Testut on 9/8/19. -// Copyright © 2019 Riley Testut. All rights reserved. -// - -import Foundation - -import AltStoreCore -import Roxas - -private let ReceivedServerConnectionResponse: @convention(c) (CFNotificationCenter?, UnsafeMutableRawPointer?, CFNotificationName?, UnsafeRawPointer?, CFDictionary?) -> Void = -{ (center, observer, name, object, userInfo) in - guard let name = name, let observer = observer else { return } - - let operation = unsafeBitCast(observer, to: FindServerOperation.self) - operation.handle(name) -} - -@objc(FindServerOperation) -class FindServerOperation: ResultOperation -{ - let context: OperationContext - - private var isWiredServerConnectionAvailable = false - private var localServerMachServiceName: String? - - init(context: OperationContext = OperationContext()) - { - self.context = context - } - - override func main() - { - super.main() - - if let error = self.context.error - { - self.finish(.failure(error)) - return - } - - if let server = self.context.server - { - self.finish(.success(server)) - return - } - - let notificationCenter = CFNotificationCenterGetDarwinNotifyCenter() - let observer = Unmanaged.passUnretained(self).toOpaque() - - // Prepare observers to receive callback from wired connection or background daemon (if available). - CFNotificationCenterAddObserver(notificationCenter, observer, ReceivedServerConnectionResponse, CFNotificationName.wiredServerConnectionAvailableResponse.rawValue, nil, .deliverImmediately) - - // Post notifications. - CFNotificationCenterPostNotification(notificationCenter, .wiredServerConnectionAvailableRequest, nil, nil, true) - - self.discoverLocalServer() - - // Wait for either callback or timeout. - DispatchQueue.global().asyncAfter(deadline: .now() + 1.0) { - if let machServiceName = self.localServerMachServiceName - { - // Prefer background daemon, if it exists and is running. - let server = Server(connectionType: .local, machServiceName: machServiceName) - self.finish(.success(server)) - } - else if self.isWiredServerConnectionAvailable - { - let server = Server(connectionType: .wired) - self.finish(.success(server)) - } - else if let server = ServerManager.shared.discoveredServers.first(where: { $0.isPreferred }) - { - // Preferred server. - self.finish(.success(server)) - } - else if let server = ServerManager.shared.discoveredServers.first - { - // Any available server. - self.finish(.success(server)) - } - else - { - // No servers. - self.finish(.failure(ConnectionError.serverNotFound)) - } - } - } - - override func finish(_ result: Result) - { - super.finish(result) - - let notificationCenter = CFNotificationCenterGetDarwinNotifyCenter() - let observer = Unmanaged.passUnretained(self).toOpaque() - - CFNotificationCenterRemoveObserver(notificationCenter, observer, .wiredServerConnectionAvailableResponse, nil) - } -} - -fileprivate extension FindServerOperation -{ - func discoverLocalServer() - { - for machServiceName in XPCConnection.machServiceNames - { - let xpcConnection = NSXPCConnection.makeConnection(machServiceName: machServiceName) - - let connection = XPCConnection(xpcConnection) - connection.connect { (result) in - switch result - { - case .failure(let error): print("Could not connect to AltDaemon XPC service \(machServiceName).", error) - case .success: self.localServerMachServiceName = machServiceName - } - } - } - } - - func handle(_ notification: CFNotificationName) - { - switch notification - { - case .wiredServerConnectionAvailableResponse: self.isWiredServerConnectionAvailable = true - default: break - } - } -} diff --git a/AltStore/Operations/InstallAppOperation.swift b/AltStore/Operations/InstallAppOperation.swift index 520c5c2a..c8b406a3 100644 --- a/AltStore/Operations/InstallAppOperation.swift +++ b/AltStore/Operations/InstallAppOperation.swift @@ -5,7 +5,6 @@ // Created by Riley Testut on 6/19/19. // Copyright © 2019 Riley Testut. All rights reserved. // - import Foundation import Network @@ -41,8 +40,7 @@ class InstallAppOperation: ResultOperation guard let certificate = self.context.certificate, - let resignedApp = self.context.resignedApp, - let connection = self.context.installationConnection + let resignedApp = self.context.resignedApp else { return self.finish(.failure(OperationError.invalidParameters)) } let backgroundContext = DatabaseManager.shared.persistentContainer.newBackgroundContext() @@ -145,27 +143,16 @@ class InstallAppOperation: ResultOperation }) } - let request = BeginInstallationRequest(activeProfiles: activeProfiles, bundleIdentifier: installedApp.resignedBundleIdentifier) - connection.send(request) { (result) in - switch result - { - case .failure(let error): self.finish(.failure(error)) - case .success: - - self.receive(from: connection) { (result) in - switch result - { - case .success: - backgroundContext.perform { - installedApp.refreshedDate = Date() - self.finish(.success(installedApp)) - } - - case .failure(let error): - self.finish(.failure(error)) - } - } - } + let ns_bundle = NSString(string: installedApp.bundleIdentifier) + let ns_bundle_ptr = UnsafeMutablePointer(mutating: ns_bundle.utf8String) + + let res = minimuxer_install_ipa(ns_bundle_ptr) + if res == 0 { + installedApp.refreshedDate = Date() + self.finish(.success(installedApp)) + + } else { + self.finish(.failure(minimuxer_to_operation(code: res))) } } } @@ -195,42 +182,6 @@ class InstallAppOperation: ResultOperation private extension InstallAppOperation { - func receive(from connection: ServerConnection, completionHandler: @escaping (Result) -> Void) - { - connection.receiveResponse() { (result) in - do - { - let response = try result.get() - print(response) - - switch response - { - case .installationProgress(let response): - if response.progress == 1.0 - { - self.progress.completedUnitCount = self.progress.totalUnitCount - completionHandler(.success(())) - } - else - { - self.progress.completedUnitCount = Int64(response.progress * 100) - self.receive(from: connection, completionHandler: completionHandler) - } - - case .error(let response): - completionHandler(.failure(response.error)) - - default: - completionHandler(.failure(ALTServerError(.unknownRequest))) - } - } - catch - { - completionHandler(.failure(ALTServerError(error))) - } - } - } - func cleanUp() { guard !self.didCleanUp else { return } diff --git a/AltStore/Operations/OperationContexts.swift b/AltStore/Operations/OperationContexts.swift index d5b8e75f..e18361d6 100644 --- a/AltStore/Operations/OperationContexts.swift +++ b/AltStore/Operations/OperationContexts.swift @@ -15,16 +15,14 @@ import AltSign class OperationContext { - var server: Server? var error: Error? var presentingViewController: UIViewController? let operations: NSHashTable - init(server: Server? = nil, error: Error? = nil, operations: [Foundation.Operation] = []) + init(error: Error? = nil, operations: [Foundation.Operation] = []) { - self.server = server self.error = error self.operations = NSHashTable.weakObjects() @@ -36,7 +34,7 @@ class OperationContext convenience init(context: OperationContext) { - self.init(server: context.server, error: context.error, operations: context.operations.allObjects) + self.init(error: context.error, operations: context.operations.allObjects) } } @@ -51,7 +49,7 @@ class AuthenticatedOperationContext: OperationContext convenience init(context: AuthenticatedOperationContext) { - self.init(server: context.server, error: context.error, operations: context.operations.allObjects) + self.init(error: context.error, operations: context.operations.allObjects) self.session = context.session self.team = context.team @@ -105,7 +103,6 @@ class InstallAppOperationContext: AppOperationContext }() var resignedApp: ALTApplication? - var installationConnection: ServerConnection? var installedApp: InstalledApp? { didSet { self.installedAppContext = self.installedApp?.managedObjectContext diff --git a/AltStore/Operations/OperationError.swift b/AltStore/Operations/OperationError.swift index 497129d5..5bb038da 100644 --- a/AltStore/Operations/OperationError.swift +++ b/AltStore/Operations/OperationError.swift @@ -31,6 +31,19 @@ enum OperationError: LocalizedError case openAppFailed(name: String) case missingAppGroup + case noDevice + case createService(name: String) + case getFromDevice(name: String) + case setArgument(name: String) + case afc + case install + case uninstall + case lookupApps + case detach + case functionArguments + case profileInstall + case noConnection + var failureReason: String? { switch self { case .unknown: return NSLocalizedString("An unknown error occured.", comment: "") @@ -46,6 +59,18 @@ enum OperationError: LocalizedError case .openAppFailed(let name): return String(format: NSLocalizedString("AltStore was denied permission to launch %@.", comment: ""), name) case .missingAppGroup: return NSLocalizedString("AltStore's shared app group could not be found.", comment: "") case .maximumAppIDLimitReached: return NSLocalizedString("Cannot register more than 10 App IDs.", comment: "") + case .noDevice: return NSLocalizedString("Cannot fetch the device from the muxer", comment: "") + case .createService(let name): return String(format: NSLocalizedString("Cannot start a %@ server on the device.", comment: ""), name) + case .getFromDevice(let name): return String(format: NSLocalizedString("Cannot fetch %@ from the device.", comment: ""), name) + case .setArgument(let name): return String(format: NSLocalizedString("Cannot set %@ on the device.", comment: ""), name) + case .afc: return NSLocalizedString("AFC was unable to manage files on the device", comment: "") + case .install: return NSLocalizedString("Unable to install the app from the staging directory", comment: "") + case .uninstall: return NSLocalizedString("Unable to uninstall the app", comment: "") + case .lookupApps: return NSLocalizedString("Unable to fetch apps from the device", comment: "") + case .detach: return NSLocalizedString("Unable to detach from the app's process", comment: "") + case .functionArguments: return NSLocalizedString("A function was passed invalid arguments", comment: "") + case .profileInstall: return NSLocalizedString("Unable to manage profiles on the device", comment: "") + case .noConnection: return NSLocalizedString("Unable to connect to the device, make sure Wireguard is enabled and you're connected to WiFi", comment: "") } } @@ -90,3 +115,50 @@ enum OperationError: LocalizedError } } } + +func minimuxer_to_operation(code: Int32) -> OperationError { + switch code { + case -1: + return OperationError.noDevice + case -2: + return OperationError.createService(name: "debug") + case -3: + return OperationError.createService(name: "instproxy") + case -4: + return OperationError.getFromDevice(name: "installed apps") + case -5: + return OperationError.getFromDevice(name: "path to the app") + case -6: + return OperationError.getFromDevice(name: "bundle path") + case -7: + return OperationError.setArgument(name: "max packet") + case -8: + return OperationError.setArgument(name: "working directory") + case -9: + return OperationError.setArgument(name: "argv") + case -10: + return OperationError.getFromDevice(name: "launch success") + case -11: + return OperationError.detach + case -12: + return OperationError.functionArguments + case -13: + return OperationError.createService(name: "AFC") + case -14: + return OperationError.afc + case -15: + return OperationError.install + case -16: + return OperationError.uninstall + case -17: + return OperationError.createService(name: "misagent") + case -18: + return OperationError.profileInstall + case -19: + return OperationError.profileInstall + case -20: + return OperationError.noConnection + default: + return OperationError.unknown + } +} diff --git a/AltStore/Operations/RefreshAppOperation.swift b/AltStore/Operations/RefreshAppOperation.swift index 354f02f9..7da13306 100644 --- a/AltStore/Operations/RefreshAppOperation.swift +++ b/AltStore/Operations/RefreshAppOperation.swift @@ -11,6 +11,7 @@ import Foundation import AltStoreCore import AltSign import Roxas +import minimuxer @objc(RefreshAppOperation) class RefreshAppOperation: ResultOperation @@ -39,75 +40,37 @@ class RefreshAppOperation: ResultOperation throw error } - guard let server = self.context.server, let profiles = self.context.provisioningProfiles else { throw OperationError.invalidParameters } + guard let profiles = self.context.provisioningProfiles else { throw OperationError.invalidParameters } guard let app = self.context.app else { throw OperationError.appNotFound } - guard let udid = Bundle.main.object(forInfoDictionaryKey: Bundle.Info.deviceID) as? String else { throw OperationError.unknownUDID } - ServerManager.shared.connect(to: server) { (result) in - switch result - { - case .failure(let error): self.finish(.failure(error)) - case .success(let connection): - DatabaseManager.shared.persistentContainer.performBackgroundTask { (context) in - print("Sending refresh app request...") - - var activeProfiles: Set? - if UserDefaults.standard.activeAppsLimit != nil - { - // When installing these new profiles, AltServer will remove all non-active profiles to ensure we remain under limit. - let activeApps = InstalledApp.fetchActiveApps(in: context) - activeProfiles = Set(activeApps.flatMap { (installedApp) -> [String] in - let appExtensionProfiles = installedApp.appExtensions.map { $0.resignedBundleIdentifier } - return [installedApp.resignedBundleIdentifier] + appExtensionProfiles - }) + DatabaseManager.shared.persistentContainer.performBackgroundTask { (context) in + print("Sending refresh app request...") + + for p in profiles { + do { + let x = try install_provisioning_profile(plist: p.value.data) + if case .Bad(let code) = x { + self.finish(.failure(minimuxer_to_operation(code: code))) } - - let request = InstallProvisioningProfilesRequest(udid: udid, provisioningProfiles: Set(profiles.values), activeProfiles: activeProfiles) - connection.send(request) { (result) in - print("Sent refresh app request!") - - switch result - { - case .failure(let error): self.finish(.failure(error)) - case .success: - print("Waiting for refresh app response...") - connection.receiveResponse() { (result) in - print("Receiving refresh app response:", result) - - switch result - { - case .failure(let error): self.finish(.failure(error)) - case .success(.error(let response)): self.finish(.failure(response.error)) - - case .success(.installProvisioningProfiles): - self.managedObjectContext.perform { - let predicate = NSPredicate(format: "%K == %@", #keyPath(InstalledApp.bundleIdentifier), app.bundleIdentifier) - guard let installedApp = InstalledApp.first(satisfying: predicate, in: self.managedObjectContext) else { - return self.finish(.failure(OperationError.appNotFound)) - } - - self.progress.completedUnitCount += 1 - - if let provisioningProfile = profiles[app.bundleIdentifier] - { - installedApp.update(provisioningProfile: provisioningProfile) - } - - for installedExtension in installedApp.appExtensions - { - guard let provisioningProfile = profiles[installedExtension.bundleIdentifier] else { continue } - installedExtension.update(provisioningProfile: provisioningProfile) - } - - self.finish(.success(installedApp)) - } - - case .success: self.finish(.failure(ALTServerError(.unknownRequest))) - } - } - } + } catch Uhoh.Bad(let code) { + self.finish(.failure(minimuxer_to_operation(code: code))) + } catch { + self.finish(.failure(OperationError.unknown)) + } + self.progress.completedUnitCount += 1 + + let predicate = NSPredicate(format: "%K == %@", #keyPath(InstalledApp.bundleIdentifier), app.bundleIdentifier) + self.managedObjectContext.perform { + guard let installedApp = InstalledApp.first(satisfying: predicate, in: self.managedObjectContext) else { + return } + installedApp.update(provisioningProfile: p.value) + for installedExtension in installedApp.appExtensions { + guard let provisioningProfile = profiles[installedExtension.bundleIdentifier] else { continue } + installedExtension.update(provisioningProfile: provisioningProfile) + } + self.finish(.success(installedApp)) } } } diff --git a/AltStore/Operations/RemoveAppOperation.swift b/AltStore/Operations/RemoveAppOperation.swift index 4ba53f12..b7a4c150 100644 --- a/AltStore/Operations/RemoveAppOperation.swift +++ b/AltStore/Operations/RemoveAppOperation.swift @@ -9,6 +9,7 @@ import Foundation import AltStoreCore +import minimuxer @objc(RemoveAppOperation) class RemoveAppOperation: ResultOperation @@ -32,50 +33,27 @@ class RemoveAppOperation: ResultOperation return } - guard let server = self.context.server, let installedApp = self.context.installedApp else { return self.finish(.failure(OperationError.invalidParameters)) } - guard let udid = Bundle.main.object(forInfoDictionaryKey: Bundle.Info.deviceID) as? String else { return self.finish(.failure(OperationError.unknownUDID)) } + guard let installedApp = self.context.installedApp else { return self.finish(.failure(OperationError.invalidParameters)) } installedApp.managedObjectContext?.perform { let resignedBundleIdentifier = installedApp.resignedBundleIdentifier - ServerManager.shared.connect(to: server) { (result) in - switch result - { - case .failure(let error): self.finish(.failure(error)) - case .success(let connection): - print("Sending remove app request...") - - let request = RemoveAppRequest(udid: udid, bundleIdentifier: resignedBundleIdentifier) - connection.send(request) { (result) in - print("Sent remove app request!") - - switch result - { - case .failure(let error): self.finish(.failure(error)) - case .success: - print("Waiting for remove app response...") - connection.receiveResponse() { (result) in - print("Receiving remove app response:", result) - - switch result - { - case .failure(let error): self.finish(.failure(error)) - case .success(.error(let response)): self.finish(.failure(response.error)) - case .success(.removeApp): - DatabaseManager.shared.persistentContainer.performBackgroundTask { (context) in - self.progress.completedUnitCount += 1 - - let installedApp = context.object(with: installedApp.objectID) as! InstalledApp - installedApp.isActive = false - self.finish(.success(installedApp)) - } - - case .success: self.finish(.failure(ALTServerError(.unknownResponse))) - } - } - } - } + do { + let res = try remove_app(app_id: resignedBundleIdentifier) + if case Uhoh.Bad(let code) = res { + self.finish(.failure(minimuxer_to_operation(code: code))) } + } catch Uhoh.Bad(let code) { + self.finish(.failure(minimuxer_to_operation(code: code))) + } catch { + self.finish(.failure(ALTServerError(.appDeletionFailed))) + } + DatabaseManager.shared.persistentContainer.performBackgroundTask { (context) in + self.progress.completedUnitCount += 1 + + let installedApp = context.object(with: installedApp.objectID) as! InstalledApp + installedApp.isActive = false + self.finish(.success(installedApp)) } } } diff --git a/AltStore/Operations/ResignAppOperation.swift b/AltStore/Operations/ResignAppOperation.swift index bd0fc041..add08658 100644 --- a/AltStore/Operations/ResignAppOperation.swift +++ b/AltStore/Operations/ResignAppOperation.swift @@ -114,6 +114,7 @@ private extension ResignAppOperation infoDictionary[kCFBundleIdentifierKey as String] = profile.bundleIdentifier infoDictionary[Bundle.Info.altBundleID] = identifier + infoDictionary[Bundle.Info.devicePairingString] = Bundle.main.object(forInfoDictionaryKey: "ALTPairingFile") as? String for (key, value) in additionalInfoDictionaryValues { @@ -172,6 +173,8 @@ private extension ResignAppOperation if app.isAltStoreApp { guard let udid = Bundle.main.object(forInfoDictionaryKey: Bundle.Info.deviceID) as? String else { throw OperationError.unknownUDID } + guard let pairingFileString = Bundle.main.object(forInfoDictionaryKey: Bundle.Info.devicePairingString) as? String else { throw OperationError.unknownUDID } + additionalValues[Bundle.Info.devicePairingString] = pairingFileString additionalValues[Bundle.Info.deviceID] = udid additionalValues[Bundle.Info.serverID] = UserDefaults.standard.preferredServerID diff --git a/AltStore/Operations/SendAppOperation.swift b/AltStore/Operations/SendAppOperation.swift index 8a378d67..e630ded6 100644 --- a/AltStore/Operations/SendAppOperation.swift +++ b/AltStore/Operations/SendAppOperation.swift @@ -5,20 +5,17 @@ // Created by Riley Testut on 6/7/19. // Copyright © 2019 Riley Testut. All rights reserved. // - import Foundation import Network import AltStoreCore @objc(SendAppOperation) -class SendAppOperation: ResultOperation +class SendAppOperation: ResultOperation<()> { let context: InstallAppOperationContext - private let dispatchQueue = DispatchQueue(label: "com.altstore.SendAppOperation") - - private var serverConnection: ServerConnection? + private let dispatchQueue = DispatchQueue(label: "com.sidestore.SendAppOperation") init(context: InstallAppOperationContext) { @@ -39,87 +36,31 @@ class SendAppOperation: ResultOperation return } - guard let resignedApp = self.context.resignedApp, let server = self.context.server else { return self.finish(.failure(OperationError.invalidParameters)) } + guard let resignedApp = self.context.resignedApp else { return self.finish(.failure(OperationError.invalidParameters)) } // self.context.resignedApp.fileURL points to the app bundle, but we want the .ipa. let app = AnyApp(name: resignedApp.name, bundleIdentifier: self.context.bundleIdentifier, url: resignedApp.url) let fileURL = InstalledApp.refreshedIPAURL(for: app) - // Connect to server. - ServerManager.shared.connect(to: server) { (result) in - switch result - { - case .failure(let error): self.finish(.failure(error)) - case .success(let serverConnection): - self.serverConnection = serverConnection - - // Send app to server. - self.sendApp(at: fileURL, via: serverConnection) { (result) in - switch result - { - case .failure(let error): self.finish(.failure(error)) - case .success: - self.progress.completedUnitCount += 1 - self.finish(.success(serverConnection)) - } - } - } - } - } -} + + let ns_bundle = NSString(string: app.bundleIdentifier) + let ns_bundle_ptr = UnsafeMutablePointer(mutating: ns_bundle.utf8String) -private extension SendAppOperation -{ - func sendApp(at fileURL: URL, via connection: ServerConnection, completionHandler: @escaping (Result) -> Void) - { - do - { - guard let appData = try? Data(contentsOf: fileURL) else { throw OperationError.invalidApp } - guard let udid = Bundle.main.object(forInfoDictionaryKey: Bundle.Info.deviceID) as? String else { throw OperationError.unknownUDID } - - var request = PrepareAppRequest(udid: udid, contentSize: appData.count) - - if connection.server.connectionType == .local - { - // Background daemons have low memory limit (~6MB as of 13.5), - // so send just the file URL rather than the app data itself. - request.fileURL = fileURL + if let data = NSData(contentsOf: fileURL) { + let pls = UnsafeMutablePointer.allocate(capacity: data.length) + for (index, data) in data.enumerated() { + pls[index] = data + } + let res = minimuxer_yeet_app_afc(ns_bundle_ptr, pls, UInt(data.length)) + if res == 0 { + self.progress.completedUnitCount += 1 + self.finish(.success(())) + } else { + self.finish(.failure(minimuxer_to_operation(code: res))) } - connection.send(request) { (result) in - switch result - { - case .failure(let error): completionHandler(.failure(error)) - case .success: - - if connection.server.connectionType == .local - { - // Sent file URL, so don't need to send any more. - completionHandler(.success(())) - } - else - { - print("Sending app data (\(appData.count) bytes)...") - - connection.send(appData, prependSize: false) { (result) in - switch result - { - case .failure(let error): - print("Failed to send app data (\(appData.count) bytes)") - completionHandler(.failure(error)) - - case .success: - print("Successfully sent app data (\(appData.count) bytes)") - completionHandler(.success(())) - } - } - } - } - } - } - catch - { - completionHandler(.failure(error)) + } else { + self.finish(.failure(ALTServerError(.underlyingError))) } } } diff --git a/AltStore/SceneDelegate.swift b/AltStore/SceneDelegate.swift index 2249c1c5..3b4228d3 100644 --- a/AltStore/SceneDelegate.swift +++ b/AltStore/SceneDelegate.swift @@ -8,6 +8,7 @@ import UIKit import AltStoreCore +import EmotionalDamage @available(iOS 13, *) class SceneDelegate: UIResponder, UIWindowSceneDelegate @@ -39,7 +40,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate guard DatabaseManager.shared.isStarted else { return } AppManager.shared.update() - ServerManager.shared.startDiscovering() + start_em_proxy(bind_addr: "127.0.0.1:51820") PatreonAPI.shared.refreshPatreonAccount() } @@ -52,7 +53,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate guard UIApplication.shared.applicationState == .background else { return } - ServerManager.shared.stopDiscovering() + } func scene(_ scene: UIScene, openURLContexts URLContexts: Set) diff --git a/AltStore/Server/Server.swift b/AltStore/Server/Server.swift deleted file mode 100644 index acc35505..00000000 --- a/AltStore/Server/Server.swift +++ /dev/null @@ -1,73 +0,0 @@ -// -// Server.swift -// AltStore -// -// Created by Riley Testut on 6/20/19. -// Copyright © 2019 Riley Testut. All rights reserved. -// - -import Network - -enum ConnectionError: LocalizedError -{ - case serverNotFound - case connectionFailed - case connectionDropped - - var failureReason: String? { - switch self - { - case .serverNotFound: return NSLocalizedString("Could not find AltServer.", comment: "") - case .connectionFailed: return NSLocalizedString("Could not connect to AltServer.", comment: "") - case .connectionDropped: return NSLocalizedString("The connection to AltServer was dropped.", comment: "") - } - } -} - -extension Server -{ - enum ConnectionType - { - case wireless - case wired - case local - case manual - } -} - -struct Server: Equatable -{ - var identifier: String? = nil - var service: NetService? = nil - - var isPreferred = false - var connectionType: ConnectionType = .wireless - - var machServiceName: String? -} - -extension Server -{ - // Defined in extension so we can still use the automatically synthesized initializer. - init?(service: NetService, txtData: Data) // TODO: this is all that's needed for a server connection - { - let txtDictionary = NetService.dictionary(fromTXTRecord: txtData) - guard let identifierData = txtDictionary["serverID"], let identifier = String(data: identifierData, encoding: .utf8) else { - NSLog("Ahh, no serverID in TXT record for service: \(service)") - return nil - } - - self.service = service - self.identifier = identifier - self.isPreferred = true - } - - init?(service: NetService) - { - self.service = service - self.connectionType = .manual - self.identifier = String(data: "yolo".data(using: .utf8)!, encoding: .utf8) - self.isPreferred = false - } -} - diff --git a/AltStore/Server/ServerConnection.swift b/AltStore/Server/ServerConnection.swift deleted file mode 100644 index e663a2e0..00000000 --- a/AltStore/Server/ServerConnection.swift +++ /dev/null @@ -1,110 +0,0 @@ -// -// ServerConnection.swift -// AltStore -// -// Created by Riley Testut on 1/7/20. -// Copyright © 2020 Riley Testut. All rights reserved. -// - -import Foundation -import Network - -import AltStoreCore - -class ServerConnection -{ - var server: Server - var connection: Connection - - init(server: Server, connection: Connection) - { - self.server = server - self.connection = connection - } - - func send(_ payload: T, prependSize: Bool = true, completionHandler: @escaping (Result) -> Void) - { - do - { - let data: Data - - if let payload = payload as? Data - { - data = payload - } - else - { - data = try JSONEncoder().encode(payload) - } - - func process(_ result: Result) -> Bool - { - switch result - { - case .success: return true - case .failure(let error): - completionHandler(.failure(error)) - return false - } - } - - if prependSize - { - let requestSize = Int32(data.count) - let requestSizeData = withUnsafeBytes(of: requestSize) { Data($0) } - - self.connection.send(requestSizeData) { (result) in - guard process(result) else { return } - - self.connection.send(data) { (result) in - guard process(result) else { return } - completionHandler(.success(())) - } - } - } - else - { - self.connection.send(data) { (result) in - guard process(result) else { return } - completionHandler(.success(())) - } - } - } - catch - { - print("Invalid request.", error) - completionHandler(.failure(ALTServerError(.invalidRequest))) - } - } - - func receiveResponse(completionHandler: @escaping (Result) -> Void) - { - let size = MemoryLayout.size - - self.connection.receiveData(expectedSize: size) { (result) in - do - { - let data = try result.get() - - let expectedBytes = Int(data.withUnsafeBytes { $0.load(as: Int32.self) }) - self.connection.receiveData(expectedSize: expectedBytes) { (result) in - do - { - let data = try result.get() - - let response = try AltStoreCore.JSONDecoder().decode(ServerResponse.self, from: data) - completionHandler(.success(response)) - } - catch - { - completionHandler(.failure(ALTServerError(error))) - } - } - } - catch - { - completionHandler(.failure(ALTServerError(error))) - } - } - } -} diff --git a/AltStore/Server/ServerManager.swift b/AltStore/Server/ServerManager.swift deleted file mode 100644 index 85fefb5c..00000000 --- a/AltStore/Server/ServerManager.swift +++ /dev/null @@ -1,366 +0,0 @@ -// -// ServerManager.swift -// AltStore -// -// Created by Riley Testut on 5/30/19. -// Copyright © 2019 Riley Testut. All rights reserved. -// - -import Foundation -import Network - -import AltStoreCore - -class ServerManager: NSObject -{ - static let shared = ServerManager() - - private(set) var isDiscovering = false - private(set) var discoveredServers = [Server]() - - private let serviceBrowser = NetServiceBrowser() - private var services = Set() - - private let dispatchQueue = DispatchQueue(label: "io.altstore.ServerManager") - - private var connectionListener: NWListener? - private var incomingConnections: [NWConnection]? - private var incomingConnectionsSemaphore: DispatchSemaphore? - - private override init() - { - super.init() - - self.serviceBrowser.delegate = self - self.serviceBrowser.includesPeerToPeer = false - } -} - -extension ServerManager -{ - func startDiscovering() - { - guard !self.isDiscovering else { return } - self.isDiscovering = true - - self.serviceBrowser.searchForServices(ofType: ALTServerServiceType, inDomain: "") - - self.startListeningForWiredConnections() - - // Print log mentioning that we are manually adding this - NSLog("Manually adding server") - let ianTestService = NetService(domain: "69.69.0.1", type: "_altserver._tcp", name: "AltStore", port: 43311) - - if let server = Server(service: ianTestService) - { - self.addDiscoveredServer(server) - } else { - NSLog("Check for manual server failed!!") - } - } - - func stopDiscovering() - { - guard self.isDiscovering else { return } - self.isDiscovering = false - - self.discoveredServers.removeAll() - self.services.removeAll() - self.serviceBrowser.stop() - - self.stopListeningForWiredConnection() - } - - func connect(to server: Server, completion: @escaping (Result) -> Void) - { - DispatchQueue.global().async { - func finish(_ result: Result) - { - switch result - { - case .failure(let error): completion(.failure(error)) - case .success(let connection): - let serverConnection = ServerConnection(server: server, connection: connection) - completion(.success(serverConnection)) - } - } - - switch server.connectionType - { - case .local: self.connectToLocalServer(server, completion: finish(_:)) - case .wired: - guard let incomingConnectionsSemaphore = self.incomingConnectionsSemaphore else { return -finish(.failure(ALTServerError(.connectionFailed))) } - - print("Waiting for incoming connection...") - - let notificationCenter = CFNotificationCenterGetDarwinNotifyCenter() - - switch server.connectionType - { - case .wired: CFNotificationCenterPostNotification(notificationCenter, .wiredServerConnectionStartRequest, nil, nil, true) - case .local, .wireless, .manual: break - } - - _ = incomingConnectionsSemaphore.wait(timeout: .now() + 10.0) - - if let connection = self.incomingConnections?.popLast() - { - self.connectToRemoteServer(server, connection: connection, completion: finish(_:)) - } - else - { - finish(.failure(ALTServerError(.connectionFailed))) - } - - case .wireless: - guard let service = server.service else { return finish(.failure(ALTServerError(.connectionFailed))) } - - print("Connecting to mDNS service:", service) - - let connection = NWConnection(to: .service(name: service.name, type: service.type, domain: service.domain, interface: nil), using: .tcp) - self.connectToRemoteServer(server, connection: connection, completion: finish(_:)) - case .manual: - guard let service = server.service else { return finish(.failure(ALTServerError(.connectionFailed))) } - - connectNetmuxd() - - print("Connecting to manual service:", service.domain) - print("Port: ", String(service.port.description)) - - let connection = NWConnection(host: NWEndpoint.Host(service.domain), port: NWEndpoint.Port(String(service.port))!, using: .tcp) - self.connectToRemoteServer(server, connection: connection, completion: finish(_:)) - } - } - } -} - -private extension ServerManager -{ - func addDiscoveredServer(_ server: Server) - { - var server = server - server.isPreferred = true - - guard !self.discoveredServers.contains(server) else { return } - - self.discoveredServers.append(server) - } - - func makeListener() -> NWListener - { - let listener = try! NWListener(using: .tcp, on: NWEndpoint.Port(rawValue: ALTDeviceListeningSocket)!) - listener.newConnectionHandler = { [weak self] (connection) in - self?.incomingConnections?.append(connection) - self?.incomingConnectionsSemaphore?.signal() - } - listener.stateUpdateHandler = { (state) in - switch state - { - case .ready: break - case .waiting, .setup: print("Listener socket waiting...") - case .cancelled: print("Listener socket cancelled.") - case .failed(let error): print("Listener socket failed:", error) - @unknown default: break - } - } - - return listener - } - - func startListeningForWiredConnections() - { - self.incomingConnections = [] - self.incomingConnectionsSemaphore = DispatchSemaphore(value: 0) - - self.connectionListener = self.makeListener() - self.connectionListener?.start(queue: self.dispatchQueue) - } - - func stopListeningForWiredConnection() - { - self.connectionListener?.cancel() - self.connectionListener = nil - - self.incomingConnections = nil - self.incomingConnectionsSemaphore = nil - } - - func connectToRemoteServer(_ server: Server, connection: NWConnection, completion: @escaping (Result) -> Void) - { - connection.stateUpdateHandler = { [unowned connection] (state) in - switch state - { - case .failed(let error): - print("Failed to connect to service \(server.service?.name ?? "").", error) - completion(.failure(ConnectionError.connectionFailed)) - - case .cancelled: - completion(.failure(OperationError.cancelled)) - - case .ready: - let connection = NetworkConnection(connection) - completion(.success(connection)) - - case .waiting: break - case .setup: break - case .preparing: break - @unknown default: break - } - } - print("Connected to server!") - connection.start(queue: self.dispatchQueue) - } - - func connectToLocalServer(_ server: Server, completion: @escaping (Result) -> Void) - { - guard let machServiceName = server.machServiceName else { return completion(.failure(ConnectionError.connectionFailed)) } - - let xpcConnection = NSXPCConnection.makeConnection(machServiceName: machServiceName) - - let connection = XPCConnection(xpcConnection) - connection.connect { (result) in - switch result - { - case .failure(let error): - print("Could not connect to AltDaemon XPC service \(machServiceName).", error) - completion(.failure(error)) - - case .success: completion(.success(connection)) - } - } - } -} - -extension ServerManager: NetServiceBrowserDelegate -{ - func netServiceBrowserWillSearch(_ browser: NetServiceBrowser) - { - print("Discovering servers...") - - // Send a post request to JitStreamer to deal with the devil - connectNetmuxd() - } - - func netServiceBrowserDidStopSearch(_ browser: NetServiceBrowser) - { - print("Stopped discovering servers.") - } - - func netServiceBrowser(_ browser: NetServiceBrowser, didNotSearch errorDict: [String : NSNumber]) - { - print("Failed to discovering servers.", errorDict) - } - - func netServiceBrowser(_ browser: NetServiceBrowser, didFind service: NetService, moreComing: Bool) - { - service.delegate = self - - if let txtData = service.txtRecordData(), let server = Server(service: service, txtData: txtData) - { - self.addDiscoveredServer(server) - } - else - { - service.resolve(withTimeout: 3) - self.services.insert(service) - } - } - - func netServiceBrowser(_ browser: NetServiceBrowser, didRemove service: NetService, moreComing: Bool) - { - if let index = self.discoveredServers.firstIndex(where: { $0.service == service }) - { - self.discoveredServers.remove(at: index) - } - - self.services.remove(service) - } -} - -extension ServerManager: NetServiceDelegate -{ - func netServiceDidResolveAddress(_ service: NetService) - { - guard let data = service.txtRecordData(), let server = Server(service: service, txtData: data) else { return } - self.addDiscoveredServer(server) - } - - func netService(_ sender: NetService, didNotResolve errorDict: [String : NSNumber]) - { - print("Error resolving net service \(sender).", errorDict) - } - - func netService(_ sender: NetService, didUpdateTXTRecord data: Data) - { - let txtDict = NetService.dictionary(fromTXTRecord: data) - print("Service \(sender) updated TXT Record:", txtDict) - } -} - -func connectNetmuxd() { - - // declare the parameter as a dictionary that contains string as key and value combination. considering inputs are valid - - let parameters: [String: Any] = ["nothing": 0] - - // create the url with URL - let url = URL(string: "http://69.69.0.1/netmuxd/")! - - // create the session object - let session = URLSession.shared - - // now create the URLRequest object using the url object - var request = URLRequest(url: url) - request.httpMethod = "POST" //set http method as POST - - // add headers for the request - request.addValue("application/json", forHTTPHeaderField: "Content-Type") // change as per server requirements - request.addValue("application/json", forHTTPHeaderField: "Accept") - - do { - // convert parameters to Data and assign dictionary to httpBody of request - request.httpBody = try JSONSerialization.data(withJSONObject: parameters, options: .prettyPrinted) - } catch let error { - print(error.localizedDescription) - return - } - - // create dataTask using the session object to send data to the server - let task = session.dataTask(with: request) { data, response, error in - - if let error = error { - print("Post Request Error: \(error.localizedDescription)") - return - } - - // ensure there is valid response code returned from this HTTP response - guard let httpResponse = response as? HTTPURLResponse, - (200...299).contains(httpResponse.statusCode) - else { - print("Invalid Response received from the server") - return - } - - // ensure there is data returned - guard let responseData = data else { - print("nil Data received from the server") - return - } - - do { - // create json object from data or use JSONDecoder to convert to Model stuct - if let jsonResponse = try JSONSerialization.jsonObject(with: responseData, options: .mutableContainers) as? [String: Any] { - print(jsonResponse) - // handle json response - } else { - print("data maybe corrupted or in wrong format") - throw URLError(.badServerResponse) - } - } catch let error { - print(error.localizedDescription) - } - } - // perform the task - task.resume() -} diff --git a/Dependencies/MarkdownAttributedString b/Dependencies/MarkdownAttributedString index ec0d1eff..750e8d5c 160000 --- a/Dependencies/MarkdownAttributedString +++ b/Dependencies/MarkdownAttributedString @@ -1 +1 @@ -Subproject commit ec0d1eff57133f2a56ec1d0260be6d3f725f4e77 +Subproject commit 750e8d5cb455dcc592a9b6d1cacaa19837e7abff diff --git a/Dependencies/Roxas b/Dependencies/Roxas index fb33e158..ac906cf4 160000 --- a/Dependencies/Roxas +++ b/Dependencies/Roxas @@ -1 +1 @@ -Subproject commit fb33e158ae1e621ca705f9ab34b6ec16e83342ed +Subproject commit ac906cf490be49e52a5dd19e19918faf335b4e72 diff --git a/Dependencies/em_proxy b/Dependencies/em_proxy new file mode 160000 index 00000000..57ab5a00 --- /dev/null +++ b/Dependencies/em_proxy @@ -0,0 +1 @@ +Subproject commit 57ab5a000214800288a3cdd151dab3cf040bf376 diff --git a/Dependencies/libimobiledevice b/Dependencies/libimobiledevice index 1d555f6f..b314f04b 160000 --- a/Dependencies/libimobiledevice +++ b/Dependencies/libimobiledevice @@ -1 +1 @@ -Subproject commit 1d555f6f2c10b5a3dff946b745633c398a186935 +Subproject commit b314f04bd791b263cf43fadc6ac0756e67ab4ed0 diff --git a/Dependencies/libimobiledevice-glue b/Dependencies/libimobiledevice-glue new file mode 160000 index 00000000..7eaa28ea --- /dev/null +++ b/Dependencies/libimobiledevice-glue @@ -0,0 +1 @@ +Subproject commit 7eaa28ea9529b69da6b1721ba3e791e7ea5e950b diff --git a/Dependencies/libplist b/Dependencies/libplist index 17546f53..c3af4495 160000 --- a/Dependencies/libplist +++ b/Dependencies/libplist @@ -1 +1 @@ -Subproject commit 17546f53ac1377b0d4f45a800aaec7366ba5b6a0 +Subproject commit c3af449543795ad4d3ab178120ff69e90fdd2cc8 diff --git a/Dependencies/libusbmuxd b/Dependencies/libusbmuxd index 8b82ef16..6426362e 160000 --- a/Dependencies/libusbmuxd +++ b/Dependencies/libusbmuxd @@ -1 +1 @@ -Subproject commit 8b82ef166eb2ac12bc5228cf06a883ec86d520ca +Subproject commit 6426362e5cbad7284368b7fe70363f6b3251f94c diff --git a/Dependencies/minimuxer b/Dependencies/minimuxer new file mode 160000 index 00000000..1a98d69e --- /dev/null +++ b/Dependencies/minimuxer @@ -0,0 +1 @@ +Subproject commit 1a98d69ef05678a7f6a615b6592bdee4e63f33f8 diff --git a/EmotionalDamage/EmotionalDamage.swift b/EmotionalDamage/EmotionalDamage.swift new file mode 100644 index 00000000..163bdfc9 --- /dev/null +++ b/EmotionalDamage/EmotionalDamage.swift @@ -0,0 +1,18 @@ +// +// EmotionalDamage.swift +// EmotionalDamage +// +// Created by Jackson Coxson on 10/26/22. +// + +import Foundation + +public func start_em_proxy(bind_addr: String) { + let host = NSString(string: bind_addr) + let host_pointer = UnsafeMutablePointer(mutating: host.utf8String) + let _ = start_emotional_damage(host_pointer) +} + +public func stop_em_proxy() { + stop_emotional_damage() +} diff --git a/EmotionalDamage/em_proxy.h b/EmotionalDamage/em_proxy.h new file mode 100644 index 00000000..d3e9066e --- /dev/null +++ b/EmotionalDamage/em_proxy.h @@ -0,0 +1,31 @@ +// Jackson Coxson + +#include +#include +#include +#include +#include + + +/** + * Starts your emotional damage + * # Arguments + * * `bind_addr` - The UDP socket to listen to + * # Returns + * A handle to stop further emotional damage. + * Null on failure + * # Safety + * Don't be stupid + */ +void *start_emotional_damage(const char *bind_addr); + +/** + * Stops further emotional damage + * # Arguments + * * `handle` - The coping mechanism generated by start_emotional_damage + * # Returns + * The knowledge of knowing that you couldn't handle failure + * # Safety + * Don't be stupid + */ +void stop_emotional_damage(void *handle); diff --git a/Shared/Extensions/Bundle+AltStore.swift b/Shared/Extensions/Bundle+AltStore.swift index 65d2b087..0a998fd5 100644 --- a/Shared/Extensions/Bundle+AltStore.swift +++ b/Shared/Extensions/Bundle+AltStore.swift @@ -17,7 +17,7 @@ public extension Bundle public static let certificateID = "ALTCertificateID" public static let appGroups = "ALTAppGroups" public static let altBundleID = "ALTBundleIdentifier" - + public static let devicePairingString = "ALTPairingFile" public static let urlTypes = "CFBundleURLTypes" public static let exportedUTIs = "UTExportedTypeDeclarations" diff --git a/minimuxer/minimuxer.swift b/minimuxer/minimuxer.swift new file mode 100644 index 00000000..3189fd96 --- /dev/null +++ b/minimuxer/minimuxer.swift @@ -0,0 +1,81 @@ +// +// minimuxer.swift +// minimuxer +// +// Created by Jackson Coxson on 10/27/22. +// + +import Foundation + +public enum Uhoh: Error { + case Good + case Bad(code: Int32) +} + +public func start_minimuxer(pairing_file: String) { + let pf = NSString(string: pairing_file) + let pf_pointer = UnsafeMutablePointer(mutating: pf.utf8String) + let u = NSString(string: getDocumentsDirectory().absoluteString) + let u_ptr = UnsafeMutablePointer(mutating: u.utf8String) + minimuxer_c_start(pf_pointer, u_ptr) +} + +public func set_usbmuxd_socket() { + target_minimuxer_address() +} + +public func debug_app(app_id: String) throws -> Uhoh { + let ai = NSString(string: app_id) + let ai_pointer = UnsafeMutablePointer(mutating: ai.utf8String) + let res = minimuxer_debug_app(ai_pointer) + if res != 0 { + throw Uhoh.Bad(code: res) + } + return Uhoh.Good +} + +public func install_provisioning_profile(plist: Data) throws -> Uhoh { + let pls = String(decoding: plist, as: UTF8.self) + print(pls) + print(plist) + let x = plist.withUnsafeBytes { buf in UnsafeMutableRawPointer(mutating: buf) } + let res = minimuxer_install_provisioning_profile(x, UInt32(plist.count)) + if res != 0 { + throw Uhoh.Bad(code: res) + } + return Uhoh.Good +} + +public func remove_provisioning_profile(id: String) throws -> Uhoh { + let id_ns = NSString(string: id) + let id_pointer = UnsafeMutablePointer(mutating: id_ns.utf8String) + let res = minimuxer_remove_provisioning_profile(id_pointer) + if res != 0 { + throw Uhoh.Bad(code: res) + } + return Uhoh.Good +} + +public func remove_app(app_id: String) throws -> Uhoh { + let ai = NSString(string: app_id) + let ai_pointer = UnsafeMutablePointer(mutating: ai.utf8String) + let res = minimuxer_remove_app(ai_pointer) + if res != 0 { + throw Uhoh.Bad(code: res) + } + return Uhoh.Good +} + +public func auto_mount_dev_image() { + let u = NSString(string: getDocumentsDirectory().absoluteString) + let u_ptr = UnsafeMutablePointer(mutating: u.utf8String) + minimuxer_auto_mount(u_ptr) +} + +func getDocumentsDirectory() -> URL { + // find all possible documents directories for this user + let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) + + // just send back the first one, which ought to be the only one + return paths[0] +}