Coder Social home page Coder Social logo

majd / ipatool Goto Github PK

View Code? Open in Web Editor NEW
5.1K 53.0 450.0 682 KB

Command-line tool that allows searching and downloading app packages (known as ipa files) from the iOS App Store

License: MIT License

Shell 0.12% Go 99.88%
ios appstore apple ipa itunes cli macos reverse-engineering security swift

ipatool's Introduction

IPATool

Release License

ipatool is a command line tool that allows you to search for iOS apps on the App Store and download a copy of the app package, known as an ipa file.

Demo

Requirements

  • Supported operating system (Windows, Linux or macOS).
  • Apple ID set up to use the App Store.

Installation

Manual

You can grab the latest version of ipatool from GitHub releases.

Package Manager (macOS)

You can install ipatool using Homebrew.

$ brew tap majd/repo
$ brew install ipatool

Usage

To authenticate with the App Store, use the auth command.

Authenticate with the App Store

Usage:
  ipatool auth [command]

Available Commands:
  info        Show current account info
  login       Login to the App Store
  revoke      Revoke your App Store credentials

Flags:
  -h, --help   help for auth

Global Flags:
      --format format     sets output format for command; can be 'text', 'json' (default text)
      --non-interactive   run in non-interactive session
      --verbose           enables verbose logs

Use "ipatool auth [command] --help" for more information about a command.

To search for apps on the App Store, use the search command.

Search for iOS apps available on the App Store

Usage:
  ipatool search <term> [flags]

Flags:
  -h, --help        help for search
  -l, --limit int   maximum amount of search results to retrieve (default 5)

Global Flags:
      --format format     sets output format for command; can be 'text', 'json' (default text)
      --non-interactive   run in non-interactive session
      --verbose           enables verbose logs

To obtain a license for an app, use the purchase command.

Obtain a license for the app from the App Store

Usage:
  ipatool purchase [flags]

Flags:
  -b, --bundle-identifier string   Bundle identifier of the target iOS app (required)
  -h, --help                       help for purchase

Global Flags:
      --format format     sets output format for command; can be 'text', 'json' (default text)
      --non-interactive   run in non-interactive session
      --verbose           enables verbose logs

To download a copy of the ipa file, use the download command.

Download (encrypted) iOS app packages from the App Store

Usage:
  ipatool download [flags]

Flags:
  -i, --app-id int                 ID of the target iOS app (required)
  -b, --bundle-identifier string   The bundle identifier of the target iOS app (overrides the app ID)
  -h, --help                       help for download
  -o, --output string              The destination path of the downloaded app package
      --purchase                   Obtain a license for the app if needed

Global Flags:
      --format format                sets output format for command; can be 'text', 'json' (default text)
      --keychain-passphrase string   passphrase for unlocking keychain
      --non-interactive              run in non-interactive session
      --verbose                      enables verbose logs

Note: the tool runs in interactive mode by default. Use the --non-interactive flag if running in an automated environment.

Compiling

The tool can be compiled using the Go toolchain.

$ go build -o ipatool

Unit tests can be executed with the following commands.

$ go generate github.com/majd/ipatool/...
$ go test -v github.com/majd/ipatool/...

License

IPATool is released under the MIT license.

ipatool's People

Contributors

00defeat avatar altfoxie avatar baltpeter avatar chedabob avatar dependabot[bot] avatar dleovl avatar itaybre avatar kotori2 avatar liorazi avatar majd avatar mikestech avatar n-thumann avatar nishanths avatar testwill avatar virb3 avatar zntfdr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ipatool's Issues

Allow setting the Software Version External Identifier

SVEIDs are (presumably) used by iTunes to grab app versions for downloading a specific version of an app. AppStore++, Adowngrader, and App Admin use this to downgrade apps, and I believe the App Store itself uses it when you're on an older version of iOS than the latest version supports.

Adowngrader is open source, maybe something helpful is there.

Support for Apple TV

Support for tvOS ipas would be useful

I saw some work was started in #27 and wanted to create a tracking issue for similar efforts going forward.

How to run this tool?

I am sorry for this silly question but I am not able to figure out how can I use/install this tool?

Unable to login with 2FA

I'm trying to download an ipa like any user I guess..
but the problem is that I can't get past the authentication, my appleid has 2FA
I don't know what's the default approach here, this is the first time I try this.
anyway when I put my appleid and password, it instantly gives me unknown error..
I tried debug log but it made this even more weird.
this is a screenshot of what's happening:

