Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

any lib extract android resources.arsc

I'm looking for a lib to extract ids and values which stored in res/values/strings.xml, for example app_name. I unzipped the apk, however strings.xml cannot be found. I use aapt to extract string values, however the corresponding ids are missing. I have tried apktool to decompile the apk and then parse the xml file to get the keys and values. However, it's not an efficient way, almost 12 seconds per apk. I have more than 10,000 android malwares to be processed. This method really cost me too much time. I found that all the ids and values in res/values/strings.xml is encoded into the file resources.arsc. I wonder if there is lib to extract ids and values from resources.arsc?

like image 839
sunnycomes Avatar asked Feb 06 '23 07:02

sunnycomes


2 Answers

Use appt for android-sdk (ex:- /build-tools/27.0.3/aapt )

./aapt dump resources ./debug.apk

Package Groups (1)
Package Group 0 id=0x7f packageCount=1 name=com.dianping.example.activity
  Package 0 id=0x7f name=com.dianping.example.activity
    type 1 configCount=3 entryCount=1
      spec resource 0x7f020000 com.example.activity:drawable/ic_launcher: flags=0x00000100
      config mdpi-v4:
        resource 0x7f020000 com.example.activity:drawable/ic_launcher: t=0x03 d=0x00000000 (s=0x0008 r=0x00)
      config hdpi-v4:
        resource 0x7f020000 com.example.activity:drawable/ic_launcher: t=0x03 d=0x00000001 (s=0x0008 r=0x00)
      config xhdpi-v4:
        resource 0x7f020000 com.example.activity:drawable/ic_launcher: t=0x03 d=0x00000002 (s=0x0008 r=0x00)
    type 2 configCount=1 entryCount=1
      spec resource 0x7f030000 com.dianping.example.activity:string/app_name: flags=0x00000000
      config (default):
        resource 0x7f030000 com.dianping.example.activity:string/app_name: t=0x03 d=0x00000003 (s=0x0008 r=0x00)

This link might help http://elinux.org/Android_aapt

like image 156
Tamilan C.Periyasamy Avatar answered Feb 15 '23 05:02

Tamilan C.Periyasamy


It's not a proper library, but you can borrow code from an official Google project called ArscBlamer: https://github.com/google/android-arscblamer

like image 27
Diego Avatar answered Feb 15 '23 06:02

Diego