Stripping symbols from an ELF

Just as the previous post about stripping symbols from a Mach-O binary, here’s one about stripping them from an ELF binary.

The syntax to execute the script is the same as in the previous post, only the called function changes:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
cerpro -c -r path/to/strip.py:stripELF source destination
cerpro -c -r path/to/strip.py:stripELF source destination
cerpro -c -r path/to/strip.py:stripELF source destination

Here’s the code:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
from Pro.Core import *
from Pro.ELF import *
def stripELF(srcname, dstname):
oldc = createContainerFromFile(srcname)
if oldc.isNull():
print("error: couldn't open '%s'" % (srcname,))
return
obj = ELFObject()
if not obj.Load(oldc):
print("error: could't load ELF")
return
newc = oldc.copyToNewContainer()
sects = obj.Sections()
count = 0
it = obj.SymbolTableSections().iterator()
it.next()
while it.hasNext():
s = sects.At(it.next())
# only the .symtab section
if s.Num("sh_type") != 2:
continue
strtaboffs = sects.At(s.Num("sh_link")).Num("sh_offset")
sit = obj.Symbols(s).iterator()
while sit.hasNext():
sym = sit.next()
# only local symbols
if sym.Num("st_shndx") == 0:
continue
nameoffs = sym.Num("st_name") + strtaboffs
name, ret = obj.ReadUInt8String(nameoffs, 0x10000)
newc.fill(nameoffs, 0, len(name))
count += 1
if newc.save(dstname):
print("successfully stripped all %d local symbols!" % (count,))
else:
print("error: couldn't save stripped binary to '%s'" % (dstname,))
from Pro.Core import * from Pro.ELF import * def stripELF(srcname, dstname): oldc = createContainerFromFile(srcname) if oldc.isNull(): print("error: couldn't open '%s'" % (srcname,)) return obj = ELFObject() if not obj.Load(oldc): print("error: could't load ELF") return newc = oldc.copyToNewContainer() sects = obj.Sections() count = 0 it = obj.SymbolTableSections().iterator() it.next() while it.hasNext(): s = sects.At(it.next()) # only the .symtab section if s.Num("sh_type") != 2: continue strtaboffs = sects.At(s.Num("sh_link")).Num("sh_offset") sit = obj.Symbols(s).iterator() while sit.hasNext(): sym = sit.next() # only local symbols if sym.Num("st_shndx") == 0: continue nameoffs = sym.Num("st_name") + strtaboffs name, ret = obj.ReadUInt8String(nameoffs, 0x10000) newc.fill(nameoffs, 0, len(name)) count += 1 if newc.save(dstname): print("successfully stripped all %d local symbols!" % (count,)) else: print("error: couldn't save stripped binary to '%s'" % (dstname,))
from Pro.Core import *
from Pro.ELF import *

def stripELF(srcname, dstname):
    oldc = createContainerFromFile(srcname)
    if oldc.isNull():
        print("error: couldn't open '%s'" % (srcname,))
        return
    obj = ELFObject()
    if not obj.Load(oldc):
        print("error: could't load ELF")
        return
    newc = oldc.copyToNewContainer()

    sects = obj.Sections()

    count = 0
    it = obj.SymbolTableSections().iterator()
    it.next()
    while it.hasNext():
        s = sects.At(it.next())
        # only the .symtab section
        if s.Num("sh_type") != 2:
            continue
        strtaboffs = sects.At(s.Num("sh_link")).Num("sh_offset")
        sit = obj.Symbols(s).iterator()
        while sit.hasNext():
            sym = sit.next()
            # only local symbols
            if sym.Num("st_shndx") == 0:
                continue
            nameoffs = sym.Num("st_name") + strtaboffs
            name, ret = obj.ReadUInt8String(nameoffs, 0x10000)
            newc.fill(nameoffs, 0, len(name))
            count += 1

    if newc.save(dstname):
        print("successfully stripped all %d local symbols!" % (count,))
    else:
        print("error: couldn't save stripped binary to '%s'" % (dstname,))

That’s it!