image

Linux support

I've been trying to compile this on Linux and been exploring the feasibility of a port. After a couple of changes (which are pretty dirty because I've never worked with Swift), I could get the program to compile.

However, the login fails because of invalid credentials:

root@139ae75041b2:~/ipatool# .build/aarch64-unknown-linux-gnu/release/ipatool auth login --log-level debug
==> ⚠️	[Warning] Enter Apple ID email:
==> ⚠️	[Warning] Enter Apple ID password:
==> 🛠	[Debug] Creating HTTP client...
==> 🛠	[Debug] Creating App Store client...
==> ℹ️	[Info] Authenticating with the App Store...
==> 🛠	[Debug] invalidCredentials
==> ❌	[Error] Invalid credentials.

Specifically, Apple returns the following network response:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<plist version="1.0">
<dict>
<key>pings</key>
<array></array>
<key>failureType</key><string>-5000</string>
<key>customerMessage</key><string>The Apple ID you entered couldn’t be found or your password was incorrect. Please try again.</string>
<key>m-allowed</key><false/>
<key>cancel-purchase-batch</key><true/>
</dict>
</plist>

The 2FA popup worked on the first try, and then failed the second time. It doesn't seem like I got blocked because the login still works when running ipatool on my macOS.

I imagine the reason might be in different HTTP headers between macOS and Linux, maybe?

I've been using Ubuntu 20.04 on arm64 with Swift version 5.6.1, all running in Docker on macOS.

Add support for building for iOS

I am not sure if this is in the project's scope, but it would be nice if it could be great if support for running on jailbroken iOS was added

Reason: image not found

When I use ipatool search in terminal,it show error:
dyld: Library not loaded: @rpath/libswift_Concurrency.dylib
Referenced from: /usr/local/bin/ipatool
Reason: image not found
[1] 50988 abort ipatool search

My machine:
maxOS Big Sur 11.4
Xcode:13.2

I install the tool by brew,.Thx for your help.

Unknown Error occurred when purchasing any app

What happened?

I was downloading google assistant via ipatool, but (i used the --purchase addon) and it did not work, so then I tried other apps that use the purchase command and it still did not work
Screen Shot 2022-05-01 at 4 47 33 PM
.

Version

The Latest

Relevant log output

No response

Consider packaging the release download as a .zip

When downloading the latest release of ipatool from the GitHub, it returns as a non-executable binary format. The fix for the user would be to run chmod on the binary, but a simpler solution would be if you were to release it in a .zip file to maintain the permissions.

And thank you for such an awesome tool man! Best regards

Invalid credentials

Hello, I try to download an app using the tool with my apple ID and password but it gives invalid credentials error. What could be the reason for this authentication error? The provided password is encrypted or plain text?

==> ℹ️ [Info] Querying the iTunes Store for 'com.facebook.Facebook'...
==> ℹ️ [Info] Authenticating with the App Store...
==> ❌ [Error] Invalid credentials.

Using ipatool without 2FA

I want to use ipatool in a cron job on a server to automatically pull the latest version of an app from the App Store. However, the server can't do it on its own due to 2FA. Is there a way to get around this? For example, in https://docs.fastlane.tools/getting-started/ios/authentication/ they discuss a number of ways, but all of them either require some manual help periodically or else aren't applicable to downloading apps from the App Store.

dyld: Library not loaded: @rpath/libswift_Concurrency.dylib

Hi there, I was having an issue while installing ipatool

✘ am1ncmd@Hack1ntosh  ~  ipatool
dyld: Library not loaded: @rpath/libswift_Concurrency.dylib
Referenced from: /usr/local/bin/ipatool
Reason: image not found
[1] 10096 abort ipatool

Big Sur 11.6.5: dyld: Library not loaded: @rpath/libswift_Concurrency.dylib

What happened?

Binary fails to start, see log.

Version

1.1.0

Relevant log output

