FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
jeb-samplecode/scripts/JavaASTDemo.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
/
JavaASTDemo.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
24 lines (22 loc) · 765 Bytes
Breadcrumbs
jeb-samplecode
/
scripts
/
JavaASTDemo.py
Copy path
File metadata and controls
24 lines (22 loc) · 765 Bytes
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
#?description=Show how to navigate and dump Java AST trees
#?shortcut=
from
com
.
pnfsoftware
.
jeb
.
client
.
api
import
IScript
from
com
.
pnfsoftware
.
jeb
.
core
.
units
.
code
.
java
import
IJavaSourceUnit
,
IJavaClass
"""
Sample script for JEB Decompiler.
"""
class
JavaASTDemo
(
IScript
):
def
run
(
self
,
ctx
):
prj
=
ctx
.
getMainProject
()
assert
prj
,
'Need a project'
for
unit
in
prj
.
findUnits
(
IJavaSourceUnit
):
elt
=
unit
.
getASTElement
()
if
isinstance
(
elt
,
IJavaClass
):
for
m
in
elt
.
getMethods
():
self
.
displayTree
(
m
)
def
displayTree
(
self
,
e
,
level
=
0
):
print
(
'%s%s @ 0x%X'
%
(
level
*
' '
,
e
.
getElementType
(),
e
.
getPhysicalOffset
()))
if
e
:
elts
=
e
.
getSubElements
()
for
e
in
elts
:
self
.
displayTree
(
e
,
level
+
1
)
Back
|
FazBrowse Home
|
New Git URL