And here again the complete script which you can use to strip both a Mach-O and an ELF binary.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# strip.py
from Pro.Core import *
from Pro.MachO import *
from Pro.ELF import *
def stripMachO(srcname, dstname):
oldc = createContainerFromFile(srcname)
if oldc.isNull():
print("error: couldn't open '%s'" % (srcname,))
return
obj = MachObject()
if not obj.Load(oldc):
print("error: could't load Mach-O")
return
obj.ProcessLoadCommands()
newc = oldc.copyToNewContainer()
symlc = obj.SymTableLC()
stroffs = symlc.Num("stroff")
count = 0
it = obj.SymbolNList(symlc).iterator()
while it.hasNext():
syms = it.next()
# only local symbols
if syms.Num("sect") == 0:
continue
nameoffs = obj.AddressToOffset(syms.Num("strx") + stroffs)
name, ret = obj.ReadUInt8String(nameoffs, 0x10000)
newc.fill(nameoffs, 0, len(name))
count += 1
if newc.save(dstname):
print("successfully stripped all %d local symbols!" % (count,))
else:
print("error: couldn't save stripped binary to '%s'" % (dstname,))
def stripELF(srcname, dstname):
oldc = createContainerFromFile(srcname)
if oldc.isNull():
print("error: couldn't open '%s'" % (srcname,))
return
obj = ELFObject()
if not obj.Load(oldc):
print("error: could't load ELF")
return
newc = oldc.copyToNewContainer()
sects = obj.Sections()
count = 0
it = obj.SymbolTableSections().iterator()
it.next()
while it.hasNext():
s = sects.At(it.next())
# only the .symtab section
if s.Num("sh_type") != 2:
continue
strtaboffs = sects.At(s.Num("sh_link")).Num("sh_offset")
sit = obj.Symbols(s).iterator()
while sit.hasNext():
sym = sit.next()
# only local symbols
if sym.Num("st_shndx") == 0:
continue
nameoffs = sym.Num("st_name") + strtaboffs
name, ret = obj.ReadUInt8String(nameoffs, 0x10000)
newc.fill(nameoffs, 0, len(name))
count += 1
if newc.save(dstname):
print("successfully stripped all %d local symbols!" % (count,))
else:
print("error: couldn't save stripped binary to '%s'" % (dstname,))
# strip.py from Pro.Core import * from Pro.MachO import * from Pro.ELF import * def stripMachO(srcname, dstname): oldc = createContainerFromFile(srcname) if oldc.isNull(): print("error: couldn't open '%s'" % (srcname,)) return obj = MachObject() if not obj.Load(oldc): print("error: could't load Mach-O") return obj.ProcessLoadCommands() newc = oldc.copyToNewContainer() symlc = obj.SymTableLC() stroffs = symlc.Num("stroff") count = 0 it = obj.SymbolNList(symlc).iterator() while it.hasNext(): syms = it.next() # only local symbols if syms.Num("sect") == 0: continue nameoffs = obj.AddressToOffset(syms.Num("strx") + stroffs) name, ret = obj.ReadUInt8String(nameoffs, 0x10000) newc.fill(nameoffs, 0, len(name)) count += 1 if newc.save(dstname): print("successfully stripped all %d local symbols!" % (count,)) else: print("error: couldn't save stripped binary to '%s'" % (dstname,)) def stripELF(srcname, dstname): oldc = createContainerFromFile(srcname) if oldc.isNull(): print("error: couldn't open '%s'" % (srcname,)) return obj = ELFObject() if not obj.Load(oldc): print("error: could't load ELF") return newc = oldc.copyToNewContainer() sects = obj.Sections() count = 0 it = obj.SymbolTableSections().iterator() it.next() while it.hasNext(): s = sects.At(it.next()) # only the .symtab section if s.Num("sh_type") != 2: continue strtaboffs = sects.At(s.Num("sh_link")).Num("sh_offset") sit = obj.Symbols(s).iterator() while sit.hasNext(): sym = sit.next() # only local symbols if sym.Num("st_shndx") == 0: continue nameoffs = sym.Num("st_name") + strtaboffs name, ret = obj.ReadUInt8String(nameoffs, 0x10000) newc.fill(nameoffs, 0, len(name)) count += 1 if newc.save(dstname): print("successfully stripped all %d local symbols!" % (count,)) else: print("error: couldn't save stripped binary to '%s'" % (dstname,))
# strip.py

from Pro.Core import *
from Pro.MachO import *
from Pro.ELF import *

def stripMachO(srcname, dstname):
    oldc = createContainerFromFile(srcname)
    if oldc.isNull():
        print("error: couldn't open '%s'" % (srcname,))
        return
    obj = MachObject()
    if not obj.Load(oldc):
        print("error: could't load Mach-O")
        return
    obj.ProcessLoadCommands()
    newc = oldc.copyToNewContainer()

    symlc = obj.SymTableLC()
    stroffs = symlc.Num("stroff")

    count = 0
    it = obj.SymbolNList(symlc).iterator()
    while it.hasNext():
        syms = it.next()
        # only local symbols
        if syms.Num("sect") == 0:
            continue
        nameoffs = obj.AddressToOffset(syms.Num("strx") + stroffs)
        name, ret = obj.ReadUInt8String(nameoffs, 0x10000)
        newc.fill(nameoffs, 0, len(name))
        count += 1

    if newc.save(dstname):
        print("successfully stripped all %d local symbols!" % (count,))
    else:
        print("error: couldn't save stripped binary to '%s'" % (dstname,))

