• binary AndroidManifest.xml, resource ID to string. How to ?

    From R.Wieser@21:1/5 to All on Tue Jun 4 12:31:19 2024
    Hello all,

    I wanted to convert a binary "AndroidManifest.xml" to text again, and
    curently have a readable result.

    One thing I've not been able to figure out though. In a sourcefile I see
    lines like

    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher"
    android:theme="@style/Translucent">

    , but all that the binary XML file contains is resource-IDs

    icon = @:7F0E0000
    label = @:7F110065
    roundIcon = @:7F0E0000
    theme = @:7F120157

    , and I have no idea how to translate the latter to the former. :-\

    I've done my dues and spend time searching the Web, but have not been able
    to find any kind of clue to how to do it (the information I found stopped
    short of explaining it).

    If anyone knows how to do it or has an URL to a website explaining it I
    would be obliged.

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Newyana2@21:1/5 to R.Wieser on Tue Jun 4 09:07:49 2024
    On 6/4/2024 6:31 AM, R.Wieser wrote:
    Hello all,

    I wanted to convert a binary "AndroidManifest.xml" to text again, and curently have a readable result.

    One thing I've not been able to figure out though. In a sourcefile I see lines like

    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher"
    android:theme="@style/Translucent">

    , but all that the binary XML file contains is resource-IDs

    icon = @:7F0E0000
    label = @:7F110065
    roundIcon = @:7F0E0000
    theme = @:7F120157

    , and I have no idea how to translate the latter to the former. :-\

    I've done my dues and spend time searching the Web, but have not been able
    to find any kind of clue to how to do it (the information I found stopped short of explaining it).

    If anyone knows how to do it or has an URL to a website explaining it I
    would be obliged.

    Just a wild guess, but in PE files there's generally
    a resource table to store icons. The table is located
    through a system of numeric pointers. You read the
    file header, locate the resource table pointer, go to
    that offset, walk the table pointers, etc. It's all about
    pointers to offsets.

    So one thing you could check is whether some rendering
    of 7F0E0000 as an offset in the file points to either icon
    bytes, an icon path string, or another pointer. But you'd
    also need to figure out 7F0E0000. Is it a little endian long
    integer? Is it two short integers? Does the 7F mean
    something else? It looks to me like those numbers may
    have sections and not just represent whole numbers.

    This kind of thing can be monstrously difficult because
    most people have no reason to care about such things.
    So you have to track down some kind of industry spec
    doc. It's like the PE file structure. There are docs that explain
    it, but for the most part it's not relevant to people using
    computers. And without the decoder guide it's just gibberish
    bytes.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Tue Jun 4 15:43:25 2024
    Andy,

    I'd have expected a .xml file to be text (albeit with lots of elemenrs/attributes) and possibly to have been extracted from a binary
    .apk file

    I did extract it from an APK, but the file itself is a binary

    are the resource objects within a folder of the .apk file?

    I wish I knew ...

    I inspected two other files (next to the Manifest one), but neither had the sought-for strings.

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Tue Jun 4 15:54:41 2024
    Newyana,

    Just a wild guess, but in PE files there's generally
    a resource table to store icons. The table is located
    through a system of numeric pointers. You read the
    file header, locate the resource table pointer, go to
    that offset, walk the table pointers, etc. It's all about
    pointers to offsets.

    The sought-for strings are not present in the binary AndroidManifest.xml
    file.

    This kind of thing can be monstrously difficult because
    most people have no reason to care about such things.

    I cannot other than agree with you, as I've not been able to find even a
    /hint/ to how that it works.

    So you have to track down some kind of industry spec doc.

    :-) I already spend a few hours googeling. I have not found anything. :-(

    ... Which is why I posted here.

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Burns@21:1/5 to R.Wieser on Tue Jun 4 14:15:17 2024
    R.Wieser wrote:

    I wanted to convert a binary "AndroidManifest.xml" to text again,

    I'd have expected a .xml file to be text (albeit with lots of elemenrs/attributes) andpossibly to have been extracted from a binary
    .apk file which is a renamed .zip archive ... are the resource objects
    within a folder of the .apk file?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Burns@21:1/5 to R.Wieser on Tue Jun 4 15:08:50 2024
    R.Wieser wrote:

    I did extract it from an APK, but the file itself is a binary

    are the resource objects within a folder of the .apk file?

    I wish I knew ...

    Must be some while since I poked about inside .apk files, maybe this
    itool s already what you used to extract, if not then it might help?

    <https://apktool.org>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrew@21:1/5 to Andy Burns on Tue Jun 4 17:04:10 2024
    Andy Burns wrote on Tue, 4 Jun 2024 15:08:50 +0100 :

    I did extract it from an APK, but the file itself is a binary

    are the resource objects within a folder of the .apk file?

    I wish I knew ...

    Must be some while since I poked about inside .apk files, maybe this
    itool s already what you used to extract, if not then it might help?

    This has been covered in this newsgroup many times in the past, so this is
    just a summary which contains the links to the sources that are useful.

    Here's a cut and paste from a past discussion, but there are many.
    <https://adbappcontrol.com/en/>
    <https://qwertycube.com/apk-editor-studio/>
    <https://apktool.org/docs/install/>
    <https://clonemy.app/>

    The advantage of cloning is you can make changes & re-install the app.
    <https://xdaforums.com/t/tool-clonemyapp-android-apk-cloner.4513777/>

    However, to help out Rudy Wieser even further, I would suggest an Android
    tool that can extract the XML file as a text file, which, as Andy knows,
    would be the Muntashirakon App Manager we spoke about just recently on the Android newsgroup over here (which is the best app manager available).
    <https://comp.mobile.android.narkive.com/UFyeKiqM/muntashirakon-app-manager-is-imho-by-far-the-best-app-manager-on-android>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Tue Jun 4 20:54:43 2024
    Andrew,

    Here's a cut and paste from a past discussion, but there are many.
    [snip]

    Those seem to be tools. I'm not looking for tools.

    If I would have been than I would have just picked one of the several I saw mentioned during my searching, instead of doing the work myself.

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Tue Jun 4 20:34:18 2024
    Andy,

    Must be some while since I poked about inside .apk files, maybe this itool
    s already what you used to extract, if not then it might help?

    <https://apktool.org>

    Thanks. But how would it ? Yes, it would (would it?) show the strings
    I'm after, but still not giving any indication to /how/ it got them. And
    that, the method, is what I'm after.

    Besides, I'm afraid that that tool won't be able to run on my current
    machine.

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Burns@21:1/5 to R.Wieser on Tue Jun 4 20:06:24 2024
    R.Wieser wrote:

    <https://apktool.org>

    But how would it ? Yes, it would (would it?) show the strings
    I'm after, but still not giving any indication to /how/ it got them. And that, the method, is what I'm after.

    It looked like it would even extract the numbered resource files, but I
    didn't run it.

    I also saw various code libraries for reading compressed apks, search
    AXML or ABX

    Besides, I'm afraid that that tool won't be able to run on my current machine.

    No JVM?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrew@21:1/5 to R.Wieser on Wed Jun 5 04:26:26 2024
    R.Wieser wrote on Tue, 4 Jun 2024 20:54:43 +0200 :

    Those seem to be tools. I'm not looking for tools.

    I was keying off this sentence in the original post:
    "I wanted to convert a binary "AndroidManifest.xml" to text again,
    and curently have a readable result."

    While I am aware that original post was likely written in haste, my
    assumption was that you want a TEXT manifest for a given APK.

    The Muntashirakon App Manager easily accomplishes that, as you can see I
    did myself in this thread on the XDA Developers web site. https://xdaforums.com/t/tutorial-illustrated-mostly-privacy-based-one-tap-shortcuts-so-that-you-can-access-in-a-single-tap-any-buried-android-setting-or-app-activity.4625951/

    If that's NOT what you wanted, please ignore my post as I was only trying
    to help you out using the information that I knew, but I had trouble understanding your original post (probably because it was written in
    haste).

    In summary, the Muntashirakon App Manager spits out a TEXT manifest file
    for any app which is already installed on your phone; if that's not what
    you needed, then I misunderstood the original post & I apologize for that.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Wed Jun 5 10:11:06 2024
    Andy,

    It looked like it would even extract the numbered resource files, but I didn't run it.

    Extracting from an APK is easy enough (7-zip "for teh win"). What would
    those numbered resource files supposed to look like ? I can see a few
    files with digits in them (v??, ??dp), but nothing that I would call a
    numbered file.

    I also saw various code libraries for reading compressed apks, search AXML
    or ABX

    "compressed apks" as in zipped-up ? Or something special ?

    But when I need stuff like that I'll probably try myself first. Yep, I'm
    that kind of hobbyist. :-)

    Although my current proggie only shows resource-IDs and not strings (file paths?), it already does what I wanted from it : extract the requested permissions for my viewing.

    And by {deity}, some, on the outside simple apps, want a shitload of them.
    A PDF organizer seems to need 44 permissions.

    Besides, I'm afraid that that tool won't be able to run on my current
    machine.

    No JVM?

    One of things, yes.

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Wed Jun 5 10:10:12 2024
    Andrew,

    Those seem to be tools. I'm not looking for tools.

    I was keying off this sentence in the original post:
    "I wanted to convert a binary "AndroidManifest.xml" to text again,
    and curently have a readable result."

    While I am aware that original post was likely written in haste,

    Not really.

    my assumption was that you want a TEXT manifest for a given
    APK.

    And as you quoted yourself, I have it : "and curently have a readable
    result"

    ... which I needed so I could take a quick peek at the permissions an app requires. The resource-ID to string is just an (though not unwelcome)
    extra.

    So, what would I need those tools for ?

    The [snip app] accomplishes that,

    You're mentioning the name of that app *way* to many times, making it look
    as if you are trying to push it (sales pitch). Which that makes me uncomfortable and causes the opposite of what you are trying to effect.

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Burns@21:1/5 to R.Wieser on Wed Jun 5 09:18:21 2024
    R.Wieser wrote:

    You're mentioning the name of that appway to many times, making it look
    as if you are trying to push it

    Especially considering it fails to run after installation ...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrew@21:1/5 to Andy Burns on Wed Jun 5 09:53:28 2024
    Andy Burns wrote on Wed, 5 Jun 2024 09:18:21 +0100 :

    You're mentioning the name of that appway to many times, making it look
    as if you are trying to push it

    Especially considering it fails to run after installation ...

    It works fine for me, as you know, although I know it doesn't work for you. Nobody should complain they don't have a text manifest file if they use it.

    BTW, I've been using that App Manager for hours to open up map activities.... because I'm using it to set up backcountry mapping...

    This is just a cut and paste from my ad hoc log...

    I just used the Muntashirakon App Manager to get GPS coordinates onto
    a map of my own choosing, where without the app manager, it won't work (AFAIK).

    Here's what I did...

    1. Install FOSS My Location freeware (which can read Apple's Wi-Fi AP db!).
    <https://github.com/mirfatif/MyLocation>
    <https://f-droid.org/packages/com.mirfatif.mylocation/>
    <https://apt.izzysoft.de/fdroid/index/apk/com.mirfatif.mylocation>
    While free, it's not free on the Google Play Store though.
    <https://play.google.com/store/apps/details?id=com.mirfatif.mylocation.ps>

    2. Run the "My Location" app to get a location latitude & longitude fix.

    3. Press the GUI "Map" button to choose a map to display the location.
    Note that, for me, the available map choices were only these:
    All-In-One
    App Manager (Interceptor)
    Earth
    Fake GPS
    Geo Tracker
    GPSLogger II
    GPSTest
    Magic Earth

    4. Instead of a map, choose the Muntashirakon App Manager Interceptor.
    And press "Send edited Intent" in that App Manager Interceptor GUI.
    Note that, for me, the available map choices were now more maps!
    Maps (Google Maps)
    App Manager (Interceptor)
    Fake GPS
    OSMAnd~
    All-In-One
    Organic Maps
    Earth
    Geo Tracker
    GPSLogger II
    GPSTest

    Notably "Magic Earth" did not appear in this open-with listing.

    5. But look more deeply at the intents and you'll see more maps apps
    in the Muntashirakon App Manager "Matching Activities" section.
    But not Avenza or Paper Maps.

    6. In the App Manager GUI, press the "adb" button which will copy
    to your clipboard the following adb command.
    cmd activity start --user 0 -a android.intent.action.VIEW -d geo:37.81444578572309,-122.47816992062673?q=37.81444578572309,-122.47816992062673 -f 50331648

    7. In Windows, run that adb command (with the phone connected to adb).
    C:\> adb shell cmd activity start --user 0 -a android.intent.action.VIEW -d geo:37.81444578572309,-122.47816992062673?q=37.81444578572309,-122.47816992062673 -f 50331648

    Note that, for me, the available map choices were now even more maps!
    Open with...
    All-In-One
    App Manager (Interceptor)
    Earth
    Geo Tracker
    GPSLogger II
    GPSTest
    Magic Earth
    Fake GPS

    Notably missing were Maps (Google Maps), OSMAnd~ & Organic Maps.

    8. So let's add them... (these are all experiments below)...
    C:\> adb shell cmd activity start --user 0 -a android.intent.action.VIEW
    C:\> adb shell cmd activity start --user 0 -a android.intent.action.VIEW -d geo:
    C:\> adb shell cmd activity start --user 0 -a android.intent.action.VIEW -d sms:
    C:\> adb shell cmd activity start --user 0 -a android.intent.action.VIEW -d content:
    C:\> adb shell cmd activity start --user 0 -a android.intent.action.VIEW -d content://com.android.contacts/data/4169
    C:\> adb shell cmd activity start --user 0 -a android.intent.action.VIEW -d geo:37.8,-122.23?z=23
    C:\> adb shell cmd activity start --user 0 -a android.intent.action.VIEW DataUri: geo:37.8,-122.23?z=23
    C:\> adb shell am start -n com.Avenza/.OpenFileWithAvenzaMapsActivity
    C:\> adb shell am start -n com.Avenza/.RootView.RootViewActivity
    C:\> adb shell am start -n ca.abbro.androidmap/.LaunchActivity

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)