$ brew tap majd/repo
...
==> Tapping majd/repo
Cloning into '/usr/local/Homebrew/Library/Taps/majd/homebrew-repo'...
remote: Enumerating objects: 50, done.
remote: Counting objects: 100% (50/50), done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 50 (delta 14), reused 49 (delta 13), pack-reused 0
Receiving objects: 100% (50/50), 7.27 KiB | 2.42 MiB/s, done.
Resolving deltas: 100% (14/14), done.
Tapped 1 cask and 1 formula (16 files, 16.6KB).
~$ brew install ipatool
==> Downloading https://github.com/majd/ipatool/releases/download/v1.1.0/ipatool-v1.1.0.zip
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/369755856/60b
######################################################################## 100.0%
==> Installing Cask ipatool
==> Linking Binary 'ipatool' to '/usr/local/bin/ipatool'
🍺  ipatool was successfully installed!
~$ ipatool auth login
dyld: Library not loaded: @rpath/libswift_Concurrency.dylib
  Referenced from: /usr/local/bin/ipatool
  Reason: image not found
Abort trap: 6

Download delisted apps from family sharing list

Description

I have endangered games and apps delisted from the store. They are locked in a family purchased list, as the account formally belonged to me but now my mother uses that account.

Support for iOS custom apps

It would be great if the ipatool could support custom apps: https://developer.apple.com/custom-apps/

Access control of custom apps is based on an organization ID and name of an Apple Business Manager account that are entered into App Store Connect distribution settings of the app. From ABM, the app can be consumed via MDM or redeemable codes.

No error message from pipeline

What happened?

ipatool download -b com.emberlink.foodby --log-level debug> temp.log 2>&1
ipatool download -b com.emberlink.foodby --log-level debug> temp.log
ipatool download -b com.emberlink.foodby | tee temp.log
ipatool download -b com.emberlink.foodby 2>&1 | tee temp.log

Tried these two commands. If I don't use pipe, I can get error response (as expected)

❌	[Error] Your Apple ID does not have a license for this app. Use the "purchase" command or the "--purchase" to obtain a license.

But I can not get any log with pipe

Version

1.1.0

Relevant log output

No response

error while trying download a app

ipatool download -b facebook
==> ℹ️ [Info] Querying the iTunes Store for 'facebook' in country 'US'...
==> ❌ [Error] Could not find app.

VPP ipa Download support

@majd Hi

does this tool support downloading ipa files from apple business manager ?
Apple Configurator 2 currently support this feature when u provide your apple business manager account it download .ipa files at this path
~/Library/Group\ Containers/K36BKF7T3D.group.com.apple.configurator/Library/Caches/Assets/TemporaryItems/MobileApps/

can u guide how it does that ?

Thanks

m1 mac sideloading

the IPAs downloaded through ipatool are working fine on m1 macs running 11.2.3 or below just like imazing would but apple stopped serving macOS compatible sinf data as you said and the 11.3 update stopped sideloading but you mentioned in the READ-ME that it's possible to get around that by using a jailbroken device so can you please give more details on how to exactly do that?
ps: I know it's not really an issue with your tool but I just hope that you will update the read me page with detailed steps.
thank you

Compilation Errors

ipatool/Source/Networking/HTTPClient.swift:54:70: error: variable declared in 'guard' condition is not usable in its body
                    return completion(.failure(Error.invalidResponse(response)))
                                                                     ^
ipatool/Source/Networking/HTTPResponse.swift:24:34: error: value of optional type 'CodingUserInfoKey?' must be unwrapped to a value of type 'CodingUserInfoKey'
            decoder.userInfo = [.init(rawValue: "data")!: data]
                                 ^
