FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
jeb-samplecode/scripts/JumpToAndroidComponent.py at master · pnfsoftware/jeb-samplecode · GitHub
pnfsoftware
jeb-samplecode
Repository navigation
Code
Pull requests
3
(3)
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
jeb-samplecode
/
scripts
/
JumpToAndroidComponent.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
49 lines (40 loc) · 1.85 KB
Breadcrumbs
jeb-samplecode
/
scripts
/
JumpToAndroidComponent.py
Copy path
File metadata and controls
49 lines (40 loc) · 1.85 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#?description=Jump from an activity name (selected in the Android XML Manifest) to its corresponding bytecode definition in the DEX disassembly fragment.
#?shortcut=
#?nolist
from
com
.
pnfsoftware
.
jeb
.
client
.
api
import
IScript
,
IGraphicalClientContext
,
IUnitView
from
com
.
pnfsoftware
.
jeb
.
core
.
units
import
IUnit
,
IXmlUnit
from
com
.
pnfsoftware
.
jeb
.
core
.
units
.
code
.
android
import
IDexUnit
from
com
.
pnfsoftware
.
jeb
.
core
import
RuntimeProjectUtil
"""
Sample script for JEB Decompiler.
!!! SAME AS DexJumpToActivity.py !!!
This JEB UI script allows the user to jump from an activity name (selected in the Android XML
Manifest) to its corresponding bytecode definition in the DEX disassembly fragment.
"""
class
JumpToAndroidComponent
(
IScript
):
def
run
(
self
,
ctx
):
if
not
isinstance
(
ctx
,
IGraphicalClientContext
):
print
(
'This script must be run within a graphical client'
)
return
fragment
=
ctx
.
getFocusedView
().
getActiveFragment
()
if
type
(
fragment
.
getUnit
())
is
IXmlUnit
:
print
(
'Select the Manifest XML view'
)
return
aname
=
fragment
.
getActiveItemAsText
()
if
not
aname
:
print
(
'Select the activity name'
)
return
# activity name is relative to the package name
if
aname
.
startswith
(
'.'
):
# unit is the Manifest, of type IXmlUnit; we can retrieve the XML document
# note: an alternate way would be to retrieve the top-level IApkUnit, and use getPackageName()
pname
=
fragment
.
getUnit
().
getDocument
().
getElementsByTagName
(
"manifest"
).
item
(
0
).
getAttribute
(
"package"
)
#print('Package name: %s' % pname)
aname
=
pname
+
aname
print
(
'Activity name: %s'
%
aname
)
addr
=
'L'
+
aname
.
replace
(
'.'
,
'/'
)
+
';'
print
(
'Target address: %s'
%
addr
)
dexunit
=
ctx
.
getMainProject
().
findUnit
(
IDexUnit
)
f
=
ctx
.
findFragment
(
dexunit
,
'Disassembly'
,
True
)
if
f
:
f
.
setActiveAddress
(
addr
)
Back
|
FazBrowse Home
|
New Git URL