Compare commits

...
8 Commits
Author SHA1 Message Date
Majd Alfhaily 8619332e52 Align version (1.0.2) 2021-05-24 12:36:33 +02:00
Majd Alfhaily 6db68b6bd2 Handle invalid license errors 2021-05-23 19:01:23 +02:00
Majd Alfhaily 3c90c45dab Add Makefile 2021-05-23 11:38:54 +02:00
Majd Alfhaily 94fc3a6d47 Align version (1.0.1) 2021-05-23 11:06:59 +02:00
Majd Alfhaily 0f517f43f6 Update readme 2021-05-23 11:00:44 +02:00
Majd Alfhaily 8165331378 Fix grammatical error 2021-05-23 10:59:12 +02:00
Majd Alfhaily bed12a55a9 Reorder search command arguments 2021-05-23 10:57:31 +02:00
Majd Alfhaily 73a416c917 Add readme 2021-05-22 21:55:14 +02:00
9 changed files with 150 additions and 12 deletions

No files matched your search

+1
View File
@@ -59,6 +59,7 @@ DerivedData/
*.ipa
*.dSYM.zip
*.dSYM
.build*
## Playgrounds
timeline.xctimeline
+17
View File
@@ -0,0 +1,17 @@
prefix ?= /usr/local
bindir = $(prefix)/bin
build:
xcodebuild -scheme ipatool -configuration release -archivePath .build archive
install: build
install -d "$(bindir)"
install ".build.xcarchive/Products/$(bindir)/ipatool" "$(bindir)"
uninstall:
rm -rf "$(bindir)/ipatool"
clean:
rm -rf .build.xcarchive
.PHONY: build install uninstall clean
+70
View File
@@ -0,0 +1,70 @@
# IPATool
[![Release](https://img.shields.io/github/release/majd/ipatool.svg)](https://GitHub.com/majd/ipatool/releases/)
![Swift](https://img.shields.io/badge/Swift-5.x-green.svg)
![macOS](https://img.shields.io/badge/macOS-10.11%2B-green.svg)
[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/majd/ipatool/blob/main/LICENSE)
`ipatool` is a command line tool that allows you to search for iOS apps on the [App Store](https://apps.apple.com) and download a copy of the app package, known as an _ipa_ file.
![Demo](./demo.gif)
## Requirements
* macOS 10.11 or later.
* Apple ID set up to use the App Store.
## Usage
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>]
ARGUMENTS:
<term> The term to search for.
OPTIONS:
--limit <limit> (default: 5)
--log-level <log-level> (default: info)
--version Show the version.
-h, --help Show help information.
```
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>]
OPTIONS:
-b, --bundle-identifier <bundle-identifier>
The bundle identifier of the target iOS app.
-e, --email <email> The email address for the Apple ID.
-p, --password <password>
The password for the Apple ID.
--log-level <log-level> (default: info)
--version Show the version.
-h, --help Show help information.
```
**Note:** You can specify the Apple ID email address and username as arguments when using the tool or by setting them as environment variables (`IPATOOL_EMAIL` and `IPATOOL_PASSWORD`). If you do not specify this information using either of those methods, the tool will prompt for user input in an interactive session.
## Common Knowledge
**Are my Apple ID credentials stored safely?**
The tool does not store your credentials anywhere and it only communicates with Apple servers directly. Feel free to go through the source code.
**Will my Apple ID get flagged for using this tool?**
Maybe, but probably not. While this tool communicates with iTunes and the App Store directly, mimicking the behavior of iTunes running on macOS, I cannot guarrantee its safety. I recommend using a throwaway Apple ID. **Use this tool your own risk**.
**Can I use this tool to download paid apps without paying for them?**
**No**. This is is not a piracy tool; you can only download apps that you have previously install 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?**
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.
+30 -3
View File
@@ -138,7 +138,27 @@ extension Download {
logger.log("Authenticated as '\(account.firstName) \(account.lastName)'.", level: .info)
logger.log("Requesting a signed copy of '\(app.identifier)' from the App Store...", level: .info)
let item = try storeClient.item(identifier: "\(app.identifier)", directoryServicesIdentifier: account.directoryServicesIdentifier)
let item: StoreResponse.Item
do {
item = try storeClient.item(identifier: "\(app.identifier)", directoryServicesIdentifier: account.directoryServicesIdentifier)
} catch {
logger.log("\(error)", level: .debug)
switch error {
case StoreClient.Error.invalidResponse:
logger.log("Received invalid response.", level: .error)
case StoreResponse.Error.invalidItem:
logger.log("Received invalid store item.", level: .error)
case StoreResponse.Error.invalidLicense:
logger.log("Your Apple ID does not have a license for this app. Download the app on an iOS device to obtain a license.", level: .error)
default:
logger.log("An unknown error has occurred.", level: .error)
}
_exit(1)
}
logger.log("Received a response of the signed copy: \(item.md5).", level: .debug)
logger.log("Creating signature client...", level: .debug)
@@ -158,8 +178,15 @@ extension Download {
logger.log("Saved app package to \(URL(fileURLWithPath: path).lastPathComponent).", level: .info)
logger.log("Applying patches...", level: .info)
try signatureClient.appendMetadata(item: item, email: email)
try signatureClient.appendSignature(item: item)
do {
try signatureClient.appendMetadata(item: item, email: email)
try signatureClient.appendSignature(item: item)
} catch {
logger.log("\(error)", level: .debug)
logger.log("Failed to apply patches. The ipa file will be left incomplete.", level: .error)
_exit(1)
}
logger.log("Done.", level: .info)
}
@@ -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.0",
version: "1.0.2",
subcommands: [Download.self, Search.self])
}
}
+9 -4
View File
@@ -13,14 +13,14 @@ struct Search: ParsableCommand {
return .init(abstract: "Search for iOS apps available on the App Store.")
}
@Option
private var logLevel: LogLevel = .info
@Option
private var limit: Int = 5
@Argument(help: "The term to search for.")
var term: String
@Option
private var logLevel: LogLevel = .info
}
extension Search {
@@ -42,7 +42,12 @@ extension Search {
_exit(1)
}
logger.log("Found \(results.count) results:\n\(results.enumerated().map({ "\($0 + 1). \($1.name): \($1.bundleIdentifier) (\($1.version))." }).joined(separator: "\n"))", level: .info)
let output = results
.enumerated()
.map({ "\($0 + 1). \($1.name): \($1.bundleIdentifier) (\($1.version))." })
.joined(separator: "\n")
logger.log("Found \(results.count) \(results.count == 1 ? "result" : "results"):\n\(output)", level: .info)
} catch {
logger.log("\(error)", level: .debug)
logger.log("An unknown error has occurred.", level: .error)
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

+1 -1
View File
@@ -113,7 +113,6 @@
A9CA48D02659138600BC09D5 /* Networking */,
A9CA48F6265942A600BC09D5 /* Signature */,
A9CA48EA265929E000BC09D5 /* Store */,
A9CA48CE2658FC7400BC09D5 /* IPATool.swift */,
A9CA48C12658F93F00BC09D5 /* main.swift */,
);
path = Source;
@@ -124,6 +123,7 @@
children = (
A9CA48CC2658FBF700BC09D5 /* Download.swift */,
A9CA49022659627A00BC09D5 /* Search.swift */,
A9CA48CE2658FC7400BC09D5 /* IPATool.swift */,
);
path = Commands;
sourceTree = "<group>";
@@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A9CA48BD2658F93F00BC09D5"
BuildableName = "IPATool"
BuildableName = "ipatool"
BlueprintName = "IPATool"
ReferencedContainer = "container:ipatool.xcodeproj">
</BuildableReference>
@@ -45,11 +45,29 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A9CA48BD2658F93F00BC09D5"
BuildableName = "IPATool"
BuildableName = "ipatool"
BlueprintName = "IPATool"
ReferencedContainer = "container:ipatool.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "download --help"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "download -b com.apple.TestFlight"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "search --help"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "search TestFlight --limit 1"
isEnabled = "NO">
</CommandLineArgument>
</CommandLineArguments>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
@@ -62,7 +80,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A9CA48BD2658F93F00BC09D5"
BuildableName = "IPATool"
BuildableName = "ipatool"
BlueprintName = "IPATool"
ReferencedContainer = "container:ipatool.xcodeproj">
</BuildableReference>