def stripELF(srcname, dstname):
    oldc = createContainerFromFile(srcname)
    if oldc.isNull():
        print("error: couldn't open '%s'" % (srcname,))
        return
    obj = ELFObject()
    if not obj.Load(oldc):
        print("error: could't load ELF")
        return
    newc = oldc.copyToNewContainer()

    sects = obj.Sections()

    count = 0
    it = obj.SymbolTableSections().iterator()
    it.next()
    while it.hasNext():
        s = sects.At(it.next())
        # only the .symtab section
        if s.Num("sh_type") != 2:
            continue
        strtaboffs = sects.At(s.Num("sh_link")).Num("sh_offset")
        sit = obj.Symbols(s).iterator()
        while sit.hasNext():
            sym = sit.next()
            # only local symbols
            if sym.Num("st_shndx") == 0:
                continue
            nameoffs = sym.Num("st_name") + strtaboffs
            name, ret = obj.ReadUInt8String(nameoffs, 0x10000)
            newc.fill(nameoffs, 0, len(name))
            count += 1

    if newc.save(dstname):
        print("successfully stripped all %d local symbols!" % (count,))
    else:
        print("error: couldn't save stripped binary to '%s'" % (dstname,))

The Linux x64 version of Profiler should be released soon. So stay tuned!

Stripping symbols from a Mach-O

A common mistake many developers do is to leave names of local symbols inside applications built on OS X. Using the strip utility combined with the compiler visibility flags is, unfortunately, not enough.

So I wrote a small script for Profiler to be run from the command line and I integrated it in the build process.

The syntax to execute the script is:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
cerpro -c -r path/to/strip.py:stripMachO source destination
cerpro -c -r path/to/strip.py:stripMachO source destination
cerpro -c -r path/to/strip.py:stripMachO source destination

Here’s the whole code:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# name: strip.py
from Pro.Core import *
from Pro.MachO import *
def stripMachO(srcname, dstname):
oldc = createContainerFromFile(srcname)
if oldc.isNull():
print("error: couldn't open '%s'" % (srcname,))
return
obj = MachObject()
if not obj.Load(oldc):
print("error: could't load Mach-o")
return
obj.ProcessLoadCommands()
newc = oldc.copyToNewContainer()
symlc = obj.SymTableLC()
stroffs = symlc.Num("stroff")
it = obj.SymbolNList(symlc).iterator()
while it.hasNext():
syms = it.next()
# only local symbols
if syms.Num("sect") == 0:
continue
nameoffs = obj.AddressToOffset(syms.Num("strx") + stroffs)
name, ret = obj.ReadUInt8String(nameoffs, 0x10000)
newc.fill(nameoffs, 0, len(name))
if newc.save(dstname):
print("successfully stripped all local symbols!")
else:
print("error: couldn't save stripped binary to '%s'" % (dstname,))
# name: strip.py from Pro.Core import * from Pro.MachO import * def stripMachO(srcname, dstname): oldc = createContainerFromFile(srcname) if oldc.isNull(): print("error: couldn't open '%s'" % (srcname,)) return obj = MachObject() if not obj.Load(oldc): print("error: could't load Mach-o") return obj.ProcessLoadCommands() newc = oldc.copyToNewContainer() symlc = obj.SymTableLC() stroffs = symlc.Num("stroff") it = obj.SymbolNList(symlc).iterator() while it.hasNext(): syms = it.next() # only local symbols if syms.Num("sect") == 0: continue nameoffs = obj.AddressToOffset(syms.Num("strx") + stroffs) name, ret = obj.ReadUInt8String(nameoffs, 0x10000) newc.fill(nameoffs, 0, len(name)) if newc.save(dstname): print("successfully stripped all local symbols!") else: print("error: couldn't save stripped binary to '%s'" % (dstname,))
# name: strip.py

from Pro.Core import *
from Pro.MachO import *

def stripMachO(srcname, dstname):
    oldc = createContainerFromFile(srcname)
    if oldc.isNull():
        print("error: couldn't open '%s'" % (srcname,))
        return
    obj = MachObject()
    if not obj.Load(oldc):
        print("error: could't load Mach-o")
        return
    obj.ProcessLoadCommands()
    newc = oldc.copyToNewContainer()

    symlc = obj.SymTableLC()
    stroffs = symlc.Num("stroff")

    it = obj.SymbolNList(symlc).iterator()
    while it.hasNext():
        syms = it.next()
        # only local symbols
        if syms.Num("sect") == 0:
            continue
        nameoffs = obj.AddressToOffset(syms.Num("strx") + stroffs)
        name, ret = obj.ReadUInt8String(nameoffs, 0x10000)
        newc.fill(nameoffs, 0, len(name))

    if newc.save(dstname):
        print("successfully stripped all local symbols!")
    else:
        print("error: couldn't save stripped binary to '%s'" % (dstname,))

The code zeroes names of symbols which are not associated to any section in the binary.

Easy. 🙂

Android Binary XML support

The upcoming version 0.9.4 of the Profiler adds support for Android’s binary XML format (such as that used by AndroidManifest.xml).

Android Binary XML

