Some notes, tools, and techniques for reverse engineering macOS binaries.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env rust-script | |
//! ```cargo | |
//! [dependencies] | |
//! serde = { version = "1.0", features = ["derive"] } | |
//! serde_json = "1.0" | |
//! colored = "2.0" | |
//! cli-tables = "0.1.0" | |
//! ``` | |
use cli_tables::Table; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
/** | |
Extension to save/load a JSON object by filename. (".json" extension is assumed and automatically added.) | |
*/ | |
extension JSONSerialization { | |
static func loadJSON(withFilename filename: String) throws -> Any? { | |
let fm = FileManager.default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Publisher { | |
func awaitSink(cancellable: inout Set<AnyCancellable>) async throws -> Output { | |
return try await withCheckedThrowingContinuation { continuation in | |
self.sink { completion in | |
switch completion { | |
case .finished: | |
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MacOSAppsInfoFetcher { | |
var query: NSMetadataQuery? { | |
willSet { | |
if let query = self.query { | |
query.stop() | |
} | |
} | |
} |