app-info

Language Gem version Build Status License

Teardown tool for mobile app (iOS: ipa, Android: apk/aab, HarmonyOS: .hap/.app file), macOS app, dSYM.zip file and Windows PE file.

Analysis metedata like version, name, icon etc.

Support

  • Android file
    • .apk
    • .aab (Androld App Bundle)
  • iOS, Apple TV file
    • .ipa
    • Info.plist file
    • .mobileprovision/.provisionprofile file
  • HarmonyOS file (basic)
    • .hap
    • .app
  • macOS App file (archived by starnd pkzip format)
    • .app.zip
  • dSYMs file (archived by starnd pkzip format)
    • .dSYM.zip
  • Windows PE file
    • .exe
    • .zip (binary in a zip file)


Zealot Showcase Zealot Showcase

Zealot is a self-hosted Beta App Distribution for Android, iOS and macOS apps. app_info it the core inside.


Installation

Add this line to your application's Gemfile:

gem 'app-info'

And then execute:

$ bundle

Or install it yourself as:

$ gem install app-info

Usage

Initialize

require 'app-info'

# Automatic detect file extsion and parse
parser = AppInfo.parse('iphone.ipa')
parser = AppInfo.parse('ipad.ipa')
parser = AppInfo.parse('apple-tv.ipa')
parser = AppInfo.parse('android.apk')
parser = AppInfo.parse('android.aab')
parser = AppInfo.parse('u-u-i-d.mobileprovision')
parser = AppInfo.parse('macOS.App.zip')
parser = AppInfo.parse('App.dSYm.zip')
parser = AppInfo.parse('win.exe')
parser = AppInfo.parse('win.zip')

# If detect file type failed, you can parse in other way
parser = AppInfo::IPA.new('iphone-ipad-unversal-appletv.ipa')
parser = AppInfo::APK.new('android.apk')
parser = AppInfo::AAB.new('android.aab')
parser = AppInfo::InfoPlist.new('Info.plist')
parser = AppInfo::MobileProvision.new('uuid.mobileprovision')
parser = AppInfo::Macos.new('App.dSYm.zip')
parser = AppInfo::DSYM.new('App.dSYm.zip')
parser = AppInfo::PE.new('win.exe')

iOS

Teardown suport iPhone, iPad, Universal and Apple TV file.

ipa = AppInfo.parse('iphone-ipad-unversal-appletv.ipa')

# get app file size
ipa.size
# => 3093823

# get app file size in human reable.
ipa.size(human_size: true)
# => 29 MB

# get app release version
ipa.release_version
# => 1.0

# get app bundle id
ipa.bundle_id
# => com.icyleaf.AppInfoDemo

# get app icons (uncrushed png by default)
ipa.icons
# => [{:name=>"AppIcon29x29@2x~ipad.png", :file=>"temp/dir/app/AppIcon29x29@2x~ipad.png"}, :dimensions=>[29, 29], :uncrushed_file=>"..." ...]

# get provisioning profile devices
ipa.devices
# => ['18cf53cddee60c5af9c97b1521e7cbf8342628da']

# detect app type
ipa.ipad?
ipa.iphone?
ipa.universal?
ipa.appletv?

# detect app release type
ipa.release_type
# => 'AdHoc'

# detect architecture(s)
ipa.archs
# => [:armv7, :arm64]

# get built-in frameworks
ipa.frameworks
# => [<AppInfo::Framework:520 @name=Masonry.framework>, <AppInfo::Framework:520 @name=libswiftPhotos.dylib>]

# get built-in plugins
ipa.plugins
# => [<AppInfo::Plugin:1680 @name=NotificationService>]

# get url schemes
ipa.url_schemes
# => [{:name=>"Web", :role=>"Editor", :schemes=>["app-info", "app_info"]}]

# get query schemes
ipa.url_schemes
# => ["twitter", "instagram", "www-x-callback"]

# get background modes
ipa.background_modes
# => ["audio", "fetch", "remote-notification"]

# get more propety in Info.plist
ipa.info[:CFBundleDisplayName]
# => 'AppInfoDemo'

More to check rspec test.

Mobile Provision

Extract from IPA parser, it could teardown any .mobileprovision file(Provisioning Profile). you can download it from Apple Developer Portal.

profile = AppInfo.parse('~/Library/MobileDevice/Provisioning\ Profiles/6e374bb8-a801-411f-ab28-96a4baa23814.mobileprovision')

# get app release version
profile.team_id
# => '3J9E73E9XS'

# get app package name
profile.team_name
# => 'Company/Team Name'

# get UDID of devices
profile.devices
# => ['18cf53cddee60c5af9c97b1521e7cbf8342628da']

# detect type
profile.type
# => :development/:adhoc/:appstore/:enterprise

