From cb645a1a3850a8990b30b457ecc6a6b1ddd27e7e Mon Sep 17 00:00:00 2001 From: Alexander Heinrich Date: Thu, 4 Mar 2021 11:07:06 +0100 Subject: [PATCH] Moving OFFetchReports to the OFReadKeys repository --- CVE-2020-9986/OFReadKeys/.swiftlint.yml | 59 ++ .../OFFetchReports/AppDelegate.swift | 41 ++ .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 58 ++ .../Assets.xcassets/Contents.json | 6 + .../OFFetchReports/Base.lproj/Main.storyboard | 683 ++++++++++++++++++ .../OFFetchReports/BoringSSL/BoringSSL.h | 27 + .../OFFetchReports/BoringSSL/BoringSSL.m | 173 +++++ .../BoringSSL/Bridging-Header.h | 15 + .../OFFetchReports/ContentView.swift | 22 + .../FindMy/DecryptReports.swift | 97 +++ .../FindMy/FindMyController.swift | 222 ++++++ .../FindMy/FindMyKeyDecoder.swift | 113 +++ .../OFFetchReports/FindMy/Models.swift | 197 +++++ .../OFReadKeys/OFFetchReports/Info.plist | 32 + .../OFReadKeys}/OFFetchReports/MapView.swift | 16 +- .../OFFetchReports/MapViewController.swift | 51 ++ .../OFFetchReports/MapViewController.xib | 34 + .../OFFetchReportsMainView.swift | 1 + .../OFFetchReports/OfflineFinder.entitlements | 14 + .../Preview Assets.xcassets/Contents.json | 6 + .../ReportsFetcher/ReportsFetcher.h | 61 ++ .../ReportsFetcher/ReportsFetcher.m | 175 +++++ .../OFReadKeys/OFFetchReports/SavePanel.swift | 47 ++ .../OFReadKeys.xcodeproj/project.pbxproj | 369 +++++++++- .../contents.xcworkspacedata | 2 +- .../xcshareddata/swiftpm/Package.resolved | 34 + .../xcschemes/OFFetchReports.xcscheme | 78 ++ .../xcschemes/Run OFFetchReports.xcscheme | 83 +++ .../OFReadKeys/FindMyKeyExtractor.swift | 8 +- OpenHaystack/.swiftlint.yml | 2 - .../OpenHaystack.xcodeproj/project.pbxproj | 286 +------- OpenHaystack/OpenHaystack/AppDelegate.swift | 4 - .../OpenHaystack/BoringSSL/BoringSSL.m | 5 +- .../FindMy/FindMyKeyDecoder.swift | 4 +- OpenHaystack/OpenHaystack/FindMy/Models.swift | 6 +- .../OpenHaystackMail/ALTAnisetteData.m | 2 +- 37 files changed, 2726 insertions(+), 318 deletions(-) create mode 100644 CVE-2020-9986/OFReadKeys/.swiftlint.yml create mode 100644 CVE-2020-9986/OFReadKeys/OFFetchReports/AppDelegate.swift create mode 100644 CVE-2020-9986/OFReadKeys/OFFetchReports/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 CVE-2020-9986/OFReadKeys/OFFetchReports/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 CVE-2020-9986/OFReadKeys/OFFetchReports/Assets.xcassets/Contents.json create mode 100644 CVE-2020-9986/OFReadKeys/OFFetchReports/Base.lproj/Main.storyboard create mode 100644 CVE-2020-9986/OFReadKeys/OFFetchReports/BoringSSL/BoringSSL.h create mode 100644 CVE-2020-9986/OFReadKeys/OFFetchReports/BoringSSL/BoringSSL.m create mode 100644 CVE-2020-9986/OFReadKeys/OFFetchReports/BoringSSL/Bridging-Header.h create mode 100644 CVE-2020-9986/OFReadKeys/OFFetchReports/ContentView.swift create mode 100755 CVE-2020-9986/OFReadKeys/OFFetchReports/FindMy/DecryptReports.swift create mode 100755 CVE-2020-9986/OFReadKeys/OFFetchReports/FindMy/FindMyController.swift create mode 100644 CVE-2020-9986/OFReadKeys/OFFetchReports/FindMy/FindMyKeyDecoder.swift create mode 100755 CVE-2020-9986/OFReadKeys/OFFetchReports/FindMy/Models.swift create mode 100644 CVE-2020-9986/OFReadKeys/OFFetchReports/Info.plist rename {OpenHaystack/OpenHaystack => CVE-2020-9986/OFReadKeys}/OFFetchReports/MapView.swift (60%) create mode 100755 CVE-2020-9986/OFReadKeys/OFFetchReports/MapViewController.swift create mode 100644 CVE-2020-9986/OFReadKeys/OFFetchReports/MapViewController.xib rename {OpenHaystack/OpenHaystack => CVE-2020-9986/OFReadKeys}/OFFetchReports/OFFetchReportsMainView.swift (99%) create mode 100755 CVE-2020-9986/OFReadKeys/OFFetchReports/OfflineFinder.entitlements create mode 100644 CVE-2020-9986/OFReadKeys/OFFetchReports/Preview Content/Preview Assets.xcassets/Contents.json create mode 100644 CVE-2020-9986/OFReadKeys/OFFetchReports/ReportsFetcher/ReportsFetcher.h create mode 100755 CVE-2020-9986/OFReadKeys/OFFetchReports/ReportsFetcher/ReportsFetcher.m create mode 100644 CVE-2020-9986/OFReadKeys/OFFetchReports/SavePanel.swift create mode 100644 CVE-2020-9986/OFReadKeys/OFReadKeys.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved create mode 100644 CVE-2020-9986/OFReadKeys/OFReadKeys.xcodeproj/xcshareddata/xcschemes/OFFetchReports.xcscheme create mode 100644 CVE-2020-9986/OFReadKeys/OFReadKeys.xcodeproj/xcshareddata/xcschemes/Run OFFetchReports.xcscheme diff --git a/CVE-2020-9986/OFReadKeys/.swiftlint.yml b/CVE-2020-9986/OFReadKeys/.swiftlint.yml new file mode 100644 index 0000000..0b66e5a --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/.swiftlint.yml @@ -0,0 +1,59 @@ + +# By default, SwiftLint uses a set of sensible default rules you can adjust: +disabled_rules: # rule identifiers turned on by default to exclude from running + - colon + - control_statement + - identifier_name + - force_try + +opt_in_rules: # some rules are turned off by default, so you need to opt-in + - empty_count # Find all the available rules by running: `swiftlint rules` + +# Alternatively, specify all rules explicitly by uncommenting this option: +# only_rules: # delete `disabled_rules` & `opt_in_rules` if using this +# - empty_parameters +# - vertical_whitespace + +analyzer_rules: # Rules run by `swiftlint analyze` (experimental) + - explicit_self + +# configurable rules can be customized from this configuration file +# binary rules can set their severity level +force_cast: warning # implicitly +# rules that have both warning and error levels, can set just the warning level +# implicitly +line_length: 180 +# they can set both implicitly with an array +type_body_length: + - 400 # warning + - 500 # error +# or they can set both explicitly +file_length: + warning: 600 + error: 1200 +# naming rules can set warnings/errors for min_length and max_length +# additionally they can set excluded names +type_name: + min_length: 1 # only warning + max_length: # warning and error + warning: 40 + error: 50 + excluded: + - iPhone + - BN + - ECC + - PSI + - Log + allowed_symbols: ["_"] # these are allowed in type names +identifier_name: + min_length: 1 # only min_length + excluded: # excluded via string array + - id + - URL + - GlobalAPIKey + - SHA256_SIZE + - SHA384_SIZE + - TWO + - EULER_THEOREM + - Log +reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, codeclimate, junit, html, emoji, sonarqube, markdown, github-actions-logging) diff --git a/CVE-2020-9986/OFReadKeys/OFFetchReports/AppDelegate.swift b/CVE-2020-9986/OFReadKeys/OFFetchReports/AppDelegate.swift new file mode 100644 index 0000000..dbe47e6 --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFFetchReports/AppDelegate.swift @@ -0,0 +1,41 @@ +// +// AppDelegate.swift +// OFFetchReports +// +// Created by Alex - SEEMOO on 04.03.21. +// Copyright © 2021 SEEMOO - TU Darmstadt. All rights reserved. +// + +import Cocoa +import SwiftUI + +@main +class AppDelegate: NSObject, NSApplicationDelegate { + + var window: NSWindow! + + func applicationDidFinishLaunching(_ aNotification: Notification) { + // Create the SwiftUI view that provides the window contents. + let contentView = OFFetchReportsMainView() + + // Create the window and set the content view. + window = NSWindow( + contentRect: NSRect(x: 0, y: 0, width: 480, height: 300), + styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView], + backing: .buffered, defer: false) + window.isReleasedWhenClosed = false + window.center() + window.setFrameAutosaveName("Main Window") + window.contentView = NSHostingView(rootView: contentView) + window.makeKeyAndOrderFront(nil) + } + + func applicationWillTerminate(_ aNotification: Notification) { + // Insert code here to tear down your application + } + + func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } + +} diff --git a/CVE-2020-9986/OFReadKeys/OFFetchReports/Assets.xcassets/AccentColor.colorset/Contents.json b/CVE-2020-9986/OFReadKeys/OFFetchReports/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFFetchReports/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CVE-2020-9986/OFReadKeys/OFFetchReports/Assets.xcassets/AppIcon.appiconset/Contents.json b/CVE-2020-9986/OFReadKeys/OFFetchReports/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..3f00db4 --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFFetchReports/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,58 @@ +{ + "images" : [ + { + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CVE-2020-9986/OFReadKeys/OFFetchReports/Assets.xcassets/Contents.json b/CVE-2020-9986/OFReadKeys/OFFetchReports/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFFetchReports/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CVE-2020-9986/OFReadKeys/OFFetchReports/Base.lproj/Main.storyboard b/CVE-2020-9986/OFReadKeys/OFFetchReports/Base.lproj/Main.storyboard new file mode 100644 index 0000000..a1dfb94 --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFFetchReports/Base.lproj/Main.storyboard @@ -0,0 +1,683 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CVE-2020-9986/OFReadKeys/OFFetchReports/BoringSSL/BoringSSL.h b/CVE-2020-9986/OFReadKeys/OFFetchReports/BoringSSL/BoringSSL.h new file mode 100644 index 0000000..d66782a --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFFetchReports/BoringSSL/BoringSSL.h @@ -0,0 +1,27 @@ +// OpenHaystack – Tracking personal Bluetooth devices via Apple's Find My network +// +// Copyright © 2021 Secure Mobile Networking Lab (SEEMOO) +// Copyright © 2021 The Open Wireless Link Project +// +// SPDX-License-Identifier: AGPL-3.0-only + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface BoringSSL : NSObject + ++ (NSData * _Nullable) deriveSharedKeyFromPrivateKey: (NSData *) privateKey andEphemeralKey: (NSData*) ephemeralKeyPoint; + +/// Derive a public key from a given private key +/// @param privateKeyData an EC private key on the P-224 curve +/// @returns The public key in a compressed format using 29 bytes. The first byte is used for identifying if its odd or even. +/// For OF the first byte has to be dropped ++ (NSData * _Nullable) derivePublicKeyFromPrivateKey: (NSData*) privateKeyData; + +/// Generate a new EC private key and exports it as data ++ (NSData * _Nullable) generateNewPrivateKey; + +@end + +NS_ASSUME_NONNULL_END diff --git a/CVE-2020-9986/OFReadKeys/OFFetchReports/BoringSSL/BoringSSL.m b/CVE-2020-9986/OFReadKeys/OFFetchReports/BoringSSL/BoringSSL.m new file mode 100644 index 0000000..827b1c0 --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFFetchReports/BoringSSL/BoringSSL.m @@ -0,0 +1,173 @@ +// OpenHaystack – Tracking personal Bluetooth devices via Apple's Find My network +// +// Copyright © 2021 Secure Mobile Networking Lab (SEEMOO) +// Copyright © 2021 The Open Wireless Link Project +// +// SPDX-License-Identifier: AGPL-3.0-only + +#import "BoringSSL.h" + +#include +#include +#include +#include +#include +#include + +@implementation BoringSSL + ++ (NSData * _Nullable) deriveSharedKeyFromPrivateKey: (NSData *) privateKey andEphemeralKey: (NSData*) ephemeralKeyPoint { + + NSLog(@"Private key %@", [privateKey base64EncodedStringWithOptions:0]); + NSLog(@"Ephemeral key %@", [ephemeralKeyPoint base64EncodedStringWithOptions:0]); + + EC_GROUP *curve = EC_GROUP_new_by_curve_name(NID_secp224r1); + + EC_KEY *key = [self deriveEllipticCurvePrivateKey:privateKey group:curve]; + + const EC_POINT *genPubKey = EC_KEY_get0_public_key(key); + [self printPoint:genPubKey withGroup:curve]; + + EC_POINT *publicKey = EC_POINT_new(curve); + size_t load_success = EC_POINT_oct2point(curve, publicKey, ephemeralKeyPoint.bytes, ephemeralKeyPoint.length, NULL); + if (load_success == 0) { + NSLog(@"Failed loading public key!"); + return nil; + } + + NSMutableData *sharedKey = [[NSMutableData alloc] initWithLength:28]; + + int res = ECDH_compute_key(sharedKey.mutableBytes, sharedKey.length, publicKey, key, nil); + + if (res < 1) { + NSLog(@"Failed with error: %d", res); + BIO *bio = BIO_new(BIO_s_mem()); + ERR_print_errors(bio); + char *buf; + size_t len = BIO_get_mem_data(bio, &buf); + NSLog(@"Generating shared key failed %s", buf); + BIO_free(bio); + } + + NSLog(@"Shared key: %@", [sharedKey base64EncodedStringWithOptions:0]); + + return sharedKey; +} + ++ (EC_POINT * _Nullable) loadEllipticCurvePublicBytesWith: (EC_GROUP *) group andPointBytes: (NSData *) pointBytes { + + EC_POINT* point = EC_POINT_new(group); + + //Create big number context + BN_CTX *ctx = BN_CTX_new(); + BN_CTX_start(ctx); + + //Public key will be stored in point + int res = EC_POINT_oct2point(group, point, pointBytes.bytes, pointBytes.length, ctx); + [self printPoint:point withGroup:group]; + + //Free the big numbers + BN_CTX_free(ctx); + + if (res != 1) { + //Failed + return nil; + } + + return point; +} + + +/// Get the private key on the curve from the private key bytes +/// @param privateKeyData NSData representing the private key +/// @param group The EC group representing the curve to use ++ (EC_KEY * _Nullable) deriveEllipticCurvePrivateKey: (NSData *)privateKeyData group: (EC_GROUP *) group { + EC_KEY *key = EC_KEY_new_by_curve_name(NID_secp224r1); + EC_POINT *point = EC_POINT_new(group); + + BN_CTX *ctx = BN_CTX_new(); + BN_CTX_start(ctx); + + + BIGNUM *privateKeyNum = BN_bin2bn(privateKeyData.bytes, privateKeyData.length, nil); + + int res = EC_POINT_mul(group, point, privateKeyNum, nil, nil, ctx); + if (res != 1) { + NSLog(@"Failed"); + return nil; + } + + res = EC_KEY_set_public_key(key, point); + if (res != 1) { + NSLog(@"Failed"); + return nil; + } + + privateKeyNum = BN_bin2bn(privateKeyData.bytes, privateKeyData.length, nil); + EC_KEY_set_private_key(key, privateKeyNum); + + + //Free the big numbers + BN_CTX_free(ctx); + + return key; +} + + +/// Derive a public key from a given private key +/// @param privateKeyData an EC private key on the P-224 curve ++ (NSData * _Nullable) derivePublicKeyFromPrivateKey: (NSData*) privateKeyData { + EC_GROUP *curve = EC_GROUP_new_by_curve_name(NID_secp224r1); + EC_KEY *key = [self deriveEllipticCurvePrivateKey:privateKeyData group:curve]; + + const EC_POINT *publicKey = EC_KEY_get0_public_key(key); + + size_t keySize = 28 + 1; + NSMutableData *publicKeyBytes = [[NSMutableData alloc] initWithLength:keySize]; + + size_t size = EC_POINT_point2oct(curve, publicKey, POINT_CONVERSION_COMPRESSED, publicKeyBytes.mutableBytes, keySize, NULL); + + if (size == 0) { + return nil; + } + + return publicKeyBytes; +} + ++ (NSData * _Nullable)generateNewPrivateKey { + EC_KEY *key = EC_KEY_new_by_curve_name(NID_secp224r1); + if (EC_KEY_generate_key_fips(key) == 0) { + return nil; + } + + const BIGNUM *privateKey = EC_KEY_get0_private_key(key); + size_t keySize = BN_num_bytes(privateKey); + //Convert to bytes + NSMutableData *privateKeyBytes = [[NSMutableData alloc] initWithLength:keySize]; + + + size_t size = BN_bn2bin(privateKey, privateKeyBytes.mutableBytes); + + if (size == 0) { + return nil; + } + + return privateKeyBytes; +} + ++ (void) printPoint: (const EC_POINT *)point withGroup:(EC_GROUP *)group { + NSMutableData *pointData = [[NSMutableData alloc] initWithLength:256]; + + size_t len = pointData.length; + BN_CTX *ctx = BN_CTX_new(); + BN_CTX_start(ctx); + size_t res = EC_POINT_point2oct(group, point, POINT_CONVERSION_UNCOMPRESSED, pointData.mutableBytes, len, ctx); + //Free the big numbers + BN_CTX_free(ctx); + + NSData *written = [[NSData alloc] initWithBytes:pointData.bytes length:res]; + + NSLog(@"Point data is: %@", [written base64EncodedStringWithOptions:0]); +} + +@end diff --git a/CVE-2020-9986/OFReadKeys/OFFetchReports/BoringSSL/Bridging-Header.h b/CVE-2020-9986/OFReadKeys/OFFetchReports/BoringSSL/Bridging-Header.h new file mode 100644 index 0000000..aea6ca6 --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFFetchReports/BoringSSL/Bridging-Header.h @@ -0,0 +1,15 @@ +// +// Bridging-Header.h +// OFReadKeys +// +// Created by Alex - SEEMOO on 04.03.21. +// Copyright © 2021 SEEMOO - TU Darmstadt. All rights reserved. +// + +#ifndef Bridging_Header_h +#define Bridging_Header_h + +#import "BoringSSL.h" +#import "ReportsFetcher.h" + +#endif /* Bridging_Header_h */ diff --git a/CVE-2020-9986/OFReadKeys/OFFetchReports/ContentView.swift b/CVE-2020-9986/OFReadKeys/OFFetchReports/ContentView.swift new file mode 100644 index 0000000..a63b4bb --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFFetchReports/ContentView.swift @@ -0,0 +1,22 @@ +// +// ContentView.swift +// OFFetchReports +// +// Created by Alex - SEEMOO on 04.03.21. +// Copyright © 2021 SEEMOO - TU Darmstadt. All rights reserved. +// + +import SwiftUI + +struct ContentView: View { + var body: some View { + Text("Hello, World!") + .frame(maxWidth: .infinity, maxHeight: .infinity) + } +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() + } +} diff --git a/CVE-2020-9986/OFReadKeys/OFFetchReports/FindMy/DecryptReports.swift b/CVE-2020-9986/OFReadKeys/OFFetchReports/FindMy/DecryptReports.swift new file mode 100755 index 0000000..4e4df52 --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFFetchReports/FindMy/DecryptReports.swift @@ -0,0 +1,97 @@ +// OpenHaystack – Tracking personal Bluetooth devices via Apple's Find My network +// +// Copyright © 2021 Secure Mobile Networking Lab (SEEMOO) +// Copyright © 2021 The Open Wireless Link Project +// +// SPDX-License-Identifier: AGPL-3.0-only + +import Foundation +import CryptoKit + +struct DecryptReports { + + /// Decrypt a find my report with the according key + /// - Parameters: + /// - report: An encrypted FindMy Report + /// - key: A FindMyKey + /// - Throws: Errors if the decryption fails + /// - Returns: An decrypted location report + static func decrypt(report: FindMyReport, with key: FindMyKey) throws -> FindMyLocationReport { + let payloadData = report.payload + let keyData = key.privateKey + + let privateKey = keyData + let ephemeralKey = payloadData.subdata(in: 5..<62) + + guard let sharedKey = BoringSSL.deriveSharedKey( + fromPrivateKey: privateKey, + andEphemeralKey: ephemeralKey) else { + throw FindMyError.decryptionError(description: "Failed generating shared key") + } + + let derivedKey = self.kdf(fromSharedSecret: sharedKey, andEphemeralKey: ephemeralKey) + + print("Derived key \(derivedKey.base64EncodedString())") + + let encData = payloadData.subdata(in: 62..<72) + let tag = payloadData.subdata(in: 72.. Data { + let decryptionKey = symmetricKey.subdata(in: 0..<16) + let iv = symmetricKey.subdata(in: 16.. FindMyLocationReport { + var longitude: Int32 = 0 + _ = withUnsafeMutableBytes(of: &longitude, {content.subdata(in: 4..<8).copyBytes(to: $0)}) + longitude = Int32(bigEndian: longitude) + + var latitude: Int32 = 0 + _ = withUnsafeMutableBytes(of: &latitude, {content.subdata(in: 0..<4).copyBytes(to: $0)}) + latitude = Int32(bigEndian: latitude) + + var accuracy: UInt8 = 0 + _ = withUnsafeMutableBytes(of: &accuracy, {content.subdata(in: 8..<9).copyBytes(to: $0)}) + + let latitudeDec = Double(latitude)/10000000.0 + let longitudeDec = Double(longitude)/10000000.0 + + return FindMyLocationReport(lat: latitudeDec, lng: longitudeDec, acc: accuracy, dP: report.datePublished, t: report.timestamp, c: report.confidence) + } + + static func kdf(fromSharedSecret secret: Data, andEphemeralKey ephKey: Data) -> Data { + + var shaDigest = SHA256() + shaDigest.update(data: secret) + var counter: Int32 = 1 + let counterData = Data(Data(bytes: &counter, count: MemoryLayout.size(ofValue: counter)).reversed()) + shaDigest.update(data: counterData) + shaDigest.update(data: ephKey) + + let derivedKey = shaDigest.finalize() + + return Data(derivedKey) + } +} diff --git a/CVE-2020-9986/OFReadKeys/OFFetchReports/FindMy/FindMyController.swift b/CVE-2020-9986/OFReadKeys/OFFetchReports/FindMy/FindMyController.swift new file mode 100755 index 0000000..cadaf32 --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFFetchReports/FindMy/FindMyController.swift @@ -0,0 +1,222 @@ +// OpenHaystack – Tracking personal Bluetooth devices via Apple's Find My network +// +// Copyright © 2021 Secure Mobile Networking Lab (SEEMOO) +// Copyright © 2021 The Open Wireless Link Project +// +// SPDX-License-Identifier: AGPL-3.0-only + +import Foundation +import SwiftUI +import Combine + +class FindMyController: ObservableObject { + static let shared = FindMyController() + + @Published var error: Error? + @Published var devices = [FindMyDevice]() + + func loadPrivateKeys(from data: Data, with searchPartyToken: Data, completion: @escaping (Error?) -> Void) { + do { + let devices = try PropertyListDecoder().decode([FindMyDevice].self, from: data) + + self.devices.append(contentsOf: devices) + self.fetchReports(with: searchPartyToken, completion: completion) + } catch { + self.error = FindMyErrors.decodingPlistFailed(message: String(describing: error)) + } + } + + func importReports(reports: [FindMyReport], and keys: Data, completion:@escaping () -> Void) throws { + var devices = try PropertyListDecoder().decode([FindMyDevice].self, from: keys) + + // Decrypt the reports with the imported keys + DispatchQueue.global(qos: .background).async { + // Add the reports to the according device by finding the right key for the report + for report in reports { + + guard let deviceIndex = devices.firstIndex(where: { (device) -> Bool in + device.keys.contains { (key) -> Bool in + key.hashedKey.base64EncodedString() == report.id + } + }) else { + print("No device found for id") + continue + } + if var reports = devices[deviceIndex].reports { + reports.append(report) + devices[deviceIndex].reports = reports + } else { + devices[deviceIndex].reports = [report] + } + } + self.devices = devices + + // Decrypt the reports + self.decryptReports { + self.exportDevices() + DispatchQueue.main.async { + completion() + } + } + + } + } + + func importDevices(devices: Data) throws { + var devices = try PropertyListDecoder().decode([FindMyDevice].self, from: devices) + + // Delete the decrypted reports + for idx in devices.startIndex.. Void) { + + DispatchQueue.global(qos: .background).async { + let fetchReportGroup = DispatchGroup() + + let fetcher = ReportsFetcher() + + var devices = self.devices + for deviceIndex in 0.. Void) { + print("Decrypting reports") + + // Iterate over all devices + for deviceIdx in 0.. 10.15.4 key file format | Big Sur 11.0 Beta 1 uses a similar key + /// file format that can be parsed identically. + /// macOS 10.15.7 uses a new key file format that has not been reversed yet. + /// (The key files are protected by sandboxing and only usable from a SIP disabled) + case catalina_10_15_4 + } + + var fileFormat: KeyFileFormat? + + func parse(keyFile: Data) throws -> [FindMyKey] { + // Detect the format at first + if fileFormat == nil { + try self.checkFormat(for: keyFile) + } + guard let format = self.fileFormat else { + throw ParsingError.unsupportedFormat + } + + switch format { + case .catalina_10_15_4: + let keys = try self.parseBinaryKeyFiles(from: keyFile) + return keys + } + } + + func checkFormat(for keyFile: Data) throws { + // Key files need to start with KEY = 0x4B 45 59 + let magicBytes = keyFile.subdata(in: 0..<3) + guard magicBytes == Data([0x4b, 0x45, 0x59]) else { + throw ParsingError.wrongMagicBytes + } + + // Detect zeros + let potentialZeros = keyFile[15..<31] + guard potentialZeros == Data(repeating: 0x00, count: 16) else { + throw ParsingError.wrongFormat + } + // Should be big sur + self.fileFormat = .catalina_10_15_4 + } + + fileprivate func parseBinaryKeyFiles(from keyFile: Data) throws -> [FindMyKey] { + var keys = [FindMyKey]() + // First key starts at 32 + var i = 32 + + while i + 117 < keyFile.count { + // We could not identify what those keys were + _ = keyFile.subdata(in: i.. Bool { + lhs.deviceId == rhs.deviceId + } +} + +struct FindMyKey: Codable { + internal init(advertisedKey: Data, hashedKey: Data, privateKey: Data, startTime: Date?, duration: Double?, pu: Data?, yCoordinate: Data?, fullKey: Data?) { + self.advertisedKey = advertisedKey + self.hashedKey = hashedKey + // The private key should only be 28 bytes long. If a 85 bytes full private public key is entered we truncate it here + if privateKey.count == 85 { + self.privateKey = privateKey.subdata(in: 57.. Int32 in + // Convert the endianness + pointer.load(as: Int32.self).bigEndian + } + + // It's a cocoa time stamp (counting from 2001) + self.timestamp = Date(timeIntervalSinceReferenceDate: TimeInterval(timestamp)) + self.confidence = payload[4] + + self.id = try values.decode(String.self, forKey: .id) + } + + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(self.datePublished.timeIntervalSince1970 * 1000, forKey: .datePublished) + try container.encode(self.payload.base64EncodedString(), forKey: .payload) + try container.encode(self.id, forKey: .id) + try container.encode(self.statusCode, forKey: .statusCode) + } +} + +struct FindMyLocationReport: Codable { + let latitude: Double + let longitude: Double + let accuracy: UInt8 + let datePublished: Date + let timestamp: Date? + let confidence: UInt8? + + var location: CLLocation { + return CLLocation(latitude: latitude, longitude: longitude) + } + + init(lat: Double, lng: Double, acc: UInt8, dP: Date, t: Date, c: UInt8) { + self.latitude = lat + self.longitude = lng + self.accuracy = acc + self.datePublished = dP + self.timestamp = t + self.confidence = c + } + + init(from decoder: Decoder) throws { + let values = try decoder.container(keyedBy: CodingKeys.self) + + self.latitude = try values.decode(Double.self, forKey: .latitude) + self.longitude = try values.decode(Double.self, forKey: .longitude) + + do { + let uAcc = try values.decode(UInt8.self, forKey: .accuracy) + self.accuracy = uAcc + } catch { + let iAcc = try values.decode(Int8.self, forKey: .accuracy) + self.accuracy = UInt8(bitPattern: iAcc) + } + + self.datePublished = try values.decode(Date.self, forKey: .datePublished) + self.timestamp = try? values.decode(Date.self, forKey: .timestamp) + self.confidence = try? values.decode(UInt8.self, forKey: .confidence) + } + +} + +enum FindMyError: Error { + case decryptionError(description: String) +} diff --git a/CVE-2020-9986/OFReadKeys/OFFetchReports/Info.plist b/CVE-2020-9986/OFReadKeys/OFFetchReports/Info.plist new file mode 100644 index 0000000..6564fe6 --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFFetchReports/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + Copyright © 2021 SEEMOO - TU Darmstadt. All rights reserved. + NSMainStoryboardFile + Main + NSPrincipalClass + NSApplication + + diff --git a/OpenHaystack/OpenHaystack/OFFetchReports/MapView.swift b/CVE-2020-9986/OFReadKeys/OFFetchReports/MapView.swift similarity index 60% rename from OpenHaystack/OpenHaystack/OFFetchReports/MapView.swift rename to CVE-2020-9986/OFReadKeys/OFFetchReports/MapView.swift index 30d9146..f0b9bb0 100755 --- a/OpenHaystack/OpenHaystack/OFFetchReports/MapView.swift +++ b/CVE-2020-9986/OFReadKeys/OFFetchReports/MapView.swift @@ -9,25 +9,15 @@ import SwiftUI import Cocoa import MapKit -struct MapView_ViewControllerRepresentable: NSViewControllerRepresentable { - var findMyController: FindMyController? +struct MapView: NSViewControllerRepresentable { + @Environment(\.findMyController) var findMyController func makeNSViewController(context: Context) -> MapViewController { return MapViewController(nibName: NSNib.Name("MapViewController"), bundle: nil) } func updateNSViewController(_ nsViewController: MapViewController, context: Context) { - if let controller = self.findMyController { - nsViewController.addLocationsReports(from: controller.devices) - } + nsViewController.addLocationsReports(from: findMyController.devices) } } - -struct MapView: View { - @Environment(\.findMyController) var findMyController - - var body: some View { - MapView_ViewControllerRepresentable(findMyController: self.findMyController) - } -} diff --git a/CVE-2020-9986/OFReadKeys/OFFetchReports/MapViewController.swift b/CVE-2020-9986/OFReadKeys/OFFetchReports/MapViewController.swift new file mode 100755 index 0000000..998cb13 --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFFetchReports/MapViewController.swift @@ -0,0 +1,51 @@ +// OpenHaystack – Tracking personal Bluetooth devices via Apple's Find My network +// +// Copyright © 2021 Secure Mobile Networking Lab (SEEMOO) +// Copyright © 2021 The Open Wireless Link Project +// +// SPDX-License-Identifier: AGPL-3.0-only + +import Cocoa +import MapKit + +final class MapViewController: NSViewController, MKMapViewDelegate { + @IBOutlet weak var mapView: MKMapView! + var pinsShown = false + + override func viewDidLoad() { + super.viewDidLoad() + self.mapView.delegate = self + } + + func addLocationsReports(from devices: [FindMyDevice]) { + if !self.mapView.annotations.isEmpty { + self.mapView.removeAnnotations(self.mapView.annotations) + } + + // Zoom to first location + if let location = devices.first?.decryptedReports?.first { + let coordinate = CLLocationCoordinate2D(latitude: location.latitude, longitude: location.longitude) + let span = MKCoordinateSpan(latitudeDelta: 5.0, longitudeDelta: 5.0) + let region = MKCoordinateRegion(center: coordinate, span: span) + + self.mapView.setRegion(region, animated: true) + } + + // Add pins + for device in devices { + + guard let reports = device.decryptedReports else {continue} + for report in reports { + let pin = MKPointAnnotation() + pin.title = device.deviceId + pin.coordinate = CLLocationCoordinate2D(latitude: report.latitude, longitude: report.longitude) + self.mapView.addAnnotation(pin) + } + } + + } + + func changeMapType(_ mapType: MKMapType) { + self.mapView.mapType = mapType + } +} diff --git a/CVE-2020-9986/OFReadKeys/OFFetchReports/MapViewController.xib b/CVE-2020-9986/OFReadKeys/OFFetchReports/MapViewController.xib new file mode 100644 index 0000000..46a7af1 --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFFetchReports/MapViewController.xib @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenHaystack/OpenHaystack/OFFetchReports/OFFetchReportsMainView.swift b/CVE-2020-9986/OFReadKeys/OFFetchReports/OFFetchReportsMainView.swift similarity index 99% rename from OpenHaystack/OpenHaystack/OFFetchReports/OFFetchReportsMainView.swift rename to CVE-2020-9986/OFReadKeys/OFFetchReports/OFFetchReportsMainView.swift index d87dda2..7d8dd1f 100755 --- a/OpenHaystack/OpenHaystack/OFFetchReports/OFFetchReportsMainView.swift +++ b/CVE-2020-9986/OFReadKeys/OFFetchReports/OFFetchReportsMainView.swift @@ -130,6 +130,7 @@ struct OFFetchReportsMainView: View { } + // swiftlint:disable identifier_name func droppedData(data: [NSItemProvider]) -> Bool { guard let itemProvider = data.first else {return false} diff --git a/CVE-2020-9986/OFReadKeys/OFFetchReports/OfflineFinder.entitlements b/CVE-2020-9986/OFReadKeys/OFFetchReports/OfflineFinder.entitlements new file mode 100755 index 0000000..18c2b68 --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFFetchReports/OfflineFinder.entitlements @@ -0,0 +1,14 @@ + + + + + com.apple.security.get-task-allow + + com.apple.authkit.client.private + + com.apple.private.accounts.allaccounts + + com.apple.security.network.client + + + diff --git a/CVE-2020-9986/OFReadKeys/OFFetchReports/Preview Content/Preview Assets.xcassets/Contents.json b/CVE-2020-9986/OFReadKeys/OFFetchReports/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFFetchReports/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CVE-2020-9986/OFReadKeys/OFFetchReports/ReportsFetcher/ReportsFetcher.h b/CVE-2020-9986/OFReadKeys/OFFetchReports/ReportsFetcher/ReportsFetcher.h new file mode 100644 index 0000000..9a821c3 --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFFetchReports/ReportsFetcher/ReportsFetcher.h @@ -0,0 +1,61 @@ +// OpenHaystack – Tracking personal Bluetooth devices via Apple's Find My network +// +// Copyright © 2021 Secure Mobile Networking Lab (SEEMOO) +// Copyright © 2021 The Open Wireless Link Project +// +// SPDX-License-Identifier: AGPL-3.0-only + +#import +//https://github.com/Matchstic/ReProvision/issues/96#issuecomment-551928795 +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface AKAppleIDSession : NSObject +- (id)_pairedDeviceAnisetteController; +- (id)_nativeAnisetteController; +- (void)_handleURLResponse:(id)arg1 forRequest:(id)arg2 withCompletion:(id)arg3; +- (void)_generateAppleIDHeadersForSessionTask:(id)arg1 withCompletion:(id)arg2; +- (id)_generateAppleIDHeadersForRequest:(id)arg1 error:(id)arg2; +- (id)_genericAppleIDHeadersDictionaryForRequest:(id)arg1; +- (void)handleResponse:(id)arg1 forRequest:(id)arg2 shouldRetry:(char *)arg3; +- (id)appleIDHeadersForRequest:(id)arg1; +- (void)URLSession:(id)arg1 task:(id)arg2 getAppleIDHeadersForResponse:(id)arg3 completionHandler:(id)arg4; +- (id)relevantHTTPStatusCodes; +- (id)copyWithZone:(struct _NSZone *)arg1; +- (void)encodeWithCoder:(id)arg1; +- (id)initWithCoder:(id)arg1; +- (id)initWithIdentifier:(id)arg1; +- (id)init; + +@end + +@interface AKDevice ++ (AKDevice *)currentDevice; +- (NSString *)uniqueDeviceIdentifier; +- (NSString *)serialNumber; +- (NSString *)serverFriendlyDescription; +@end + + + +@interface ReportsFetcher : NSObject + +/// WARNING: Runs synchronous network request. Please run this in a background thread. +/// Query location reports for an array of public key hashes (ids) +/// @param publicKeys Array of hashed public keys (in Base64) +/// @param date Start date +/// @param duration Duration checked +/// @param searchPartyToken Search Party token +/// @param completion Called when finished +- (void) queryForHashes:(NSArray *)publicKeys startDate: (NSDate *) date duration: (double) duration searchPartyToken:(nonnull NSData *)searchPartyToken completion: (void (^)(NSData* _Nullable)) completion; + +/// Fetches the search party token from the macOS Keychain. Returns null if it fails +- (NSData * _Nullable) fetchSearchpartyToken; + +/// Get AnisetteData from AuthKit or return an empty dictionary +- (NSDictionary *_Nonnull) anisetteDataDictionary; + +@end + +NS_ASSUME_NONNULL_END diff --git a/CVE-2020-9986/OFReadKeys/OFFetchReports/ReportsFetcher/ReportsFetcher.m b/CVE-2020-9986/OFReadKeys/OFFetchReports/ReportsFetcher/ReportsFetcher.m new file mode 100755 index 0000000..74c5b0c --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFFetchReports/ReportsFetcher/ReportsFetcher.m @@ -0,0 +1,175 @@ +// OpenHaystack – Tracking personal Bluetooth devices via Apple's Find My network +// +// Copyright © 2021 Secure Mobile Networking Lab (SEEMOO) +// Copyright © 2021 The Open Wireless Link Project +// +// SPDX-License-Identifier: AGPL-3.0-only + +#import "ReportsFetcher.h" +#import + +#import + +#if ACCESSORY +#import "OpenHaystack-Swift.h" +#else +#import "OFFetchReports-Swift.h" +#endif + +@implementation ReportsFetcher + +- (NSData * _Nullable) fetchSearchpartyToken { + NSDictionary *query = @{ + (NSString*) kSecClass : (NSString*) kSecClassGenericPassword, + (NSString*) kSecAttrService: @"com.apple.account.AppleAccount.search-party-token", + (NSString*) kSecMatchLimit: (id) kSecMatchLimitOne, + (NSString*) kSecReturnData: @true + }; + + CFTypeRef item; + OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef) query, &item); + + if (status == errSecSuccess) { + NSData *securityToken = (__bridge NSData *)(item); + + NSLog(@"Fetched token %@", [[NSString alloc] initWithData:securityToken encoding:NSUTF8StringEncoding]); + + if (securityToken.length == 0) { + return [self fetchSearchpartyTokenFromAccounts]; + } + + return securityToken; + } + + + return [self fetchSearchpartyTokenFromAccounts];; +} + +- (NSData * _Nullable) fetchSearchpartyTokenFromAccounts { + ACAccountStore *accountStore = [[ACAccountStore alloc] init]; + ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:@"com.apple.account.AppleAccount"]; + + NSArray *appleAccounts = [accountStore accountsWithAccountType:accountType]; + + if (appleAccounts == nil && appleAccounts.count > 0) {return nil;} + + ACAccount *iCloudAccount = appleAccounts[0]; + ACAccountCredential *iCloudCredentials = iCloudAccount.credential; + + if ([iCloudCredentials respondsToSelector:NSSelectorFromString(@"credentialItems")]) { + NSDictionary* credentialItems = [iCloudCredentials performSelector:NSSelectorFromString(@"credentialItems")]; + NSString *searchPartyToken = credentialItems[@"search-party-token"]; + NSData *tokenData = [searchPartyToken dataUsingEncoding:NSASCIIStringEncoding]; + return tokenData; + } + + return nil; +} + +- (NSString *) fetchAppleAccountId { + NSDictionary *query = @{ + (NSString*) kSecClass : (NSString*) kSecClassGenericPassword, + (NSString*) kSecAttrService: @"iCloud", + (NSString*) kSecMatchLimit: (id) kSecMatchLimitOne, + (NSString*) kSecReturnAttributes: @true + }; + + CFTypeRef item; + OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef) query, &item); + + if (status == errSecSuccess) { + NSDictionary *itemDict = (__bridge NSDictionary *)(item); + + NSString *accountId = itemDict[(NSString *) kSecAttrAccount]; + + return accountId; + } + + return nil; +} + +- (NSString *) basicAuthForAppleID: (NSString *) appleId andToken: (NSData*) token { + NSString * tokenString = [[NSString alloc] initWithData:token encoding:NSUTF8StringEncoding]; + NSString * authText = [NSString stringWithFormat:@"%@:%@", appleId, tokenString]; + NSString * base64Auth = [[authText dataUsingEncoding:NSUTF8StringEncoding] base64EncodedStringWithOptions:0]; + NSString *auth = [NSString stringWithFormat:@"Basic %@", base64Auth]; + + return auth; +} + +- (NSDictionary *) anisetteDataDictionary { + + NSMutableURLRequest* req = [[NSMutableURLRequest alloc] initWithURL:[[NSURL alloc] initWithString:@"https://gateway.icloud.com/acsnservice/fetch"]]; + [req setHTTPMethod:@"POST"]; + + AKAppleIDSession* session = [[NSClassFromString(@"AKAppleIDSession") alloc] initWithIdentifier:@"com.apple.gs.xcode.auth"]; + NSDictionary *appleHeadersDict = [session appleIDHeadersForRequest:req]; + + return appleHeadersDict; +} + +- (void) fetchAnisetteData:(void (^)(NSDictionary* _Nullable)) completion { + // Use the AltStore mail plugin + NSDictionary *anisetteData = [self anisetteDataDictionary]; + completion(anisetteData); +} + +- (void) queryForHashes:(NSArray *)publicKeys startDate: (NSDate *) date duration: (double) duration searchPartyToken:(nonnull NSData *)searchPartyToken completion: (void (^)(NSData* _Nullable)) completion { + + // calculate the timestamps for the defined duration + long long startDate = [date timeIntervalSince1970] * 1000; + long long endDate = ([date timeIntervalSince1970] + duration) * 1000.0; + + NSLog(@"Requesting data for %@", publicKeys); + NSDictionary * query = @{ + @"search": @[ + @{ + @"endDate": [NSString stringWithFormat:@"%lli", endDate], + @"ids": publicKeys, + @"startDate": [NSString stringWithFormat:@"%lli", startDate] + } + ] + }; + NSData *httpBody = [NSJSONSerialization dataWithJSONObject:query options:0 error:nil]; + + NSLog(@"Query : %@",query); + NSString *authKey = @"authorization"; + NSData *securityToken = searchPartyToken; + NSString *appleId = [self fetchAppleAccountId]; + NSString *authValue = [self basicAuthForAppleID:appleId andToken:securityToken]; + + [self fetchAnisetteData:^(NSDictionary * _Nullable dict) { + if (dict == nil) { + completion(nil); + return; + } + + NSMutableURLRequest* req = [[NSMutableURLRequest alloc] initWithURL:[[NSURL alloc] initWithString:@"https://gateway.icloud.com/acsnservice/fetch"]]; + + [req setHTTPMethod:@"POST"]; + [req setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; + [req setValue:@"application/json" forHTTPHeaderField:@"Accept"]; + [req setValue:authValue forHTTPHeaderField:authKey]; + + + NSDictionary *appleHeadersDict = dict; + for(id key in appleHeadersDict) + [req setValue:[appleHeadersDict objectForKey:key] forHTTPHeaderField:key]; + + NSLog(@"Headers:\n%@",req.allHTTPHeaderFields); + + [req setHTTPBody:httpBody]; + + NSURLResponse * response; + NSError * error = nil; + NSData * data = [NSURLConnection sendSynchronousRequest:req returningResponse:&response error:&error]; + + if (error) { + NSLog(@"Error during request: \n\n%@", error); + } + + completion(data); + }]; +} + +@end diff --git a/CVE-2020-9986/OFReadKeys/OFFetchReports/SavePanel.swift b/CVE-2020-9986/OFReadKeys/OFFetchReports/SavePanel.swift new file mode 100644 index 0000000..f987ba7 --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFFetchReports/SavePanel.swift @@ -0,0 +1,47 @@ +// OpenHaystack – Tracking personal Bluetooth devices via Apple's Find My network +// +// Copyright © 2021 Secure Mobile Networking Lab (SEEMOO) +// Copyright © 2021 The Open Wireless Link Project +// +// SPDX-License-Identifier: AGPL-3.0-only + +import Foundation +import AppKit + +class SavePanel: NSObject, NSOpenSavePanelDelegate { + + static let shared = SavePanel() + + var fileToSave: Data? + var fileExtension: String? + var panel: NSSavePanel? + + func saveFile(file: Data, fileExtension: String) { + self.fileToSave = file + self.fileExtension = fileExtension + + self.panel = NSSavePanel() + self.panel?.delegate = self + self.panel?.title = "Export Find My Locations" + self.panel?.prompt = "Export" + self.panel?.nameFieldLabel = "Find My Locations" + self.panel?.nameFieldStringValue = "findMyLocations.plist" + self.panel?.allowedFileTypes = ["plist"] + + let result = self.panel?.runModal() + + if result == NSApplication.ModalResponse.OK { + // Save file + let fileURL = self.panel?.url + try! self.fileToSave?.write(to: fileURL!) + } + + } + + func panel(_ sender: Any, userEnteredFilename filename: String, confirmed okFlag: Bool) -> String? { + guard okFlag else {return nil} + + return filename + } + +} diff --git a/CVE-2020-9986/OFReadKeys/OFReadKeys.xcodeproj/project.pbxproj b/CVE-2020-9986/OFReadKeys/OFReadKeys.xcodeproj/project.pbxproj index 5797ef6..017efe5 100644 --- a/CVE-2020-9986/OFReadKeys/OFReadKeys.xcodeproj/project.pbxproj +++ b/CVE-2020-9986/OFReadKeys/OFReadKeys.xcodeproj/project.pbxproj @@ -3,9 +3,24 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 52; objects = { +/* Begin PBXAggregateTarget section */ + 782AC6C425F0E2D200554BF4 /* Run OFFetchReports */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 782AC6C525F0E2D200554BF4 /* Build configuration list for PBXAggregateTarget "Run OFFetchReports" */; + buildPhases = ( + 782AC6C825F0E2DC00554BF4 /* Codesign Offline Finder with Entitlements */, + ); + dependencies = ( + 782AC6CA25F0E2EB00554BF4 /* PBXTargetDependency */, + ); + name = "Run OFFetchReports"; + productName = "Run OFFetchReports"; + }; +/* End PBXAggregateTarget section */ + /* Begin PBXBuildFile section */ 78097EC7248E27E700096FCA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78097EC6248E27E700096FCA /* AppDelegate.swift */; }; 78097EC9248E27E700096FCA /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78097EC8248E27E700096FCA /* ContentView.swift */; }; @@ -13,11 +28,38 @@ 78097ECE248E27E800096FCA /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 78097ECD248E27E800096FCA /* Preview Assets.xcassets */; }; 78097ED1248E27E800096FCA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 78097ECF248E27E800096FCA /* Main.storyboard */; }; 781FD99025EE4F5400C745C9 /* FindMyKeyExtractor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 781FD98F25EE4F5400C745C9 /* FindMyKeyExtractor.swift */; }; + 782AC6A125F0DF3000554BF4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 782AC6A025F0DF3000554BF4 /* AppDelegate.swift */; }; + 782AC6A525F0DF3100554BF4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 782AC6A425F0DF3100554BF4 /* Assets.xcassets */; }; + 782AC6A825F0DF3100554BF4 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 782AC6A725F0DF3100554BF4 /* Preview Assets.xcassets */; }; + 782AC6AB25F0DF3100554BF4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 782AC6A925F0DF3100554BF4 /* Main.storyboard */; }; + 782AC6B325F0DF7C00554BF4 /* OFFetchReportsMainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 782AC6B125F0DF7C00554BF4 /* OFFetchReportsMainView.swift */; }; + 782AC6B425F0DF7C00554BF4 /* MapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 782AC6B225F0DF7C00554BF4 /* MapView.swift */; }; + 782AC6BA25F0DFF200554BF4 /* SavePanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 782AC6B625F0DFF200554BF4 /* SavePanel.swift */; }; + 782AC6BB25F0DFF200554BF4 /* MapViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 782AC6B725F0DFF200554BF4 /* MapViewController.swift */; }; + 782AC6BC25F0DFF200554BF4 /* MapViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 782AC6B825F0DFF200554BF4 /* MapViewController.xib */; }; + 782AC6C125F0E02200554BF4 /* BoringSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 782AC6BF25F0E02200554BF4 /* BoringSSL.m */; }; + 782AC6D125F0E3F600554BF4 /* DecryptReports.swift in Sources */ = {isa = PBXBuildFile; fileRef = 782AC6CD25F0E3F600554BF4 /* DecryptReports.swift */; }; + 782AC6D225F0E3F600554BF4 /* FindMyKeyDecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 782AC6CE25F0E3F600554BF4 /* FindMyKeyDecoder.swift */; }; + 782AC6D325F0E3F600554BF4 /* FindMyController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 782AC6CF25F0E3F600554BF4 /* FindMyController.swift */; }; + 782AC6D425F0E3F600554BF4 /* Models.swift in Sources */ = {isa = PBXBuildFile; fileRef = 782AC6D025F0E3F600554BF4 /* Models.swift */; }; + 782AC6D825F0E3FE00554BF4 /* ReportsFetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 782AC6D725F0E3FE00554BF4 /* ReportsFetcher.m */; }; + 782AC6DB25F0E4C800554BF4 /* NIOSSL in Frameworks */ = {isa = PBXBuildFile; productRef = 782AC6DA25F0E4C800554BF4 /* NIOSSL */; }; + 782AC6DE25F0E4D900554BF4 /* Crypto in Frameworks */ = {isa = PBXBuildFile; productRef = 782AC6DD25F0E4D900554BF4 /* Crypto */; }; 7840717F25EE41E5005729F0 /* FindMyKeyDecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7840717E25EE41E5005729F0 /* FindMyKeyDecoder.swift */; }; 78DF8995248E5E71002F39E1 /* FindMyModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78DF8994248E5E71002F39E1 /* FindMyModels.swift */; }; 78DF899B248E7D8D002F39E1 /* SavePanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78DF899A248E7D8D002F39E1 /* SavePanel.swift */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 782AC6C925F0E2EB00554BF4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 78097EBB248E27E700096FCA /* Project object */; + proxyType = 1; + remoteGlobalIDString = 782AC69D25F0DF3000554BF4; + remoteInfo = OFFetchReports; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXFileReference section */ 78097EC3248E27E700096FCA /* OFReadKeys.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OFReadKeys.app; sourceTree = BUILT_PRODUCTS_DIR; }; 78097EC6248E27E700096FCA /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -28,6 +70,28 @@ 78097ED2248E27E800096FCA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 78097ED3248E27E800096FCA /* OFReadKeys.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = OFReadKeys.entitlements; sourceTree = ""; }; 781FD98F25EE4F5400C745C9 /* FindMyKeyExtractor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FindMyKeyExtractor.swift; sourceTree = ""; }; + 782AC69E25F0DF3000554BF4 /* OFFetchReports.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OFFetchReports.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 782AC6A025F0DF3000554BF4 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 782AC6A425F0DF3100554BF4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 782AC6A725F0DF3100554BF4 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 782AC6AA25F0DF3100554BF4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 782AC6AC25F0DF3100554BF4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 782AC6B125F0DF7C00554BF4 /* OFFetchReportsMainView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OFFetchReportsMainView.swift; sourceTree = ""; }; + 782AC6B225F0DF7C00554BF4 /* MapView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapView.swift; sourceTree = ""; }; + 782AC6B525F0DFF200554BF4 /* OfflineFinder.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = OfflineFinder.entitlements; sourceTree = ""; }; + 782AC6B625F0DFF200554BF4 /* SavePanel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SavePanel.swift; sourceTree = ""; }; + 782AC6B725F0DFF200554BF4 /* MapViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapViewController.swift; sourceTree = ""; }; + 782AC6B825F0DFF200554BF4 /* MapViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MapViewController.xib; sourceTree = ""; }; + 782AC6BF25F0E02200554BF4 /* BoringSSL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BoringSSL.m; sourceTree = ""; }; + 782AC6C025F0E02200554BF4 /* BoringSSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BoringSSL.h; sourceTree = ""; }; + 782AC6C225F0E07200554BF4 /* Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = ""; }; + 782AC6CB25F0E33000554BF4 /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = .swiftlint.yml; sourceTree = ""; }; + 782AC6CD25F0E3F600554BF4 /* DecryptReports.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DecryptReports.swift; sourceTree = ""; }; + 782AC6CE25F0E3F600554BF4 /* FindMyKeyDecoder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FindMyKeyDecoder.swift; sourceTree = ""; }; + 782AC6CF25F0E3F600554BF4 /* FindMyController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FindMyController.swift; sourceTree = ""; }; + 782AC6D025F0E3F600554BF4 /* Models.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Models.swift; sourceTree = ""; }; + 782AC6D625F0E3FE00554BF4 /* ReportsFetcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReportsFetcher.h; sourceTree = ""; }; + 782AC6D725F0E3FE00554BF4 /* ReportsFetcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ReportsFetcher.m; sourceTree = ""; }; 7840717E25EE41E5005729F0 /* FindMyKeyDecoder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FindMyKeyDecoder.swift; path = ../../../OpenHaystack/OpenHaystack/FindMy/FindMyKeyDecoder.swift; sourceTree = ""; }; 78DF8994248E5E71002F39E1 /* FindMyModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FindMyModels.swift; sourceTree = ""; }; 78DF899A248E7D8D002F39E1 /* SavePanel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SavePanel.swift; sourceTree = ""; }; @@ -41,13 +105,24 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 782AC69B25F0DF3000554BF4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 782AC6DB25F0E4C800554BF4 /* NIOSSL in Frameworks */, + 782AC6DE25F0E4D900554BF4 /* Crypto in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 78097EBA248E27E700096FCA = { isa = PBXGroup; children = ( + 782AC6CB25F0E33000554BF4 /* .swiftlint.yml */, 78097EC5248E27E700096FCA /* OFReadKeys */, + 782AC69F25F0DF3000554BF4 /* OFFetchReports */, 78097EC4248E27E700096FCA /* Products */, ); sourceTree = ""; @@ -56,6 +131,7 @@ isa = PBXGroup; children = ( 78097EC3248E27E700096FCA /* OFReadKeys.app */, + 782AC69E25F0DF3000554BF4 /* OFFetchReports.app */, ); name = Products; sourceTree = ""; @@ -86,6 +162,66 @@ path = "Preview Content"; sourceTree = ""; }; + 782AC69F25F0DF3000554BF4 /* OFFetchReports */ = { + isa = PBXGroup; + children = ( + 782AC6CC25F0E3F600554BF4 /* FindMy */, + 782AC6BE25F0E02200554BF4 /* BoringSSL */, + 782AC6B225F0DF7C00554BF4 /* MapView.swift */, + 782AC6B125F0DF7C00554BF4 /* OFFetchReportsMainView.swift */, + 782AC6A025F0DF3000554BF4 /* AppDelegate.swift */, + 782AC6B725F0DFF200554BF4 /* MapViewController.swift */, + 782AC6B825F0DFF200554BF4 /* MapViewController.xib */, + 782AC6B525F0DFF200554BF4 /* OfflineFinder.entitlements */, + 782AC6B625F0DFF200554BF4 /* SavePanel.swift */, + 782AC6A425F0DF3100554BF4 /* Assets.xcassets */, + 782AC6A925F0DF3100554BF4 /* Main.storyboard */, + 782AC6AC25F0DF3100554BF4 /* Info.plist */, + 782AC6A625F0DF3100554BF4 /* Preview Content */, + ); + path = OFFetchReports; + sourceTree = ""; + }; + 782AC6A625F0DF3100554BF4 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 782AC6A725F0DF3100554BF4 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + 782AC6BE25F0E02200554BF4 /* BoringSSL */ = { + isa = PBXGroup; + children = ( + 782AC6BF25F0E02200554BF4 /* BoringSSL.m */, + 782AC6C025F0E02200554BF4 /* BoringSSL.h */, + 782AC6C225F0E07200554BF4 /* Bridging-Header.h */, + ); + path = BoringSSL; + sourceTree = ""; + }; + 782AC6CC25F0E3F600554BF4 /* FindMy */ = { + isa = PBXGroup; + children = ( + 782AC6D525F0E3FE00554BF4 /* ReportsFetcher */, + 782AC6CD25F0E3F600554BF4 /* DecryptReports.swift */, + 782AC6CE25F0E3F600554BF4 /* FindMyKeyDecoder.swift */, + 782AC6CF25F0E3F600554BF4 /* FindMyController.swift */, + 782AC6D025F0E3F600554BF4 /* Models.swift */, + ); + path = FindMy; + sourceTree = ""; + }; + 782AC6D525F0E3FE00554BF4 /* ReportsFetcher */ = { + isa = PBXGroup; + children = ( + 782AC6D625F0E3FE00554BF4 /* ReportsFetcher.h */, + 782AC6D725F0E3FE00554BF4 /* ReportsFetcher.m */, + ); + name = ReportsFetcher; + path = OFFetchReports/ReportsFetcher; + sourceTree = SOURCE_ROOT; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -107,19 +243,47 @@ productReference = 78097EC3248E27E700096FCA /* OFReadKeys.app */; productType = "com.apple.product-type.application"; }; + 782AC69D25F0DF3000554BF4 /* OFFetchReports */ = { + isa = PBXNativeTarget; + buildConfigurationList = 782AC6B025F0DF3100554BF4 /* Build configuration list for PBXNativeTarget "OFFetchReports" */; + buildPhases = ( + 782AC69A25F0DF3000554BF4 /* Sources */, + 782AC69B25F0DF3000554BF4 /* Frameworks */, + 782AC69C25F0DF3000554BF4 /* Resources */, + 782AC6C325F0E2A300554BF4 /* SwiftLint */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = OFFetchReports; + packageProductDependencies = ( + 782AC6DA25F0E4C800554BF4 /* NIOSSL */, + 782AC6DD25F0E4D900554BF4 /* Crypto */, + ); + productName = OFFetchReports; + productReference = 782AC69E25F0DF3000554BF4 /* OFFetchReports.app */; + productType = "com.apple.product-type.application"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 78097EBB248E27E700096FCA /* Project object */ = { isa = PBXProject; attributes = { - LastSwiftUpdateCheck = 1150; + LastSwiftUpdateCheck = 1250; LastUpgradeCheck = 1150; ORGANIZATIONNAME = "SEEMOO - TU Darmstadt"; TargetAttributes = { 78097EC2248E27E700096FCA = { CreatedOnToolsVersion = 11.5; }; + 782AC69D25F0DF3000554BF4 = { + CreatedOnToolsVersion = 12.5; + }; + 782AC6C425F0E2D200554BF4 = { + CreatedOnToolsVersion = 12.5; + }; }; }; buildConfigurationList = 78097EBE248E27E700096FCA /* Build configuration list for PBXProject "OFReadKeys" */; @@ -131,11 +295,17 @@ Base, ); mainGroup = 78097EBA248E27E700096FCA; + packageReferences = ( + 782AC6D925F0E4C800554BF4 /* XCRemoteSwiftPackageReference "swift-nio-ssl" */, + 782AC6DC25F0E4D900554BF4 /* XCRemoteSwiftPackageReference "swift-crypto" */, + ); productRefGroup = 78097EC4248E27E700096FCA /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 78097EC2248E27E700096FCA /* OFReadKeys */, + 782AC69D25F0DF3000554BF4 /* OFFetchReports */, + 782AC6C425F0E2D200554BF4 /* Run OFFetchReports */, ); }; /* End PBXProject section */ @@ -151,9 +321,56 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 782AC69C25F0DF3000554BF4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 782AC6AB25F0DF3100554BF4 /* Main.storyboard in Resources */, + 782AC6A825F0DF3100554BF4 /* Preview Assets.xcassets in Resources */, + 782AC6A525F0DF3100554BF4 /* Assets.xcassets in Resources */, + 782AC6BC25F0DFF200554BF4 /* MapViewController.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 782AC6C325F0E2A300554BF4 /* SwiftLint */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = SwiftLint; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "if which swiftlint >/dev/null; then\n swiftlint autocorrect && swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; + }; + 782AC6C825F0E2DC00554BF4 /* Codesign Offline Finder with Entitlements */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Codesign Offline Finder with Entitlements"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "#bin/sh\nidentities=$(security find-identity -p codesigning -v)\n#echo \"${identities}\"\npat=' ([0-9ABCDEF]+) '\n[[ $identities =~ $pat ]]\n# Can be set to a codesign identity manually\nIDT=\"${BASH_REMATCH[1]}\"\nif [ -z ${IDT+x} ]; then\n echo \"error: Please set the codesigning identity above. \\nThe identity can be found with $ security find-identities -v -p codesigning\"\nelse\n codesign --entitlements ${SRCROOT}/OFFetchReports/OfflineFinder.entitlements -fs ${IDT} ${TARGET_BUILD_DIR}/OFFetchReports.app/Contents/MacOS/OFFetchReports\n echo \"warning: This app will only run on macOS systems with SIP & AMFI disabled. This should only be done on dedicated test systems\"\nfi\n"; + }; 78FFC97C25EE98680062F878 /* SwiftLint */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -188,8 +405,34 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 782AC69A25F0DF3000554BF4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 782AC6D125F0E3F600554BF4 /* DecryptReports.swift in Sources */, + 782AC6B325F0DF7C00554BF4 /* OFFetchReportsMainView.swift in Sources */, + 782AC6D825F0E3FE00554BF4 /* ReportsFetcher.m in Sources */, + 782AC6BB25F0DFF200554BF4 /* MapViewController.swift in Sources */, + 782AC6B425F0DF7C00554BF4 /* MapView.swift in Sources */, + 782AC6BA25F0DFF200554BF4 /* SavePanel.swift in Sources */, + 782AC6A125F0DF3000554BF4 /* AppDelegate.swift in Sources */, + 782AC6C125F0E02200554BF4 /* BoringSSL.m in Sources */, + 782AC6D325F0E3F600554BF4 /* FindMyController.swift in Sources */, + 782AC6D225F0E3F600554BF4 /* FindMyKeyDecoder.swift in Sources */, + 782AC6D425F0E3F600554BF4 /* Models.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 782AC6CA25F0E2EB00554BF4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 782AC69D25F0DF3000554BF4 /* OFFetchReports */; + targetProxy = 782AC6C925F0E2EB00554BF4 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin PBXVariantGroup section */ 78097ECF248E27E800096FCA /* Main.storyboard */ = { isa = PBXVariantGroup; @@ -199,6 +442,14 @@ name = Main.storyboard; sourceTree = ""; }; + 782AC6A925F0DF3100554BF4 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 782AC6AA25F0DF3100554BF4 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -363,6 +614,70 @@ }; name = Release; }; + 782AC6AE25F0DF3100554BF4 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CODE_SIGN_ENTITLEMENTS = OFFetchReports/OFFetchReports.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_ASSET_PATHS = "\"OFFetchReports/Preview Content\""; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = OFFetchReports/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.15; + PRODUCT_BUNDLE_IDENTIFIER = "de.tu-darmstadt.seemoo.OFFetchReports"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/OFFetchReports/BoringSSL/Bridging-Header.h"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 782AC6AF25F0DF3100554BF4 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CODE_SIGN_ENTITLEMENTS = OFFetchReports/OFFetchReports.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_ASSET_PATHS = "\"OFFetchReports/Preview Content\""; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = OFFetchReports/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.15; + PRODUCT_BUNDLE_IDENTIFIER = "de.tu-darmstadt.seemoo.OFFetchReports"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/OFFetchReports/BoringSSL/Bridging-Header.h"; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 782AC6C625F0E2D200554BF4 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 782AC6C725F0E2D200554BF4 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -384,7 +699,57 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 782AC6B025F0DF3100554BF4 /* Build configuration list for PBXNativeTarget "OFFetchReports" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 782AC6AE25F0DF3100554BF4 /* Debug */, + 782AC6AF25F0DF3100554BF4 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 782AC6C525F0E2D200554BF4 /* Build configuration list for PBXAggregateTarget "Run OFFetchReports" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 782AC6C625F0E2D200554BF4 /* Debug */, + 782AC6C725F0E2D200554BF4 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + 782AC6D925F0E4C800554BF4 /* XCRemoteSwiftPackageReference "swift-nio-ssl" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/apple/swift-nio-ssl"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 2.10.4; + }; + }; + 782AC6DC25F0E4D900554BF4 /* XCRemoteSwiftPackageReference "swift-crypto" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/apple/swift-crypto.git"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 1.1.4; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 782AC6DA25F0E4C800554BF4 /* NIOSSL */ = { + isa = XCSwiftPackageProductDependency; + package = 782AC6D925F0E4C800554BF4 /* XCRemoteSwiftPackageReference "swift-nio-ssl" */; + productName = NIOSSL; + }; + 782AC6DD25F0E4D900554BF4 /* Crypto */ = { + isa = XCSwiftPackageProductDependency; + package = 782AC6DC25F0E4D900554BF4 /* XCRemoteSwiftPackageReference "swift-crypto" */; + productName = Crypto; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 78097EBB248E27E700096FCA /* Project object */; } diff --git a/CVE-2020-9986/OFReadKeys/OFReadKeys.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/CVE-2020-9986/OFReadKeys/OFReadKeys.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 0919091..919434a 100644 --- a/CVE-2020-9986/OFReadKeys/OFReadKeys.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/CVE-2020-9986/OFReadKeys/OFReadKeys.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/CVE-2020-9986/OFReadKeys/OFReadKeys.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/CVE-2020-9986/OFReadKeys/OFReadKeys.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..de2d6b4 --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFReadKeys.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,34 @@ +{ + "object": { + "pins": [ + { + "package": "swift-crypto", + "repositoryURL": "https://github.com/apple/swift-crypto.git", + "state": { + "branch": null, + "revision": "296d3308b4b2fa355cfe0de4ca411bf7a1cd8cf8", + "version": "1.1.4" + } + }, + { + "package": "swift-nio", + "repositoryURL": "https://github.com/apple/swift-nio.git", + "state": { + "branch": null, + "revision": "6d3ca7e54e06a69d0f2612c2ce8bb8b7319085a4", + "version": "2.26.0" + } + }, + { + "package": "swift-nio-ssl", + "repositoryURL": "https://github.com/apple/swift-nio-ssl", + "state": { + "branch": null, + "revision": "bbb38fbcbbe9dc4665b2c638dfa5681b01079bfb", + "version": "2.10.4" + } + } + ] + }, + "version": 1 +} diff --git a/CVE-2020-9986/OFReadKeys/OFReadKeys.xcodeproj/xcshareddata/xcschemes/OFFetchReports.xcscheme b/CVE-2020-9986/OFReadKeys/OFReadKeys.xcodeproj/xcshareddata/xcschemes/OFFetchReports.xcscheme new file mode 100644 index 0000000..93e4915 --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFReadKeys.xcodeproj/xcshareddata/xcschemes/OFFetchReports.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CVE-2020-9986/OFReadKeys/OFReadKeys.xcodeproj/xcshareddata/xcschemes/Run OFFetchReports.xcscheme b/CVE-2020-9986/OFReadKeys/OFReadKeys.xcodeproj/xcshareddata/xcschemes/Run OFFetchReports.xcscheme new file mode 100644 index 0000000..2b4c7f8 --- /dev/null +++ b/CVE-2020-9986/OFReadKeys/OFReadKeys.xcodeproj/xcshareddata/xcschemes/Run OFFetchReports.xcscheme @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CVE-2020-9986/OFReadKeys/OFReadKeys/FindMyKeyExtractor.swift b/CVE-2020-9986/OFReadKeys/OFReadKeys/FindMyKeyExtractor.swift index a79ac6e..40a37a4 100644 --- a/CVE-2020-9986/OFReadKeys/OFReadKeys/FindMyKeyExtractor.swift +++ b/CVE-2020-9986/OFReadKeys/OFReadKeys/FindMyKeyExtractor.swift @@ -53,7 +53,7 @@ struct FindMyKeyExtractor { .first?.appendingPathComponent(directoryPath) let folders = try fm.contentsOfDirectory(at: privateKeysPath!, includingPropertiesForKeys: nil, options: .skipsHiddenFiles) - guard folders.count > 0 else {throw FindMyError.noFoldersFound} + guard folders.isEmpty == false else {throw FindMyError.noFoldersFound} print("Found \(folders.count) folders") var devices = [FindMyDevice]() @@ -63,7 +63,7 @@ struct FindMyKeyExtractor { includingPropertiesForKeys: nil, options: .skipsHiddenFiles) // Check if keys are available print("Found \(keyFiles.count) in folder \(folderURL.lastPathComponent)") - guard keyFiles.count > 0 else {continue} + guard keyFiles.isEmpty == false else {continue} var device = FindMyDevice(deviceId: folderURL.lastPathComponent) for url in keyFiles { @@ -157,7 +157,7 @@ struct FindMyKeyExtractor { /// - Returns: An array of devices including their keys static func findKeyFilesInNewLocation() throws -> [FindMyDevice] { let keysFolders = self.findRamdomKeyFolder() - guard keysFolders.count > 0 else { + guard keysFolders.isEmpty == false else { throw NSError(domain: "error", code: NSNotFound, userInfo: nil) } @@ -193,7 +193,7 @@ struct FindMyKeyExtractor { for keyfileURL in keyFileURLs { // Read the key files let keyFile = try Data(contentsOf: keyfileURL) - if keyFile.count > 0 { + if keyFile.isEmpty == false { keyFiles.append(keyFile) } } diff --git a/OpenHaystack/.swiftlint.yml b/OpenHaystack/.swiftlint.yml index e3ad226..0b66e5a 100644 --- a/OpenHaystack/.swiftlint.yml +++ b/OpenHaystack/.swiftlint.yml @@ -20,8 +20,6 @@ analyzer_rules: # Rules run by `swiftlint analyze` (experimental) # configurable rules can be customized from this configuration file # binary rules can set their severity level force_cast: warning # implicitly -force_try: - severity: warning # explicitly # rules that have both warning and error levels, can set just the warning level # implicitly line_length: 180 diff --git a/OpenHaystack/OpenHaystack.xcodeproj/project.pbxproj b/OpenHaystack/OpenHaystack.xcodeproj/project.pbxproj index 845a2e6..9729c51 100644 --- a/OpenHaystack/OpenHaystack.xcodeproj/project.pbxproj +++ b/OpenHaystack/OpenHaystack.xcodeproj/project.pbxproj @@ -3,50 +3,17 @@ archiveVersion = 1; classes = { }; - objectVersion = 54; + objectVersion = 52; objects = { -/* Begin PBXAggregateTarget section */ - 78F7253325ED02300039C718 /* Run OFFetchReports */ = { - isa = PBXAggregateTarget; - buildConfigurationList = 78F7253625ED02300039C718 /* Build configuration list for PBXAggregateTarget "Run OFFetchReports" */; - buildPhases = ( - 78F7253D25ED02390039C718 /* Codesign Offline Finder with Entitlements */, - ); - dependencies = ( - 78F7253C25ED02350039C718 /* PBXTargetDependency */, - ); - name = "Run OFFetchReports"; - productName = "Create OfflineFinder"; - }; -/* End PBXAggregateTarget section */ - /* Begin PBXBuildFile section */ - 0211DBC12491203100ABB066 /* Crypto in Frameworks */ = {isa = PBXBuildFile; productRef = 0211DBC02491203100ABB066 /* Crypto */; }; - 0211DBC5249135D600ABB066 /* MapViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0211DBC3249135D600ABB066 /* MapViewController.xib */; }; - 0211DBC724913A8D00ABB066 /* MapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0211DBC624913A8D00ABB066 /* MapView.swift */; }; - 022253BA24E293B8006DF2B3 /* AuthKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0298C0C8248F9506003928FE /* AuthKit.framework */; }; - 022253BB24E293B8006DF2B3 /* AuthKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 0298C0C8248F9506003928FE /* AuthKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 024D98492490CE320063EBB6 /* BoringSSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 024D98482490CE320063EBB6 /* BoringSSL.m */; }; - 025DFEDC248FED250039C718 /* DecryptReports.swift in Sources */ = {isa = PBXBuildFile; fileRef = 025DFEDB248FED250039C718 /* DecryptReports.swift */; }; - 116B4EED24A913AA007BA636 /* SavePanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 116B4EEC24A913AA007BA636 /* SavePanel.swift */; }; 78014A2925DC08580089F6D9 /* MicrobitController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78014A2725DC01220089F6D9 /* MicrobitController.swift */; }; 78014A2B25DC22120089F6D9 /* sample.bin in Resources */ = {isa = PBXBuildFile; fileRef = 78014A2A25DC22110089F6D9 /* sample.bin */; }; 78014A2F25DC2F100089F6D9 /* pattern_sample.bin in Resources */ = {isa = PBXBuildFile; fileRef = 78014A2E25DC2F100089F6D9 /* pattern_sample.bin */; }; - 78108B70248E8FB50007E9C4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78108B6F248E8FB50007E9C4 /* AppDelegate.swift */; }; - 78108B72248E8FB50007E9C4 /* OFFetchReportsMainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78108B71248E8FB50007E9C4 /* OFFetchReportsMainView.swift */; }; - 78108B74248E8FB80007E9C4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 78108B73248E8FB80007E9C4 /* Assets.xcassets */; }; - 78108B77248E8FB80007E9C4 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 78108B76248E8FB80007E9C4 /* Preview Assets.xcassets */; }; - 78108B7A248E8FB80007E9C4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 78108B78248E8FB80007E9C4 /* Main.storyboard */; }; - 78108B85248E8FDD0007E9C4 /* ReportsFetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 78108B84248E8FDD0007E9C4 /* ReportsFetcher.m */; }; - 78108B8F248F70D40007E9C4 /* Models.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78108B8E248F70D40007E9C4 /* Models.swift */; }; - 78108B91248F72AF0007E9C4 /* FindMyController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78108B90248F72AF0007E9C4 /* FindMyController.swift */; }; 781EB3EA25DAD7EA00FEAA19 /* ReportsFetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 78108B84248E8FDD0007E9C4 /* ReportsFetcher.m */; }; 781EB3EB25DAD7EA00FEAA19 /* SavePanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 116B4EEC24A913AA007BA636 /* SavePanel.swift */; }; 781EB3EC25DAD7EA00FEAA19 /* DecryptReports.swift in Sources */ = {isa = PBXBuildFile; fileRef = 025DFEDB248FED250039C718 /* DecryptReports.swift */; }; - 781EB3EE25DAD7EA00FEAA19 /* OFFetchReportsMainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78108B71248E8FB50007E9C4 /* OFFetchReportsMainView.swift */; }; 781EB3EF25DAD7EA00FEAA19 /* MapViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0211DBC2249135D600ABB066 /* MapViewController.swift */; }; - 781EB3F025DAD7EA00FEAA19 /* MapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0211DBC624913A8D00ABB066 /* MapView.swift */; }; 781EB3F125DAD7EA00FEAA19 /* FindMyKeyDecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7867874724A651C600199B09 /* FindMyKeyDecoder.swift */; }; 781EB3F225DAD7EA00FEAA19 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78108B6F248E8FB50007E9C4 /* AppDelegate.swift */; }; 781EB3F325DAD7EA00FEAA19 /* Models.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78108B8E248F70D40007E9C4 /* Models.swift */; }; @@ -71,7 +38,6 @@ 78486BF425DD7AD90007ED87 /* sampleKeys.plist in Resources */ = {isa = PBXBuildFile; fileRef = 78486BF325DD7AD90007ED87 /* sampleKeys.plist */; }; 78486C0A25DDCC610007ED87 /* offline-finding.bin in Resources */ = {isa = PBXBuildFile; fileRef = 78486C0925DDCC610007ED87 /* offline-finding.bin */; }; 7851F1DD25EE90FA0049480D /* AccessoryMapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7851F1DC25EE90FA0049480D /* AccessoryMapView.swift */; }; - 7867874824A651C600199B09 /* FindMyKeyDecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7867874724A651C600199B09 /* FindMyKeyDecoder.swift */; }; 787D8AC125DECD3C00148766 /* AccessoryController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 787D8AC025DECD3C00148766 /* AccessoryController.swift */; }; 7899D1D625DE74EE00115740 /* firmware.bin in Resources */ = {isa = PBXBuildFile; fileRef = 7899D1D525DE74EE00115740 /* firmware.bin */; }; 7899D1E125DE97E200115740 /* IconSelectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7899D1E025DE97E200115740 /* IconSelectionView.swift */; }; @@ -81,14 +47,7 @@ 78EC227225DBC8CE0042B775 /* Accessory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78EC227125DBC8CE0042B775 /* Accessory.swift */; }; 78EC227525DBCCA00042B775 /* .swiftlint.yml in Resources */ = {isa = PBXBuildFile; fileRef = 78EC227425DBCCA00042B775 /* .swiftlint.yml */; }; 78EC227725DBDB7E0042B775 /* KeychainController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78EC227625DBDB7E0042B775 /* KeychainController.swift */; }; - F14B2BFE25EFA69B002DC056 /* AnisetteDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 781EB40F25DADB0600FEAA19 /* AnisetteDataManager.swift */; }; - F14B2C0725EFA730002DC056 /* ALTAnisetteData.m in Sources */ = {isa = PBXBuildFile; fileRef = 78286CB025E3ACE700F65511 /* ALTAnisetteData.m */; }; - F14B2C1425EFA7A5002DC056 /* MapViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0211DBC2249135D600ABB066 /* MapViewController.swift */; }; - F14B2C1925EFA7AB002DC056 /* Accessory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78EC227125DBC8CE0042B775 /* Accessory.swift */; }; - F14B2C1E25EFA7BA002DC056 /* AccessoryMapAnnotation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7899D1E825DEBF4800115740 /* AccessoryMapAnnotation.swift */; }; - F14B2C2325EFA7C7002DC056 /* AppleAccountData.m in Sources */ = {isa = PBXBuildFile; fileRef = 78286D2925E3EC3200F65511 /* AppleAccountData.m */; }; F16BA9E925E7DB2D00238183 /* NIOSSL in Frameworks */ = {isa = PBXBuildFile; productRef = F16BA9E825E7DB2D00238183 /* NIOSSL */; }; - F16BAA0D25E7DCFC00238183 /* NIOSSL in Frameworks */ = {isa = PBXBuildFile; productRef = F16BAA0C25E7DCFC00238183 /* NIOSSL */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -106,27 +65,9 @@ remoteGlobalIDString = 781EB3E425DAD7EA00FEAA19; remoteInfo = FindMyAccessory; }; - 78F7253B25ED02350039C718 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 78108B64248E8FB50007E9C4 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 78108B6B248E8FB50007E9C4; - remoteInfo = OfflineFinder; - }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ - 11A3D85124A8C623009BF754 /* Embed Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - 022253BB24E293B8006DF2B3 /* AuthKit.framework in Embed Frameworks */, - ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; 78286CD825E3AF6900F65511 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -152,7 +93,6 @@ /* Begin PBXFileReference section */ 0211DBC2249135D600ABB066 /* MapViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapViewController.swift; sourceTree = ""; }; 0211DBC3249135D600ABB066 /* MapViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MapViewController.xib; sourceTree = ""; }; - 0211DBC624913A8D00ABB066 /* MapView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapView.swift; sourceTree = ""; }; 024D98472490CE320063EBB6 /* BoringSSL.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BoringSSL.h; sourceTree = ""; }; 024D98482490CE320063EBB6 /* BoringSSL.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BoringSSL.m; sourceTree = ""; }; 025DFEDB248FED250039C718 /* DecryptReports.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DecryptReports.swift; sourceTree = ""; }; @@ -162,9 +102,7 @@ 78014A2725DC01220089F6D9 /* MicrobitController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MicrobitController.swift; sourceTree = ""; }; 78014A2A25DC22110089F6D9 /* sample.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; path = sample.bin; sourceTree = ""; }; 78014A2E25DC2F100089F6D9 /* pattern_sample.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; path = pattern_sample.bin; sourceTree = ""; }; - 78108B6C248E8FB50007E9C4 /* OFFetchReports.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OFFetchReports.app; sourceTree = BUILT_PRODUCTS_DIR; }; 78108B6F248E8FB50007E9C4 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 78108B71248E8FB50007E9C4 /* OFFetchReportsMainView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OFFetchReportsMainView.swift; sourceTree = ""; }; 78108B73248E8FB80007E9C4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 78108B76248E8FB80007E9C4 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 78108B79248E8FB80007E9C4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; @@ -208,16 +146,6 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 78108B69248E8FB50007E9C4 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 0211DBC12491203100ABB066 /* Crypto in Frameworks */, - 022253BA24E293B8006DF2B3 /* AuthKit.framework in Frameworks */, - F16BAA0D25E7DCFC00238183 /* NIOSSL in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 781EB3F625DAD7EA00FEAA19 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -270,7 +198,6 @@ 78108B6D248E8FB50007E9C4 /* Products */ = { isa = PBXGroup; children = ( - 78108B6C248E8FB50007E9C4 /* OFFetchReports.app */, 781EB40825DAD7EA00FEAA19 /* OpenHaystack.app */, 78EC226125DAE0BE0042B775 /* OpenHaystackTests.xctest */, 78286C8E25E3AC0400F65511 /* OpenHaystackMail.mailbundle */, @@ -283,7 +210,6 @@ children = ( 024D98402490CD7F0063EBB6 /* BoringSSL */, 78108B8D248F70CC0007E9C4 /* FindMy */, - 7851F1D725EE90B20049480D /* OFFetchReports */, 78108B87248E8FF10007E9C4 /* ReportsFetcher */, 78EC226E25DBC2FC0042B775 /* HaystackApp */, 781EB40F25DADB0600FEAA19 /* AnisetteDataManager.swift */, @@ -358,15 +284,6 @@ path = "Mail Plugin"; sourceTree = ""; }; - 7851F1D725EE90B20049480D /* OFFetchReports */ = { - isa = PBXGroup; - children = ( - 0211DBC624913A8D00ABB066 /* MapView.swift */, - 78108B71248E8FB50007E9C4 /* OFFetchReportsMainView.swift */, - ); - path = OFFetchReports; - sourceTree = ""; - }; 78EC226225DAE0BE0042B775 /* OpenHaystackTests */ = { isa = PBXGroup; children = ( @@ -420,28 +337,6 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 78108B6B248E8FB50007E9C4 /* OFFetchReports */ = { - isa = PBXNativeTarget; - buildConfigurationList = 78108B7F248E8FB80007E9C4 /* Build configuration list for PBXNativeTarget "OFFetchReports" */; - buildPhases = ( - 78108B68248E8FB50007E9C4 /* Sources */, - 78108B69248E8FB50007E9C4 /* Frameworks */, - 78108B6A248E8FB50007E9C4 /* Resources */, - 11A3D85124A8C623009BF754 /* Embed Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = OFFetchReports; - packageProductDependencies = ( - 0211DBC02491203100ABB066 /* Crypto */, - F16BAA0C25E7DCFC00238183 /* NIOSSL */, - ); - productName = OfflineFinder; - productReference = 78108B6C248E8FB50007E9C4 /* OFFetchReports.app */; - productType = "com.apple.product-type.application"; - }; 781EB3E425DAD7EA00FEAA19 /* OpenHaystack */ = { isa = PBXNativeTarget; buildConfigurationList = 781EB40525DAD7EA00FEAA19 /* Build configuration list for PBXNativeTarget "OpenHaystack" */; @@ -514,10 +409,6 @@ LastUpgradeCheck = 1240; ORGANIZATIONNAME = "SEEMOO - TU Darmstadt"; TargetAttributes = { - 78108B6B248E8FB50007E9C4 = { - CreatedOnToolsVersion = 11.5; - LastSwiftMigration = 1150; - }; 78286C8D25E3AC0400F65511 = { CreatedOnToolsVersion = 12.4; }; @@ -525,9 +416,6 @@ CreatedOnToolsVersion = 12.5; TestTargetID = 781EB3E425DAD7EA00FEAA19; }; - 78F7253325ED02300039C718 = { - CreatedOnToolsVersion = 12.4; - }; }; }; buildConfigurationList = 78108B67248E8FB50007E9C4 /* Build configuration list for PBXProject "OpenHaystack" */; @@ -550,24 +438,11 @@ 781EB3E425DAD7EA00FEAA19 /* OpenHaystack */, 78286C8D25E3AC0400F65511 /* OpenHaystackMail */, 78EC226025DAE0BE0042B775 /* OpenHaystackTests */, - 78108B6B248E8FB50007E9C4 /* OFFetchReports */, - 78F7253325ED02300039C718 /* Run OFFetchReports */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - 78108B6A248E8FB50007E9C4 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 78108B7A248E8FB80007E9C4 /* Main.storyboard in Resources */, - 0211DBC5249135D600ABB066 /* MapViewController.xib in Resources */, - 78108B77248E8FB80007E9C4 /* Preview Assets.xcassets in Resources */, - 78108B74248E8FB80007E9C4 /* Assets.xcassets in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 781EB3FC25DAD7EA00FEAA19 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -620,25 +495,6 @@ shellPath = /bin/sh; shellScript = "if which swiftlint >/dev/null; then\n swiftlint autocorrect && swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; }; - 78F7253D25ED02390039C718 /* Codesign Offline Finder with Entitlements */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - name = "Codesign Offline Finder with Entitlements"; - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "#bin/sh\nidentities=$(security find-identity -p codesigning -v)\n#echo \"${identities}\"\npat=' ([0-9ABCDEF]+) '\n[[ $identities =~ $pat ]]\n# Can be set to a codesign identity manually\nIDT=\"${BASH_REMATCH[1]}\"\nif [ -z ${IDT+x} ]; then\n echo \"error: Please set the codesigning identity above. \\nThe identity can be found with $ security find-identities -v -p codesigning\"\nelse\n codesign --entitlements ${SRCROOT}/OpenHaystack/OfflineFinder.entitlements -fs ${IDT} ${TARGET_BUILD_DIR}/OFFetchReports.app/Contents/MacOS/OFFetchReports\n echo \"warning: This app will only run on macOS systems with SIP & AMFI disabled. This should only be done on dedicated test systems\"\nfi\n"; - }; F14B2C7E25EFBB11002DC056 /* Set Version Number from Git */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -678,29 +534,6 @@ /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - 78108B68248E8FB50007E9C4 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 78108B85248E8FDD0007E9C4 /* ReportsFetcher.m in Sources */, - 116B4EED24A913AA007BA636 /* SavePanel.swift in Sources */, - F14B2C1425EFA7A5002DC056 /* MapViewController.swift in Sources */, - 025DFEDC248FED250039C718 /* DecryptReports.swift in Sources */, - 78108B72248E8FB50007E9C4 /* OFFetchReportsMainView.swift in Sources */, - 0211DBC724913A8D00ABB066 /* MapView.swift in Sources */, - 7867874824A651C600199B09 /* FindMyKeyDecoder.swift in Sources */, - 78108B70248E8FB50007E9C4 /* AppDelegate.swift in Sources */, - 78108B8F248F70D40007E9C4 /* Models.swift in Sources */, - 78108B91248F72AF0007E9C4 /* FindMyController.swift in Sources */, - F14B2BFE25EFA69B002DC056 /* AnisetteDataManager.swift in Sources */, - 024D98492490CE320063EBB6 /* BoringSSL.m in Sources */, - F14B2C0725EFA730002DC056 /* ALTAnisetteData.m in Sources */, - F14B2C1925EFA7AB002DC056 /* Accessory.swift in Sources */, - F14B2C1E25EFA7BA002DC056 /* AccessoryMapAnnotation.swift in Sources */, - F14B2C2325EFA7C7002DC056 /* AppleAccountData.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 781EB3E925DAD7EA00FEAA19 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -721,10 +554,8 @@ 78EC226C25DBC2E40042B775 /* OpenHaystackMainView.swift in Sources */, 78EC227225DBC8CE0042B775 /* Accessory.swift in Sources */, 78286E0225E66F9400F65511 /* AccessoryListEntry.swift in Sources */, - 781EB3EE25DAD7EA00FEAA19 /* OFFetchReportsMainView.swift in Sources */, 781EB3EF25DAD7EA00FEAA19 /* MapViewController.swift in Sources */, 78286D7725E5114600F65511 /* ActivityIndicator.swift in Sources */, - 781EB3F025DAD7EA00FEAA19 /* MapView.swift in Sources */, 781EB3F125DAD7EA00FEAA19 /* FindMyKeyDecoder.swift in Sources */, 787D8AC125DECD3C00148766 /* AccessoryController.swift in Sources */, 781EB3F225DAD7EA00FEAA19 /* AppDelegate.swift in Sources */, @@ -765,11 +596,6 @@ target = 781EB3E425DAD7EA00FEAA19 /* OpenHaystack */; targetProxy = 78EC226625DAE0BE0042B775 /* PBXContainerItemProxy */; }; - 78F7253C25ED02350039C718 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 78108B6B248E8FB50007E9C4 /* OFFetchReports */; - targetProxy = 78F7253B25ED02350039C718 /* PBXContainerItemProxy */; - }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -899,70 +725,6 @@ }; name = Release; }; - 78108B80248E8FB80007E9C4 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = ""; - CODE_SIGN_IDENTITY = "-"; - CODE_SIGN_STYLE = Manual; - COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_ASSET_PATHS = "\"OpenHaystack/Preview Content\""; - DEVELOPMENT_TEAM = ""; - ENABLE_HARDENED_RUNTIME = NO; - ENABLE_PREVIEWS = YES; - INFOPLIST_FILE = OpenHaystack/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - MACOSX_DEPLOYMENT_TARGET = 11.0; - OTHER_CFLAGS = "-DAUTHKIT"; - OTHER_SWIFT_FLAGS = "-DAUTHKIT"; - PRODUCT_BUNDLE_IDENTIFIER = "de.tu-darmstadt.seemoo.OfflineFinder"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_OBJC_BRIDGING_HEADER = "OpenHaystack-Bridging-Header.h"; - SWIFT_VERSION = 5.0; - SYSTEM_FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks", - ); - }; - name = Debug; - }; - 78108B81248E8FB80007E9C4 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_ENTITLEMENTS = ""; - CODE_SIGN_IDENTITY = "-"; - CODE_SIGN_STYLE = Manual; - COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_ASSET_PATHS = "\"OpenHaystack/Preview Content\""; - DEVELOPMENT_TEAM = ""; - ENABLE_HARDENED_RUNTIME = NO; - ENABLE_PREVIEWS = YES; - INFOPLIST_FILE = OpenHaystack/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - MACOSX_DEPLOYMENT_TARGET = 11.0; - OTHER_CFLAGS = "-DAUTHKIT"; - OTHER_SWIFT_FLAGS = "-DAUTHKIT"; - PRODUCT_BUNDLE_IDENTIFIER = "de.tu-darmstadt.seemoo.OfflineFinder"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_OBJC_BRIDGING_HEADER = "OpenHaystack-Bridging-Header.h"; - SWIFT_VERSION = 5.0; - SYSTEM_FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks", - ); - }; - name = Release; - }; 781EB40625DAD7EA00FEAA19 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1111,24 +873,6 @@ }; name = Release; }; - 78F7253425ED02300039C718 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = H9XHQ4WHSF; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 78F7253525ED02300039C718 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = H9XHQ4WHSF; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -1141,15 +885,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 78108B7F248E8FB80007E9C4 /* Build configuration list for PBXNativeTarget "OFFetchReports" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 78108B80248E8FB80007E9C4 /* Debug */, - 78108B81248E8FB80007E9C4 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; 781EB40525DAD7EA00FEAA19 /* Build configuration list for PBXNativeTarget "OpenHaystack" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -1177,15 +912,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 78F7253625ED02300039C718 /* Build configuration list for PBXAggregateTarget "Run OFFetchReports" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 78F7253425ED02300039C718 /* Debug */, - 78F7253525ED02300039C718 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ @@ -1216,11 +942,6 @@ /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ - 0211DBC02491203100ABB066 /* Crypto */ = { - isa = XCSwiftPackageProductDependency; - package = 0211DBBF2491203100ABB066 /* XCRemoteSwiftPackageReference "swift-crypto" */; - productName = Crypto; - }; 781EB3E725DAD7EA00FEAA19 /* Crypto */ = { isa = XCSwiftPackageProductDependency; package = 781EB3E825DAD7EA00FEAA19 /* XCRemoteSwiftPackageReference "swift-crypto" */; @@ -1231,11 +952,6 @@ package = F16BA9E725E7DB2D00238183 /* XCRemoteSwiftPackageReference "swift-nio-ssl" */; productName = NIOSSL; }; - F16BAA0C25E7DCFC00238183 /* NIOSSL */ = { - isa = XCSwiftPackageProductDependency; - package = F16BA9E725E7DB2D00238183 /* XCRemoteSwiftPackageReference "swift-nio-ssl" */; - productName = NIOSSL; - }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 78108B64248E8FB50007E9C4 /* Project object */; diff --git a/OpenHaystack/OpenHaystack/AppDelegate.swift b/OpenHaystack/OpenHaystack/AppDelegate.swift index c948855..5ad9acc 100644 --- a/OpenHaystack/OpenHaystack/AppDelegate.swift +++ b/OpenHaystack/OpenHaystack/AppDelegate.swift @@ -14,14 +14,10 @@ class AppDelegate: NSObject, NSApplicationDelegate { var window: NSWindow! private var mainView: some View { - #if ACCESSORY if ProcessInfo().arguments.contains("-preview") { return OpenHaystackMainView(accessoryController: AccessoryController(accessories: PreviewData.accessories)) } return OpenHaystackMainView() - #else - return OFFetchReportsMainView() - #endif } func applicationDidFinishLaunching(_ aNotification: Notification) { diff --git a/OpenHaystack/OpenHaystack/BoringSSL/BoringSSL.m b/OpenHaystack/OpenHaystack/BoringSSL/BoringSSL.m index 827b1c0..8afe6e5 100644 --- a/OpenHaystack/OpenHaystack/BoringSSL/BoringSSL.m +++ b/OpenHaystack/OpenHaystack/BoringSSL/BoringSSL.m @@ -44,8 +44,9 @@ BIO *bio = BIO_new(BIO_s_mem()); ERR_print_errors(bio); char *buf; - size_t len = BIO_get_mem_data(bio, &buf); - NSLog(@"Generating shared key failed %s", buf); + BIO_get_mem_data(bio, &buf); + NSLog(@"Generating shared key failed %s", buf); + free(buf); BIO_free(bio); } diff --git a/OpenHaystack/OpenHaystack/FindMy/FindMyKeyDecoder.swift b/OpenHaystack/OpenHaystack/FindMy/FindMyKeyDecoder.swift index 666b208..61b9ed0 100644 --- a/OpenHaystack/OpenHaystack/FindMy/FindMyKeyDecoder.swift +++ b/OpenHaystack/OpenHaystack/FindMy/FindMyKeyDecoder.swift @@ -12,7 +12,9 @@ import CryptoKit class FindMyKeyDecoder { /// Key files can be in different format. The old <= 10.15.3 have been using normal plists. Newer once use a binary format which needs different parsing enum KeyFileFormat { - /// Catalina > 10.15.4 key file format | Big Sur 11.0 Beta 1 uses a similar key file format that can be parsed identically. macOS 10.15.7 uses a new key file format that has not been reversed yet. (The key files are protected by sandboxing and only usable from a SIP disabled) + /// Catalina > 10.15.4 key file format | Big Sur 11.0 Beta 1 uses a similar key file format that can be parsed identically. + /// macOS 10.15.7 uses a new key file format that has not been reversed yet. + /// (The key files are protected by sandboxing and only usable from a SIP disabled) case catalina_10_15_4 } diff --git a/OpenHaystack/OpenHaystack/FindMy/Models.swift b/OpenHaystack/OpenHaystack/FindMy/Models.swift index 5c26ca0..ab18cc3 100755 --- a/OpenHaystack/OpenHaystack/FindMy/Models.swift +++ b/OpenHaystack/OpenHaystack/FindMy/Models.swift @@ -46,7 +46,7 @@ struct FindMyKey: Codable { self.yCoordinate = yCoordinate self.fullKey = fullKey } - + init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.advertisedKey = try container.decode(Data.self, forKey: .advertisedKey) @@ -54,10 +54,10 @@ struct FindMyKey: Codable { let privateKey = try container.decode(Data.self, forKey: .privateKey) if privateKey.count == 85 { self.privateKey = privateKey.subdata(in: 57..