项目作者: itomsu

项目描述 :
use python3 parse APK, get package name, file md5, apk icon.... no external tools (aapt, openssl) needed
高级语言: Python
项目地址: git://github.com/itomsu/apk_parse3.git
创建时间: 2017-04-13T10:38:25Z
项目社区:https://github.com/itomsu/apk_parse3

开源协议:

下载


APK parse3

  • reference androguard <https://github.com/androguard/androguard>
  • reference apk_parse <https://github.com/tdoly/apk_parse>
  • REAL python3 support

Example:

  1. apkf = APK("myfile.apk")
  2. apkf = APK(read("myfile.apk"), raw=True)

app_name

Return the name of app or main activity

  1. >>> apkf.get_app_name()
  2. >>> apkf.get_app_name('zh')

package

Return the name of the package

  1. >>> apkf.package
  2. com.android.vending
  3. >>> apkf.get_package()
  4. com.android.vending

file_md5

Return the file md5 of the apk

  1. >>> apkf.file_md5
  2. 40bdd920a3a3d2acf432e3c5b485eb11

cert_md5

Return the cert md5 of the apk

  1. >>> apkf.get_cert_md5()
  2. ['5c7ea7e7479fc0bc10546b396d31b15d']

cert_sha1

Return the cert sha1 of the apk

  1. >>> apkf.get_cert_sha1()
  2. ['61062655c4fcfc21d15d3917de515f88646c787f']

file_size

Return the apk file size

  1. >>> apkf.file_size
  2. 11194863

androidversion

Return the apk version

  1. >>> apkf.androidversion
  2. {'Code': u'80341200', 'Name': u'5.4.12'}

get_androidversion_code()

Return the android version code

  1. >>> apkf.get_androidversion_code()
  2. 80341200

get_androidversion_name()

Return the android version name

  1. >>> apkf.get_androidversion_name()
  2. 5.4.12

get_min_sdk_version()

Return the android:minSdkVersion attribute

  1. >>> apkf.get_min_sdk_version()
  2. 9

get_target_sdk_version()

Return the android:targetSdkVersion attribute

  1. >>> apkf.get_target_sdk_version()
  2. 21

get_libraries()

Return the android:name attributes for libraries

  1. >>> apkf.get_libraries()
  2. []

get_files()

Return the files inside the APK

  1. >>> apkf.get_files()
  2. [u'AndroidManifest.xml', u'assets/keys/dcb-pin-encrypt-v1/1',...]

get_files_types()

Return the files inside the APK with their associated types (by using python-magic)
Please pip install python-magic

  1. >>> apkf.get_files_types()
  2. {u'res/layout/play_card_bundle_item_small.xml': "Android's binary XML",...}

get_main_activity()

Return the name of the main activity

  1. >>> apkf.get_main_activity()
  2. com.android.vending.AssetBrowserActivity

get_activities()

Return the android:name attribute of all activities

  1. >>> apkf.get_activities()
  2. ['com.android.vending.AssetBrowserActivity', ...]

get_services()

Return the android:name attribute of all services

  1. >>> apkf.get_services()
  2. ['com.android.vending.GCMIntentService', ...]

get_receivers()

Return the android:name attribute of all receivers

  1. >>> apkf.get_receivers()
  2. ['com.google.android.gcm.GCMBroadcastReceiver', ...]

get_providers()

Return the android:name attribute of all providers

  1. >>> apkf.get_providers()
  2. ['com.google.android.finsky.providers.RecentSuggestionsProvider', ...]

get_permissions()

Return permissions

  1. >>> apkf.get_permissions()
  2. ['com.android.vending.permission.C2D_MESSAGE', ...]

get_app_icon()

get ICON of the apk
Return the first non-greater density than max_dpi icon file name,
unless exact icon resolution is set in the manifest, in which case
return the exact file

  1. >>> apkf.get_app_icon()
  2. res/mipmap-xxhdpi-v4/ic_on.png

show()

Return FILES, PERMISSIONS, MAIN ACTIVITY…
and certificates

  1. >>> apkf.show()
  2. FILES: ...