-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmikuWorkflow.py
50 lines (41 loc) · 1.56 KB
/
mikuWorkflow.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
47
48
49
50
from binaryninja import (
AnalysisContext,
)
from .utils import log_error, log_info
from .passes.low.spiltIfPass import pass_spilt_if_block
from .passes.low.copyCommonBlockPass import pass_copy_common_block
from .passes.low.inlineIfCondPass import pass_inline_if_cond
from .passes.mid.reverseIfPass import pass_reverse_if
from .passes.mid.deflatHardPass import pass_deflate_hard
from .passes.mid.clearPass import pass_clear
from .passes.mid.movStateDefine import pass_mov_state_define
def workflow_patch_llil(analysis_context: AnalysisContext):
function = analysis_context.function
try:
llil = function.llil
if llil is None:
return
except:
return
pass_copy_common_block(analysis_context)
pass_inline_if_cond(analysis_context)
pass_spilt_if_block(analysis_context)
return True
def workflow_patch_mlil(analysis_context: AnalysisContext):
function = analysis_context.function
mlil = function.mlil
if mlil is None:
log_error(f"Function {function.name} has no MLIL")
return
pass_clear(analysis_context)
pass_mov_state_define(analysis_context)
pass_reverse_if(analysis_context)
pass_mov_state_define(analysis_context)
pass_deflate_hard(analysis_context)
pass_clear(analysis_context)
pass_mov_state_define(analysis_context)
pass_deflate_hard(analysis_context)
pass_clear(analysis_context)
def workflow_patch_hlil(analysis_context: AnalysisContext):
from .utils import suggest_stateVar
suggest_stateVar(analysis_context.view, analysis_context.function)