Let’s take the sample output of the aapt tool in the Android SDK:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
N: android=http://schemas.android.com/apk/res/android
E: manifest (line=22)
A: package="com.example.android.notepad" (Raw: "com.example.android.notepad")
E: uses-sdk (line=25)
A: android:minSdkVersion(0x0101020c)=(type 0x10)0xb
E: application (line=27)
A: android:label(0x01010001)=@0x7f040000
A: android:icon(0x01010002)=@0x7f020000
E: provider (line=30)
A: android:name(0x01010003)="NotePadProvider" (Raw: "NotePadProvider")
A: android:exported(0x01010010)=(type 0x12)0x0
A: android:authorities(0x01010018)="com.google.provider.NotePad" (Raw: "com.google.provider.NotePad")
E: grant-uri-permission (line=33)
A: android:pathPattern(0x0101002c)=".*" (Raw: ".*")
E: activity (line=36)
A: android:label(0x01010001)=@0x7f040005
A: android:name(0x01010003)="NotesList" (Raw: "NotesList")
E: intent-filter (line=37)
E: action (line=38)
A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
E: category (line=39)
A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
E: intent-filter (line=41)
E: action (line=42)
A: android:name(0x01010003)="android.intent.action.VIEW" (Raw: "android.intent.action.VIEW")
E: action (line=43)
A: android:name(0x01010003)="android.intent.action.EDIT" (Raw: "android.intent.action.EDIT")
E: action (line=44)
A: android:name(0x01010003)="android.intent.action.PICK" (Raw: "android.intent.action.PICK")
E: category (line=45)
A: android:name(0x01010003)="android.intent.category.DEFAULT" (Raw: "android.intent.category.DEFAULT")
E: data (line=46)
A: android:mimeType(0x01010026)="vnd.android.cursor.dir/vnd.google.note" (Raw: "vnd.android.cursor.dir/vnd.google.note")
E: intent-filter (line=48)
E: action (line=49)
A: android:name(0x01010003)="android.intent.action.GET_CONTENT" (Raw: "android.intent.action.GET_CONTENT")
E: category (line=50)
A: android:name(0x01010003)="android.intent.category.DEFAULT" (Raw: "android.intent.category.DEFAULT")
E: data (line=51)
A: android:mimeType(0x01010026)="vnd.android.cursor.item/vnd.google.note" (Raw: "vnd.android.cursor.item/vnd.google.note")
E: activity (line=55)
A: android:theme(0x01010000)=@0x103006e
A: android:name(0x01010003)="NoteEditor" (Raw: "NoteEditor")
A: android:screenOrientation(0x0101001e)=(type 0x10)0x4
A: android:configChanges(0x0101001f)=(type 0x11)0xa0
E: intent-filter (line=62)
A: android:label(0x01010001)=@0x7f04000f
E: action (line=63)
A: android:name(0x01010003)="android.intent.action.VIEW" (Raw: "android.intent.action.VIEW")
E: action (line=64)
A: android:name(0x01010003)="android.intent.action.EDIT" (Raw: "android.intent.action.EDIT")
E: action (line=65)
A: android:name(0x01010003)="com.android.notepad.action.EDIT_NOTE" (Raw: "com.android.notepad.action.EDIT_NOTE")
E: category (line=66)
A: android:name(0x01010003)="android.intent.category.DEFAULT" (Raw: "android.intent.category.DEFAULT")
E: data (line=67)
A: android:mimeType(0x01010026)="vnd.android.cursor.item/vnd.google.note" (Raw: "vnd.android.cursor.item/vnd.google.note")
E: intent-filter (line=74)
E: action (line=75)
A: android:name(0x01010003)="android.intent.action.INSERT" (Raw: "android.intent.action.INSERT")
E: action (line=76)
A: android:name(0x01010003)="android.intent.action.PASTE" (Raw: "android.intent.action.PASTE")
E: category (line=77)
A: android:name(0x01010003)="android.intent.category.DEFAULT" (Raw: "android.intent.category.DEFAULT")
E: data (line=78)
A: android:mimeType(0x01010026)="vnd.android.cursor.dir/vnd.google.note" (Raw: "vnd.android.cursor.dir/vnd.google.note")
E: activity (line=83)
A: android:theme(0x01010000)=@0x103006f
A: android:label(0x01010001)=@0x7f040002
A: android:icon(0x01010002)=@0x7f020003
A: android:name(0x01010003)="TitleEditor" (Raw: "TitleEditor")
A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x4
E: intent-filter (line=92)
A: android:label(0x01010001)=@0x7f040010
E: action (line=96)
A: android:name(0x01010003)="com.android.notepad.action.EDIT_TITLE" (Raw: "com.android.notepad.action.EDIT_TITLE")
E: category (line=98)
A: android:name(0x01010003)="android.intent.category.DEFAULT" (Raw: "android.intent.category.DEFAULT")
E: category (line=101)
A: android:name(0x01010003)="android.intent.category.ALTERNATIVE" (Raw: "android.intent.category.ALTERNATIVE")
E: category (line=104)
A: android:name(0x01010003)="android.intent.category.SELECTED_ALTERNATIVE" (Raw: "android.intent.category.SELECTED_ALTERNATIVE")
E: data (line=106)
A: android:mimeType(0x01010026)="vnd.android.cursor.item/vnd.google.note" (Raw: "vnd.android.cursor.item/vnd.google.note")
E: activity (line=110)
A: android:label(0x01010001)=@0x7f040001
A: android:icon(0x01010002)=@0x7f020006
A: android:name(0x01010003)="NotesLiveFolder" (Raw: "NotesLiveFolder")
E: intent-filter (line=112)
E: action (line=113)
A: android:name(0x01010003)="android.intent.action.CREATE_LIVE_FOLDER" (Raw: "android.intent.action.CREATE_LIVE_FOLDER")
E: category (line=114)
A: android:name(0x01010003)="android.intent.category.DEFAULT" (Raw: "android.intent.category.DEFAULT")
N: android=http://schemas.android.com/apk/res/android E: manifest (line=22) A: package="com.example.android.notepad" (Raw: "com.example.android.notepad") E: uses-sdk (line=25) A: android:minSdkVersion(0x0101020c)=(type 0x10)0xb E: application (line=27) A: android:label(0x01010001)=@0x7f040000 A: android:icon(0x01010002)=@0x7f020000 E: provider (line=30) A: android:name(0x01010003)="NotePadProvider" (Raw: "NotePadProvider") A: android:exported(0x01010010)=(type 0x12)0x0 A: android:authorities(0x01010018)="com.google.provider.NotePad" (Raw: "com.google.provider.NotePad") E: grant-uri-permission (line=33) A: android:pathPattern(0x0101002c)=".*" (Raw: ".*") E: activity (line=36) A: android:label(0x01010001)=@0x7f040005 A: android:name(0x01010003)="NotesList" (Raw: "NotesList") E: intent-filter (line=37) E: action (line=38) A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN") E: category (line=39) A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER") E: intent-filter (line=41) E: action (line=42) A: android:name(0x01010003)="android.intent.action.VIEW" (Raw: "android.intent.action.VIEW") E: action (line=43) A: android:name(0x01010003)="android.intent.action.EDIT" (Raw: "android.intent.action.EDIT") E: action (line=44) A: android:name(0x01010003)="android.intent.action.PICK" (Raw: "android.intent.action.PICK") E: category (line=45) A: android:name(0x01010003)="android.intent.category.DEFAULT" (Raw: "android.intent.category.DEFAULT") E: data (line=46) A: android:mimeType(0x01010026)="vnd.android.cursor.dir/vnd.google.note" (Raw: "vnd.android.cursor.dir/vnd.google.note") E: intent-filter (line=48) E: action (line=49) A: android:name(0x01010003)="android.intent.action.GET_CONTENT" (Raw: "android.intent.action.GET_CONTENT") E: category (line=50) A: android:name(0x01010003)="android.intent.category.DEFAULT" (Raw: "android.intent.category.DEFAULT") E: data (line=51) A: android:mimeType(0x01010026)="vnd.android.cursor.item/vnd.google.note" (Raw: "vnd.android.cursor.item/vnd.google.note") E: activity (line=55) A: android:theme(0x01010000)=@0x103006e A: android:name(0x01010003)="NoteEditor" (Raw: "NoteEditor") A: android:screenOrientation(0x0101001e)=(type 0x10)0x4 A: android:configChanges(0x0101001f)=(type 0x11)0xa0 E: intent-filter (line=62) A: android:label(0x01010001)=@0x7f04000f E: action (line=63) A: android:name(0x01010003)="android.intent.action.VIEW" (Raw: "android.intent.action.VIEW") E: action (line=64) A: android:name(0x01010003)="android.intent.action.EDIT" (Raw: "android.intent.action.EDIT") E: action (line=65) A: android:name(0x01010003)="com.android.notepad.action.EDIT_NOTE" (Raw: "com.android.notepad.action.EDIT_NOTE") E: category (line=66) A: android:name(0x01010003)="android.intent.category.DEFAULT" (Raw: "android.intent.category.DEFAULT") E: data (line=67) A: android:mimeType(0x01010026)="vnd.android.cursor.item/vnd.google.note" (Raw: "vnd.android.cursor.item/vnd.google.note") E: intent-filter (line=74) E: action (line=75) A: android:name(0x01010003)="android.intent.action.INSERT" (Raw: "android.intent.action.INSERT") E: action (line=76) A: android:name(0x01010003)="android.intent.action.PASTE" (Raw: "android.intent.action.PASTE") E: category (line=77) A: android:name(0x01010003)="android.intent.category.DEFAULT" (Raw: "android.intent.category.DEFAULT") E: data (line=78) A: android:mimeType(0x01010026)="vnd.android.cursor.dir/vnd.google.note" (Raw: "vnd.android.cursor.dir/vnd.google.note") E: activity (line=83) A: android:theme(0x01010000)=@0x103006f A: android:label(0x01010001)=@0x7f040002 A: android:icon(0x01010002)=@0x7f020003 A: android:name(0x01010003)="TitleEditor" (Raw: "TitleEditor") A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x4 E: intent-filter (line=92) A: android:label(0x01010001)=@0x7f040010 E: action (line=96) A: android:name(0x01010003)="com.android.notepad.action.EDIT_TITLE" (Raw: "com.android.notepad.action.EDIT_TITLE") E: category (line=98) A: android:name(0x01010003)="android.intent.category.DEFAULT" (Raw: "android.intent.category.DEFAULT") E: category (line=101) A: android:name(0x01010003)="android.intent.category.ALTERNATIVE" (Raw: "android.intent.category.ALTERNATIVE") E: category (line=104) A: android:name(0x01010003)="android.intent.category.SELECTED_ALTERNATIVE" (Raw: "android.intent.category.SELECTED_ALTERNATIVE") E: data (line=106) A: android:mimeType(0x01010026)="vnd.android.cursor.item/vnd.google.note" (Raw: "vnd.android.cursor.item/vnd.google.note") E: activity (line=110) A: android:label(0x01010001)=@0x7f040001 A: android:icon(0x01010002)=@0x7f020006 A: android:name(0x01010003)="NotesLiveFolder" (Raw: "NotesLiveFolder") E: intent-filter (line=112) E: action (line=113) A: android:name(0x01010003)="android.intent.action.CREATE_LIVE_FOLDER" (Raw: "android.intent.action.CREATE_LIVE_FOLDER") E: category (line=114) A: android:name(0x01010003)="android.intent.category.DEFAULT" (Raw: "android.intent.category.DEFAULT")
N: android=http://schemas.android.com/apk/res/android
  E: manifest (line=22)
    A: package="com.example.android.notepad" (Raw: "com.example.android.notepad")
    E: uses-sdk (line=25)
      A: android:minSdkVersion(0x0101020c)=(type 0x10)0xb
    E: application (line=27)
      A: android:label(0x01010001)=@0x7f040000
      A: android:icon(0x01010002)=@0x7f020000
      E: provider (line=30)
        A: android:name(0x01010003)="NotePadProvider" (Raw: "NotePadProvider")
        A: android:exported(0x01010010)=(type 0x12)0x0
        A: android:authorities(0x01010018)="com.google.provider.NotePad" (Raw: "com.google.provider.NotePad")
        E: grant-uri-permission (line=33)
          A: android:pathPattern(0x0101002c)=".*" (Raw: ".*")
      E: activity (line=36)
        A: android:label(0x01010001)=@0x7f040005
        A: android:name(0x01010003)="NotesList" (Raw: "NotesList")
        E: intent-filter (line=37)
          E: action (line=38)
            A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
          E: category (line=39)
            A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
        E: intent-filter (line=41)
          E: action (line=42)
            A: android:name(0x01010003)="android.intent.action.VIEW" (Raw: "android.intent.action.VIEW")
          E: action (line=43)
            A: android:name(0x01010003)="android.intent.action.EDIT" (Raw: "android.intent.action.EDIT")
          E: action (line=44)
            A: android:name(0x01010003)="android.intent.action.PICK" (Raw: "android.intent.action.PICK")
          E: category (line=45)
            A: android:name(0x01010003)="android.intent.category.DEFAULT" (Raw: "android.intent.category.DEFAULT")
          E: data (line=46)
            A: android:mimeType(0x01010026)="vnd.android.cursor.dir/vnd.google.note" (Raw: "vnd.android.cursor.dir/vnd.google.note")
        E: intent-filter (line=48)
          E: action (line=49)
            A: android:name(0x01010003)="android.intent.action.GET_CONTENT" (Raw: "android.intent.action.GET_CONTENT")
          E: category (line=50)
            A: android:name(0x01010003)="android.intent.category.DEFAULT" (Raw: "android.intent.category.DEFAULT")
          E: data (line=51)
            A: android:mimeType(0x01010026)="vnd.android.cursor.item/vnd.google.note" (Raw: "vnd.android.cursor.item/vnd.google.note")
      E: activity (line=55)
        A: android:theme(0x01010000)=@0x103006e
        A: android:name(0x01010003)="NoteEditor" (Raw: "NoteEditor")
        A: android:screenOrientation(0x0101001e)=(type 0x10)0x4
        A: android:configChanges(0x0101001f)=(type 0x11)0xa0
        E: intent-filter (line=62)
          A: android:label(0x01010001)=@0x7f04000f
          E: action (line=63)
            A: android:name(0x01010003)="android.intent.action.VIEW" (Raw: "android.intent.action.VIEW")
          E: action (line=64)
            A: android:name(0x01010003)="android.intent.action.EDIT" (Raw: "android.intent.action.EDIT")
          E: action (line=65)
            A: android:name(0x01010003)="com.android.notepad.action.EDIT_NOTE" (Raw: "com.android.notepad.action.EDIT_NOTE")
          E: category (line=66)
            A: android:name(0x01010003)="android.intent.category.DEFAULT" (Raw: "android.intent.category.DEFAULT")
          E: data (line=67)
            A: android:mimeType(0x01010026)="vnd.android.cursor.item/vnd.google.note" (Raw: "vnd.android.cursor.item/vnd.google.note")
        E: intent-filter (line=74)
          E: action (line=75)
            A: android:name(0x01010003)="android.intent.action.INSERT" (Raw: "android.intent.action.INSERT")
          E: action (line=76)
            A: android:name(0x01010003)="android.intent.action.PASTE" (Raw: "android.intent.action.PASTE")
          E: category (line=77)
            A: android:name(0x01010003)="android.intent.category.DEFAULT" (Raw: "android.intent.category.DEFAULT")
          E: data (line=78)
            A: android:mimeType(0x01010026)="vnd.android.cursor.dir/vnd.google.note" (Raw: "vnd.android.cursor.dir/vnd.google.note")
      E: activity (line=83)
        A: android:theme(0x01010000)=@0x103006f
        A: android:label(0x01010001)=@0x7f040002
        A: android:icon(0x01010002)=@0x7f020003
        A: android:name(0x01010003)="TitleEditor" (Raw: "TitleEditor")
        A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x4
        E: intent-filter (line=92)
          A: android:label(0x01010001)=@0x7f040010
          E: action (line=96)
            A: android:name(0x01010003)="com.android.notepad.action.EDIT_TITLE" (Raw: "com.android.notepad.action.EDIT_TITLE")
          E: category (line=98)
            A: android:name(0x01010003)="android.intent.category.DEFAULT" (Raw: "android.intent.category.DEFAULT")
          E: category (line=101)
            A: android:name(0x01010003)="android.intent.category.ALTERNATIVE" (Raw: "android.intent.category.ALTERNATIVE")
          E: category (line=104)
            A: android:name(0x01010003)="android.intent.category.SELECTED_ALTERNATIVE" (Raw: "android.intent.category.SELECTED_ALTERNATIVE")
          E: data (line=106)
            A: android:mimeType(0x01010026)="vnd.android.cursor.item/vnd.google.note" (Raw: "vnd.android.cursor.item/vnd.google.note")
      E: activity (line=110)
        A: android:label(0x01010001)=@0x7f040001
        A: android:icon(0x01010002)=@0x7f020006
        A: android:name(0x01010003)="NotesLiveFolder" (Raw: "NotesLiveFolder")
        E: intent-filter (line=112)
          E: action (line=113)
            A: android:name(0x01010003)="android.intent.action.CREATE_LIVE_FOLDER" (Raw: "android.intent.action.CREATE_LIVE_FOLDER")
          E: category (line=114)
            A: android:name(0x01010003)="android.intent.category.DEFAULT" (Raw: "android.intent.category.DEFAULT")

