This repository has been archived by the owner on Dec 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy path__init__.py
46 lines (35 loc) · 1.44 KB
/
__init__.py
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
#
# Binary Ninja interface for RetDec decompiler
#
# Ref:
# * https://retdec.com/api/docs/decompiler.html
# * https://api.binary.ninja/
#
# @_hugsy_
#
from binaryninja import *
from retdec import RetDecDecompiler
def function_decompile(view, function_name):
"""Plugin callback for function decompilation."""
bg_retdec = RetDecDecompiler(view, RetDecDecompiler.DECOMPILE_FUNCTION_MODE, function_name)
bg_retdec.start()
return
def bytes_decompile(self, addr, length):
"""Plugin callback for byte range decompilation."""
bg_retdec = RetDecDecompiler(view, RetDecDecompiler.DECOMPILE_RANGE_MODE, addr, length)
bg_retdec.start()
return
def file_decompile(view):
"""Plugin callback for entire file decompilation."""
bg_retdec = RetDecDecompiler(view, RetDecDecompiler.DECOMPILE_FILE_MODE)
bg_retdec.start()
return
PluginCommand.register_for_function("Decompile Function with RetDec",
"Use RetDec decompiler to decompile the current function.",
function_decompile)
# PluginCommand.register_for_range("Decompile selected range with RetDec",
# "Use RetDec decompiler to decompile the selected bytes.",
# bytes_decompile)
PluginCommand.register("Decompile Binary with RetDec",
"Use RetDec decompiler to decompile the binary.",
file_decompile)