mirror of
https://github.com/majd/ipatool
synced 2026-12-01 03:28:04 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5009048d44 | ||
|
|
59fb28cee0 | ||
|
|
5f1fb02a12 | ||
|
|
32c6012918 |
No files matched your search
@@ -34,13 +34,16 @@ To search for apps on the App Store, use the `search` command.
|
||||
```
|
||||
OVERVIEW: Search for iOS apps available on the App Store.
|
||||
|
||||
USAGE: ipatool search [--limit <limit>] <term> [--log-level <log-level>]
|
||||
USAGE: ipatool search <term> [--limit <limit>] [--country <country>] [--log-level <log-level>]
|
||||
|
||||
ARGUMENTS:
|
||||
<term> The term to search for.
|
||||
|
||||
OPTIONS:
|
||||
--limit <limit> (default: 5)
|
||||
-l, --limit <limit> The maximum amount of search results to retrieve.
|
||||
(default: 5)
|
||||
-c, --country <country> The two-letter (ISO 3166-1 alpha-2) country code for
|
||||
the iTunes Store. (default: US)
|
||||
--log-level <log-level> (default: info)
|
||||
--version Show the version.
|
||||
-h, --help Show help information.
|
||||
@@ -51,7 +54,7 @@ To download a copy of the ipa file, use the `download` command.
|
||||
```
|
||||
OVERVIEW: Download (encrypted) iOS app packages from the App Store.
|
||||
|
||||
USAGE: ipatool download --bundle-identifier <bundle-identifier> [--email <email>] [--password <password>] [--log-level <log-level>]
|
||||
USAGE: ipatool download --bundle-identifier <bundle-identifier> [--email <email>] [--password <password>] [--country <country>] [--log-level <log-level>]
|
||||
|
||||
OPTIONS:
|
||||
-b, --bundle-identifier <bundle-identifier>
|
||||
@@ -59,6 +62,8 @@ OPTIONS:
|
||||
-e, --email <email> The email address for the Apple ID.
|
||||
-p, --password <password>
|
||||
The password for the Apple ID.
|
||||
-c, --country <country> The two-letter (ISO 3166-1 alpha-2) country code for
|
||||
the iTunes Store. (default: US)
|
||||
--log-level <log-level> (default: info)
|
||||
--version Show the version.
|
||||
-h, --help Show help information.
|
||||
@@ -80,6 +85,6 @@ Maybe, but probably not. While this tool communicates with iTunes and the App St
|
||||
|
||||
**No**. This is is not a piracy tool; you can only download apps that you have previously installed on your iOS device. This limitation applies to free apps as well. Essentially, your account must already have a license for the app you are trying to download.
|
||||
|
||||
**Can I use this tool to sideload unuspported iOS apps on Apple Silicon Macs?**
|
||||
**Can I use this tool to sideload unsupported iOS apps on Apple Silicon Macs?**
|
||||
|
||||
While it was previously possible to download ipa files using this tool and install them on Macs running on Apple Silicon, this is no longer the case as of recently. Apple stopped serving macOS compatible `sinf` data for the app package. You could, however, use this tool to get a copy of the iOS app and use a jailbroken iOS device to strip any codesigning requirements then codesign the app again using an adhoc signature to run on Apple Silicon.
|
||||
While it was previously possible to download ipa files using this tool and install them on Macs running on Apple Silicon, this is no longer the case as of recently. Apple stopped serving macOS compatible `sinf` data for the app package. You could, however, use this tool to get a copy of the iOS app and use a jailbroken iOS device to strip any codesigning requirements then codesign the app again using an adhoc signature to run on Apple Silicon.
|
||||
@@ -22,6 +22,9 @@ struct Download: ParsableCommand {
|
||||
@Option(name: [.short, .customLong("password")], help: "The password for the Apple ID.")
|
||||
private var passwordArgument: String?
|
||||
|
||||
@Option(name: [.short, .long], help: "The two-letter (ISO 3166-1 alpha-2) country code for the iTunes Store.")
|
||||
private var country: String = "US"
|
||||
|
||||
@Option
|
||||
private var logLevel: LogLevel = .info
|
||||
|
||||
@@ -29,7 +32,7 @@ struct Download: ParsableCommand {
|
||||
}
|
||||
|
||||
extension Download {
|
||||
mutating func app(with bundleIdentifier: String) -> iTunesResponse.Result {
|
||||
mutating func app(with bundleIdentifier: String, country: String) -> iTunesResponse.Result {
|
||||
logger.log("Creating HTTP client...", level: .debug)
|
||||
let httpClient = HTTPClient(urlSession: URLSession.shared)
|
||||
|
||||
@@ -37,8 +40,8 @@ extension Download {
|
||||
let itunesClient = iTunesClient(httpClient: httpClient)
|
||||
|
||||
do {
|
||||
logger.log("Querying the iTunes Store for '\(bundleIdentifier)'...", level: .info)
|
||||
return try itunesClient.lookup(bundleIdentifier: bundleIdentifier)
|
||||
logger.log("Querying the iTunes Store for '\(bundleIdentifier)' in country '\(country)'...", level: .info)
|
||||
return try itunesClient.lookup(bundleIdentifier: bundleIdentifier, country: country)
|
||||
} catch {
|
||||
logger.log("\(error)", level: .debug)
|
||||
|
||||
@@ -199,7 +202,7 @@ extension Download {
|
||||
|
||||
mutating func run() throws {
|
||||
// Query for app
|
||||
let app: iTunesResponse.Result = app(with: bundleIdentifier)
|
||||
let app: iTunesResponse.Result = app(with: bundleIdentifier, country: country)
|
||||
logger.log("Found app: \(app.name) (\(app.version)).", level: .debug)
|
||||
|
||||
// Get Apple ID email
|
||||
|
||||
@@ -11,7 +11,7 @@ struct IPATool: ParsableCommand {
|
||||
static var configuration: CommandConfiguration {
|
||||
return .init(commandName: "ipatool",
|
||||
abstract: "A cli tool for interacting with Apple's ipa files.",
|
||||
version: "1.0.3",
|
||||
version: "1.0.4",
|
||||
subcommands: [Download.self, Search.self])
|
||||
}
|
||||
}
|
||||
@@ -13,11 +13,14 @@ struct Search: ParsableCommand {
|
||||
return .init(abstract: "Search for iOS apps available on the App Store.")
|
||||
}
|
||||
|
||||
@Option
|
||||
@Argument(help: "The term to search for.")
|
||||
private var term: String
|
||||
|
||||
@Option(name: [.short, .long], help: "The maximum amount of search results to retrieve.")
|
||||
private var limit: Int = 5
|
||||
|
||||
@Argument(help: "The term to search for.")
|
||||
var term: String
|
||||
@Option(name: [.short, .long], help: "The two-letter (ISO 3166-1 alpha-2) country code for the iTunes Store.")
|
||||
private var country: String = "US"
|
||||
|
||||
@Option
|
||||
private var logLevel: LogLevel = .info
|
||||
@@ -26,7 +29,7 @@ struct Search: ParsableCommand {
|
||||
}
|
||||
|
||||
extension Search {
|
||||
mutating func results(with term: String) -> [iTunesResponse.Result] {
|
||||
mutating func results(with term: String, country: String) -> [iTunesResponse.Result] {
|
||||
logger.log("Creating HTTP client...", level: .debug)
|
||||
let httpClient = HTTPClient(urlSession: URLSession.shared)
|
||||
|
||||
@@ -34,8 +37,8 @@ extension Search {
|
||||
let itunesClient = iTunesClient(httpClient: httpClient)
|
||||
|
||||
do {
|
||||
logger.log("Searching for '\(term)'...", level: .info)
|
||||
let results = try itunesClient.search(term: term, limit: limit)
|
||||
logger.log("Searching for '\(term)' using the '\(country)' store front...", level: .info)
|
||||
let results = try itunesClient.search(term: term, limit: limit, country: country)
|
||||
|
||||
guard !results.isEmpty else {
|
||||
logger.log("No results found.", level: .error)
|
||||
@@ -52,7 +55,7 @@ extension Search {
|
||||
|
||||
mutating func run() throws {
|
||||
// Search the iTunes store
|
||||
let results = results(with: term)
|
||||
let results = results(with: term, country: country)
|
||||
|
||||
// Compile output
|
||||
let output = results
|
||||
|
||||
@@ -8,16 +8,16 @@
|
||||
import Foundation
|
||||
|
||||
protocol iTunesClientInterface {
|
||||
func lookup(bundleIdentifier: String, completion: @escaping (Result<iTunesResponse.Result, Error>) -> Void)
|
||||
func search(term: String, limit: Int, completion: @escaping (Result<[iTunesResponse.Result], Error>) -> Void)
|
||||
func lookup(bundleIdentifier: String, country: String, completion: @escaping (Result<iTunesResponse.Result, Error>) -> Void)
|
||||
func search(term: String, limit: Int, country: String, completion: @escaping (Result<[iTunesResponse.Result], Error>) -> Void)
|
||||
}
|
||||
|
||||
extension iTunesClientInterface {
|
||||
func lookup(bundleIdentifier: String) throws -> iTunesResponse.Result {
|
||||
func lookup(bundleIdentifier: String, country: String) throws -> iTunesResponse.Result {
|
||||
let semaphore = DispatchSemaphore(value: 0)
|
||||
var result: Result<iTunesResponse.Result, Error>?
|
||||
|
||||
lookup(bundleIdentifier: bundleIdentifier) {
|
||||
lookup(bundleIdentifier: bundleIdentifier, country: country) {
|
||||
result = $0
|
||||
semaphore.signal()
|
||||
}
|
||||
@@ -34,11 +34,11 @@ extension iTunesClientInterface {
|
||||
}
|
||||
}
|
||||
|
||||
func search(term: String, limit: Int) throws -> [iTunesResponse.Result] {
|
||||
func search(term: String, limit: Int, country: String) throws -> [iTunesResponse.Result] {
|
||||
let semaphore = DispatchSemaphore(value: 0)
|
||||
var result: Result<[iTunesResponse.Result], Error>?
|
||||
|
||||
search(term: term, limit: limit) {
|
||||
search(term: term, limit: limit, country: country) {
|
||||
result = $0
|
||||
semaphore.signal()
|
||||
}
|
||||
@@ -63,8 +63,8 @@ final class iTunesClient: iTunesClientInterface {
|
||||
self.httpClient = httpClient
|
||||
}
|
||||
|
||||
func lookup(bundleIdentifier: String, completion: @escaping (Result<iTunesResponse.Result, Swift.Error>) -> Void) {
|
||||
let request = iTunesRequest.lookup(bundleIdentifier: bundleIdentifier)
|
||||
func lookup(bundleIdentifier: String, country: String, completion: @escaping (Result<iTunesResponse.Result, Swift.Error>) -> Void) {
|
||||
let request = iTunesRequest.lookup(bundleIdentifier: bundleIdentifier, country: country)
|
||||
|
||||
httpClient.send(request) { result in
|
||||
switch result {
|
||||
@@ -82,8 +82,8 @@ final class iTunesClient: iTunesClientInterface {
|
||||
}
|
||||
}
|
||||
|
||||
func search(term: String, limit: Int, completion: @escaping (Result<[iTunesResponse.Result], Swift.Error>) -> Void) {
|
||||
let request = iTunesRequest.search(term: term, limit: limit)
|
||||
func search(term: String, limit: Int, country: String, completion: @escaping (Result<[iTunesResponse.Result], Swift.Error>) -> Void) {
|
||||
let request = iTunesRequest.search(term: term, limit: limit, country: country)
|
||||
|
||||
httpClient.send(request) { result in
|
||||
switch result {
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
import Foundation
|
||||
|
||||
enum iTunesRequest {
|
||||
case search(term: String, limit: Int)
|
||||
case lookup(bundleIdentifier: String)
|
||||
case search(term: String, limit: Int, country: String)
|
||||
case lookup(bundleIdentifier: String, country: String)
|
||||
}
|
||||
|
||||
extension iTunesRequest: HTTPRequest {
|
||||
@@ -28,10 +28,10 @@ extension iTunesRequest: HTTPRequest {
|
||||
|
||||
var payload: HTTPPayload? {
|
||||
switch self {
|
||||
case let .lookup(bundleIdentifier):
|
||||
return .urlEncoding(["media": "software", "bundleId": bundleIdentifier, "limit": "1"])
|
||||
case let .search(term, limit):
|
||||
return .urlEncoding(["media": "software", "term": term, "limit": "\(limit)"])
|
||||
case let .lookup(bundleIdentifier, country):
|
||||
return .urlEncoding(["media": "software", "bundleId": bundleIdentifier, "limit": "1", "country": country])
|
||||
case let .search(term, limit, country):
|
||||
return .urlEncoding(["media": "software", "term": term, "limit": "\(limit)", "country": country])
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,8 +122,8 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A9CA48CC2658FBF700BC09D5 /* Download.swift */,
|
||||
A9CA49022659627A00BC09D5 /* Search.swift */,
|
||||
A9CA48CE2658FC7400BC09D5 /* IPATool.swift */,
|
||||
A9CA49022659627A00BC09D5 /* Search.swift */,
|
||||
);
|
||||
path = Commands;
|
||||
sourceTree = "<group>";
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
<CommandLineArguments>
|
||||
<CommandLineArgument
|
||||
argument = "download --help"
|
||||
isEnabled = "NO">
|
||||
isEnabled = "YES">
|
||||
</CommandLineArgument>
|
||||
<CommandLineArgument
|
||||
argument = "download -b com.apple.TestFlight"
|
||||
@@ -65,7 +65,7 @@
|
||||
</CommandLineArgument>
|
||||
<CommandLineArgument
|
||||
argument = "search TestFlight --limit 5"
|
||||
isEnabled = "YES">
|
||||
isEnabled = "NO">
|
||||
</CommandLineArgument>
|
||||
</CommandLineArguments>
|
||||
</LaunchAction>
|
||||
|
||||
Reference in new issue
Block a user