ipatool/Source/Networking/HTTPResponse.swift:24:34: note: coalesce using '??' to provide a default when the optional value contains 'nil'
            decoder.userInfo = [.init(rawValue: "data")!: data]
                                 ^
                                (                       ?? <#default value#>)
ipatool/Source/Networking/HTTPResponse.swift:24:34: note: force-unwrap using '!' to abort execution if the optional value contains 'nil'
            decoder.userInfo = [.init(rawValue: "data")!: data]
                                 ^
                                                       !
ipatool/Source/Networking/HTTPResponse.swift:24:56: error: cannot force unwrap value of non-optional type 'CodingUserInfoKey'
            decoder.userInfo = [.init(rawValue: "data")!: data]
                                ~~~~~~~~~~~~~~~~~~~~~~~^
ipatool/Source/Networking/HTTPResponse.swift:28:34: error: value of optional type 'CodingUserInfoKey?' must be unwrapped to a value of type 'CodingUserInfoKey'
            decoder.userInfo = [.init(rawValue: "data")!: data]
                                 ^
ipatool/Source/Networking/HTTPResponse.swift:28:34: note: coalesce using '??' to provide a default when the optional value contains 'nil'
            decoder.userInfo = [.init(rawValue: "data")!: data]
                                 ^
                                (                       ?? <#default value#>)
ipatool/Source/Networking/HTTPResponse.swift:28:34: note: force-unwrap using '!' to abort execution if the optional value contains 'nil'
            decoder.userInfo = [.init(rawValue: "data")!: data]
                                 ^
                                                       !
ipatool/Source/Networking/HTTPResponse.swift:28:56: error: cannot force unwrap value of non-optional type 'CodingUserInfoKey'
            decoder.userInfo = [.init(rawValue: "data")!: data]
                                ~~~~~~~~~~~~~~~~~~~~~~~^

Search Apps for iPad only

If the App has both iPad & iPhone app, it is good to download it.
But when the App has only iPad app, there is no results of searching.

Unencrypted Application Binary

This is the ipa file downloaded by "ipatool"

➜  ~ otool -l /Users/tinxie/Downloads/com.xxxxx.xxxxxx_284882215_v320.0_362/Payload/xxxxxx.app/xxxxxx | grep -B 2 crypt
          cmd LC_ENCRYPTION_INFO_64
      cmdsize 24
     cryptoff 16384
    cryptsize 3686400
      cryptid 1

cryptid 1
the value of cryptid is 1 which shows that the application binary is encrypted.
If for an application, the cryptid value is 0, it would mean that the application binary is unencrypted.

can auto decrypt application binary files?

Reason: Image not found

dyld: Library not loaded: @rpath/libswift_Concurrency.dylib
  Referenced from: /opt/homebrew/bin/ipatool
  Reason: image not found

List previously downloaded apps

As it currently stands, the tool currently only allows for downloading previously installed apps, however there is no way to list these apps and instead relies on you knowing the exact bundleId for every app downloaded.

Permission denied

macOS : Big Sur 11.2.2

➜  ~ brew config
HOMEBREW_VERSION: 3.1.9
ORIGIN: https://github.com/Homebrew/brew
HEAD: 76cfe88b7628a8010bf98115627f6aced4ff8870
Last commit: 9 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 81d73c4799c46f64b5b15183c65ec462befb7d74
Core tap last commit: 66 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 16
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: 16-core 64-bit kabylake
Clang: 12.0.0 build 1200
Git: 2.24.3 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 11.2.2-x86_64
CLT: 12.4.0.0.1.1610135815
Xcode: 12.4
➜  ~ brew install ipatool
==> Downloading https://github.com/majd/ipatool/releases/download/v1.0.3/ipatool
Already downloaded: /Users/tinxie/Library/Caches/Homebrew/downloads/339ae7c72cf5e0d58ca9adce5056ce8bbd9e3c17762d66a66149c7eb0ad125f2--ipatool
==> Installing Cask ipatool
==> Purging files for version 1.0.3 of Cask ipatool
Error: Permission denied @ dir_s_mkdir - /usr/local/Caskroom/ipatool

libswift_Concurrency.dylib not loaded

Thanks for the great work, especially with the 1.1.0 release. I have no problem running this tool on macOS 12.2. But I get this error on macOS 11.1:

dyld: Library not loaded: @rpath/libswift_Concurrency.dylib
Referenced from: /usr/local/bin/ipatool
Reason: image not found

dyld: Library not loaded: @rpath/libswift_Concurrency.dylib

Hey majd,

Installed through brew on Mac 10.15.4.
xCode 11.4.1

Referenced from: /usr/local/bin/ipatool Reason: image not found.

Perhaps can be fixed by added optional flag on libswift_Concurrency.dylib.

Can't try it out myself since I refuse to update xcode & break my tweak dev environment.

Error when downloading a app

Hi Majd

First of all thank you very much! this tool looks very useful!

Second, I'm getting the following error when trying to download apps (I tried multiple, this one I just choose randomly)

==> ℹ️	[Info] Querying the iTunes Store for 'sa.virginmobile.vm' in country 'US'...
==> ⚠️	[Warning] Enter Apple ID email:
==> ⚠️	[Warning] Enter Apple ID password:
==> ℹ️	[Info] Authenticating with the App Store...
==> ℹ️	[Info] Authenticated as 'XXXXX'.
==> ℹ️	[Info] Requesting a signed copy of '1439413116' from the App Store...
==> ❌	[Error] Your Apple ID does not have a license for this app. Download the app on an iOS device to obtain a license.

Do you know what's the error or how to solve it?

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.