And now the output of the Profiler:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.android.notepad">
<uses-sdk android:minsdkversion="16/">
<application android:label="0x7F040000" android:icon="0x7F020000">
<provider android:name="NotePadProvider" android:exported="18" android:authorities="com.google.provider.NotePad">
<grant-uri-permission android:pathpattern=".*">
</grant-uri-permission></provider>
<activity android:label="0x7F040005" android:name="NotesList">
<intent-filter>
<action android:name="android.intent.action.MAIN">
<category android:name="android.intent.category.LAUNCHER">
</category></action></intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW">
<action android:name="android.intent.action.EDIT">
<action android:name="android.intent.action.PICK">
<category android:name="android.intent.category.DEFAULT">
<data android:mimetype="vnd.android.cursor.dir/vnd.google.note">
</data></category></action></action></action></intent-filter>
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT">
<category android:name="android.intent.category.DEFAULT">
<data android:mimetype="vnd.android.cursor.item/vnd.google.note">
</data></category></action></intent-filter>
</activity>
<activity android:theme="0x103006E" android:name="NoteEditor" android:screenorientation="16" android:configchanges="17">
<intent-filter android:label="0x7F04000F">
<action android:name="android.intent.action.VIEW">
<action android:name="android.intent.action.EDIT">
<action android:name="com.android.notepad.action.EDIT_NOTE">
<category android:name="android.intent.category.DEFAULT">
<data android:mimetype="vnd.android.cursor.item/vnd.google.note">
</data></category></action></action></action></intent-filter>
<intent-filter>
<action android:name="android.intent.action.INSERT">
<action android:name="android.intent.action.PASTE">
<category android:name="android.intent.category.DEFAULT">
<data android:mimetype="vnd.android.cursor.dir/vnd.google.note">
</data></category></action></action></intent-filter>
</activity>
<activity android:theme="0x103006F" android:label="0x7F040002" android:icon="0x7F020003" android:name="TitleEditor" android:windowsoftinputmode="17">
<intent-filter android:label="0x7F040010">
<action android:name="com.android.notepad.action.EDIT_TITLE">
<category android:name="android.intent.category.DEFAULT">
<category android:name="android.intent.category.ALTERNATIVE">
<category android:name="android.intent.category.SELECTED_ALTERNATIVE">
<data android:mimetype="vnd.android.cursor.item/vnd.google.note">
</data></category></category></category></action></intent-filter>
</activity>
<activity android:label="0x7F040001" android:icon="0x7F020006" android:name="NotesLiveFolder">
<intent-filter>
<action android:name="android.intent.action.CREATE_LIVE_FOLDER">
<category android:name="android.intent.category.DEFAULT">
</category></action></intent-filter>
</activity>
</application>
</uses-sdk></manifest>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.android.notepad"> <uses-sdk android:minsdkversion="16/"> <application android:label="0x7F040000" android:icon="0x7F020000"> <provider android:name="NotePadProvider" android:exported="18" android:authorities="com.google.provider.NotePad"> <grant-uri-permission android:pathpattern=".*"> </grant-uri-permission></provider> <activity android:label="0x7F040005" android:name="NotesList"> <intent-filter> <action android:name="android.intent.action.MAIN"> <category android:name="android.intent.category.LAUNCHER"> </category></action></intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW"> <action android:name="android.intent.action.EDIT"> <action android:name="android.intent.action.PICK"> <category android:name="android.intent.category.DEFAULT"> <data android:mimetype="vnd.android.cursor.dir/vnd.google.note"> </data></category></action></action></action></intent-filter> <intent-filter> <action android:name="android.intent.action.GET_CONTENT"> <category android:name="android.intent.category.DEFAULT"> <data android:mimetype="vnd.android.cursor.item/vnd.google.note"> </data></category></action></intent-filter> </activity> <activity android:theme="0x103006E" android:name="NoteEditor" android:screenorientation="16" android:configchanges="17"> <intent-filter android:label="0x7F04000F"> <action android:name="android.intent.action.VIEW"> <action android:name="android.intent.action.EDIT"> <action android:name="com.android.notepad.action.EDIT_NOTE"> <category android:name="android.intent.category.DEFAULT"> <data android:mimetype="vnd.android.cursor.item/vnd.google.note"> </data></category></action></action></action></intent-filter> <intent-filter> <action android:name="android.intent.action.INSERT"> <action android:name="android.intent.action.PASTE"> <category android:name="android.intent.category.DEFAULT"> <data android:mimetype="vnd.android.cursor.dir/vnd.google.note"> </data></category></action></action></intent-filter> </activity> <activity android:theme="0x103006F" android:label="0x7F040002" android:icon="0x7F020003" android:name="TitleEditor" android:windowsoftinputmode="17"> <intent-filter android:label="0x7F040010"> <action android:name="com.android.notepad.action.EDIT_TITLE"> <category android:name="android.intent.category.DEFAULT"> <category android:name="android.intent.category.ALTERNATIVE"> <category android:name="android.intent.category.SELECTED_ALTERNATIVE"> <data android:mimetype="vnd.android.cursor.item/vnd.google.note"> </data></category></category></category></action></intent-filter> </activity> <activity android:label="0x7F040001" android:icon="0x7F020006" android:name="NotesLiveFolder"> <intent-filter> <action android:name="android.intent.action.CREATE_LIVE_FOLDER"> <category android:name="android.intent.category.DEFAULT"> </category></action></intent-filter> </activity> </application> </uses-sdk></manifest>

  
  
    
      
    
    
      
        
        
      
      
        
        
        
        
        
      
      
        
        
        
      
    
    
      
        
        
        
        
        
      
      
        
        
        
        
      
    
    
      
        
        
        
        
        
      
    
    
      
        
        
      
    
  

Of course UI XMLs can be opened as well:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<view xmlns:android="http://schemas.android.com/apk/res/android" android:textsize="5" android:gravity="17" android:id="0x7F060000" android:background="0x106000D" android:padding="5" android:scrollbars="17" android:fadingedge="17" android:layout_width="16" android:layout_height="16" android:capitalize="16" class="com.example.android.notepad.NoteEditor$LinedEditText"></view>
<view xmlns:android="http://schemas.android.com/apk/res/android" android:textsize="5" android:gravity="17" android:id="0x7F060000" android:background="0x106000D" android:padding="5" android:scrollbars="17" android:fadingedge="17" android:layout_width="16" android:layout_height="16" android:capitalize="16" class="com.example.android.notepad.NoteEditor$LinedEditText"></view>

The converter can be used from Python as well as a filter called ‘android/from_axml‘.

The new version will be out in a few days. Stay tuned!