# get enabled capabilities
profile.enabled_capabilities
# => ['Apple Pay', 'iCloud', 'Sign In with Apple', ...]

Android

Accept .aab and .apk Android file.

android = AppInfo.parse('android.apk_or_aab')

# get app file size
android.size
# => 3093823

# get app file size in human reable.
android.size(human_size: true)
# => 29 MB

# get app release version
android.release_version
# => 1.0

# get app package name
android.bundle_id
# => com.icyleaf.AppInfoDemo

# detect app type (It's difficult to detect phone or tablet)
android.tv?
android.wear?
android.automotive?

# get app icons
android.icons
# => [{:name=>"ic_launcher.png", :file=> "/temp/dir/app/ic_launcher.png", :dimensions=>[48, 48]}, ...]

# get app support min sdk version
android.min_sdk_version
# => 13

# get use_permissions list
android.use_permissions
# => [...]

# get activitiy list
android.activities
# => [...]

# get service list
android.services
# => [...]

# get deep links host
android.deep_links
# => ['a.com']

# get schemes without http or https
android.schemes
# => ['appinfo']

# get v1-v3 scheme singature information (included unverified certificate and more)
android.signatures
# => [...]

HarmonyOS

Accept .hap and .app HarmonyOS file. Only metabase, except resources mapping.

hap = AppInfo.parse('app.hap')

# get app file size
android.size
# => 2013213

# get app file size in human reable.
android.size(human_size: true)
# => 21 MB

# get app release version
android.release_version
# => 1.0

# get app package name
android.bundle_id
# => com.icyleaf.AppInfoDemo

macOS

Only accept zipped macOS file.

macos = AppInfo.parse('macos_app.zip')

# get app file size
macos.size
# => 3093823

# get app file size in human reable.
macos.size(human_size: true)
# => 29 MB

# get app release version
macos.release_version
# => 1.0

# get app bundle id
macos.bundle_id
# => com.icyleaf.AppInfoDemo

# Get minimize os version
macos.min_os_version
# => 11.3

# get app icons(convertd icns to png icon sets by default)
macos.icons
# => [{:name=>"AppIcon.icns", :file=>"/temp/dir/app/AppIcon.icns"}, :sets=>[{:name=>"64x64_AppIcon.png", :file=>"/temp/dir/app/64x64_AppIcon.png", :dimensions=>[64, 64]}, ...]

# detect publish on mac app store
macos.stored?
# => true/false

# detect architecture(s)
macos.archs
# => [:x86_64, :arm64]

# get more propety in Info.plist
macos.info[:CFBundleDisplayName]
# => 'AppInfoDemo'

dSYM

dsym = AppInfo.parse('ios.dSYM.zip')

# get object name
dsym.object
# => iOS

# get total count of macho
dsym.machos.count
# => 1 or 2

dsym.machos.each do |macho|
  # get cpu type
  macho.cpu_type
  # => :arm

  # get cpu name
  macho.cpu_name
  # => armv7

  # get UUID (debug id)
  macho.uuid
  # => 26dfc15d-bdce-351f-b5de-6ee9f5dd6d85

  # get macho size
  macho.size
  # => 866526

  # get macho size in human reable.
  macho.size(human_size: true)
  # => 862 KB

  # dump data to Hash
  macho.to_h
  # => {uuid:"26dfc15d-bdce-351f-b5de-6ee9f5dd6d85", cpu_type: :arm, cpu_name: :armv7, ...}
end

Windows

Accept any PE format file, such like .exe or .exe binary fin a zip file.

win = AppInfo.parse('win.exe')

# get given file size
win.size
# => 3093823

# get given file size in human reable.
win.size(human_size: true)
# => 29 MB

# get given file size
win.binary_size
# => 20940

# get given file size in human reable.
win.size(human_size: true)
# => 20 MB

# get product name
win.name
# => AppInfo

# get app company name
win.company_name
# => EWS Studio

# get app product version (alias to release_version)
win.product_version
# => 1.0.0

# get app assembly version (alias to build_version)
win.assembly_version
# => 1.0.0

# detect architecture(s)
win.archs
# => x64

# get all imports files
win.imports
# => [KERNEL32.dll, ...]

# get app icons (bmp format image)
win.icons
# => [{:name=>"ICON.bmp", :file=>"{path}/ICON.bmp"}, :dimensions=>[64, 64]}, ...]

CLI Shell (Interactive console)

It is possible to use this gem as a command line interface to parse mobile app:

> app-info

app-info (2.7.0)> p = AppInfo.parse('/path/to/app')
=> #<AppInfo::APK::......>
app-info (2.7.0)> p.name
=> "AppName"

Best Practice

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/icyleaf/app-info. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.