Rizin
unix-like reverse engineering framework and cli tools
analysis_malbolge.c
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2015 condret <condr3t@protonmail.com>
2
// SPDX-License-Identifier: LGPL-3.0-only
3
4
#include <
rz_analysis.h
>
5
#include <
rz_types.h
>
6
#include <
rz_lib.h
>
7
8
static
int
mal_analysis
(
RzAnalysis
*analysis,
RzAnalysisOp
*
op
,
ut64
addr
,
const
ut8
*data,
int
len
,
RzAnalysisOpMask
mask
) {
9
if
(
len
) {
10
switch
((data[0] +
addr
) % 94) {
11
case
4:
12
op
->type =
RZ_ANALYSIS_OP_TYPE_UJMP
;
13
break
;
14
case
5:
15
case
23:
16
op
->type =
RZ_ANALYSIS_OP_TYPE_IO
;
17
break
;
18
case
39:
19
op
->type =
RZ_ANALYSIS_OP_TYPE_ROR
;
20
op
->type2 =
RZ_ANALYSIS_OP_TYPE_LOAD
;
21
break
;
22
case
40:
23
op
->type =
RZ_ANALYSIS_OP_TYPE_LOAD
;
24
break
;
25
case
62:
26
op
->type =
RZ_ANALYSIS_OP_TYPE_XOR
;
27
op
->type2 =
RZ_ANALYSIS_OP_TYPE_LOAD
;
28
break
;
29
case
81:
30
op
->type =
RZ_ANALYSIS_OP_TYPE_TRAP
;
31
break
;
32
default
:
33
op
->type =
RZ_ANALYSIS_OP_TYPE_NOP
;
34
}
35
return
op
->size = 1;
36
}
37
return
false
;
38
}
39
40
RzAnalysisPlugin
rz_analysis_plugin_malbolge
= {
41
.
name
=
"malbolge"
,
42
.desc =
"Malbolge analysis plugin"
,
43
.arch =
"malbolge"
,
44
.license =
"LGPL3"
,
45
.bits = 32,
46
.op = &
mal_analysis
,
47
};
48
49
#ifndef RZ_PLUGIN_INCORE
50
RZ_API
RzLibStruct
rizin_plugin
= {
51
.
type
=
RZ_LIB_TYPE_ANALYSIS
,
52
.data = &
rz_analysis_plugin_malbolge
,
53
.
version
=
RZ_VERSION
54
};
55
#endif
len
size_t len
Definition:
6502dis.c:15
mask
#define mask()
Definition:
analysis_h8300.c:39
mal_analysis
static int mal_analysis(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *data, int len, RzAnalysisOpMask mask)
Definition:
analysis_malbolge.c:8
rz_analysis_plugin_malbolge
RzAnalysisPlugin rz_analysis_plugin_malbolge
Definition:
analysis_malbolge.c:40
rizin_plugin
RZ_API RzLibStruct rizin_plugin
Definition:
analysis_malbolge.c:50
RZ_API
#define RZ_API
Definition:
core_plugin_example.c:36
ut8
uint8_t ut8
Definition:
lh5801.h:11
rz_analysis.h
RzAnalysisOpMask
RzAnalysisOpMask
Definition:
rz_analysis.h:439
RZ_ANALYSIS_OP_TYPE_LOAD
@ RZ_ANALYSIS_OP_TYPE_LOAD
Definition:
rz_analysis.h:416
RZ_ANALYSIS_OP_TYPE_UJMP
@ RZ_ANALYSIS_OP_TYPE_UJMP
Definition:
rz_analysis.h:369
RZ_ANALYSIS_OP_TYPE_IO
@ RZ_ANALYSIS_OP_TYPE_IO
Definition:
rz_analysis.h:403
RZ_ANALYSIS_OP_TYPE_ROR
@ RZ_ANALYSIS_OP_TYPE_ROR
Definition:
rz_analysis.h:419
RZ_ANALYSIS_OP_TYPE_TRAP
@ RZ_ANALYSIS_OP_TYPE_TRAP
Definition:
rz_analysis.h:392
RZ_ANALYSIS_OP_TYPE_NOP
@ RZ_ANALYSIS_OP_TYPE_NOP
Definition:
rz_analysis.h:389
RZ_ANALYSIS_OP_TYPE_XOR
@ RZ_ANALYSIS_OP_TYPE_XOR
Definition:
rz_analysis.h:412
rz_lib.h
RZ_LIB_TYPE_ANALYSIS
@ RZ_LIB_TYPE_ANALYSIS
Definition:
rz_lib.h:73
rz_types.h
RZ_VERSION
#define RZ_VERSION
Definition:
rz_version.h:8
rz_analysis_op_t
Definition:
rz_analysis.h:811
rz_analysis_plugin_t
Definition:
rz_analysis.h:1233
rz_analysis_plugin_t::version
const char * version
Definition:
rz_analysis.h:1239
rz_analysis_plugin_t::name
const char * name
Definition:
rz_analysis.h:1234
rz_analysis_t
Definition:
rz_analysis.h:553
rz_lib_struct_t
Definition:
rz_lib.h:57
rz_lib_struct_t::type
int type
Definition:
rz_lib.h:58
op
Definition:
dis.c:32
ut64
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
addr
static int addr
Definition:
z80asm.c:58
librz
analysis
p
analysis_malbolge.c
Generated by
1.9.1