Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
artifacts-asiaccs20
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andrea Gussoni
artifacts-asiaccs20
Commits
797ab5c2
Commit
797ab5c2
authored
4 years ago
by
Andrea Gussoni
Browse files
Options
Downloads
Patches
Plain Diff
Add Ghidra decompilation plugin
parent
cef588a1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripting/ghidra-extraction-scripts/DecompileAll.java
+28
-0
28 additions, 0 deletions
scripting/ghidra-extraction-scripts/DecompileAll.java
with
28 additions
and
0 deletions
scripting/ghidra-extraction-scripts/DecompileAll.java
0 → 100644
+
28
−
0
View file @
797ab5c2
private
void
exportToC
(
DecompileResults
results
)
{
try
{
ClangTokenGroup
grp
=
results
.
getCCodeMarkup
();
if
(
grp
!=
null
)
{
File
tmpFile
=
new
File
(
"~/headless-sources"
+
"/"
+
results
.
getFunction
().
getName
()
+
".c"
);
PrintWriter
writer
=
new
PrintWriter
(
new
FileOutputStream
(
tmpFile
));
PrettyPrinter
printer
=
new
PrettyPrinter
(
results
.
getFunction
(),
grp
);
DecompiledFunction
decompFunc
=
printer
.
print
(
true
);
writer
.
write
(
decompFunc
.
getC
());
writer
.
close
();
}
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
getStackTrace
());
}
}
@Override
public
void
run
()
throws
Exception
{
var
program
=
this
.
getCurrentProgram
();
DecompInterface
ifc
=
new
DecompInterface
();
ifc
.
openProgram
(
program
);
for
(
var
func
:
program
.
getFunctionManager
().
getFunctions
(
true
))
{
var
results
=
ifc
.
decompileFunction
(
func
,
100000
,
null
);
exportToC
(
results
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment