Created
August 27, 2021 15:42
-
-
Save nfalliere/b67c17984262cb84a94af609434073f1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#?description= | |
#?shortcut= | |
from com.pnfsoftware.jeb.client.api import IScript | |
from com.pnfsoftware.jeb.core.units.code.android import IDexUnit | |
from com.pnfsoftware.jeb.core.actions import ActionContext, ActionTypeHierarchyData, Actions | |
class PrintDexHierarchy(IScript): | |
def run(self, ctx): | |
prj = ctx.getMainProject() | |
# method 1: retrieving the selected class graphically: set the caret on a class item | |
unit = ctx.getFocusedUnit() | |
assert isinstance(unit, IDexUnit) | |
current_item = ctx.getFocusedItem() | |
item_id = current_item.getItemId() | |
# method 2: retrieving a class Item programmatically from the full-class name | |
#unit = prj.findUnit(IDexUnit) | |
#cl = unit.getClass('Lcom/foo/Bar;') | |
#item_id = cl.getItemId() | |
data = ActionTypeHierarchyData() | |
if unit.prepareExecution(ActionContext(unit, Actions.QUERY_TYPE_HIER, item_id, None), data): | |
print('Base node for the hierarchy: %s' % data.getBaseNode()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment