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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
/***************************************************Project Mutator****************************************************/
/*first line intentionally left blank.*/
/*bruiser's lua asmrewriter implementation for jump tables*/
/*Copyright (C) 2018 Farzad Sadeghi
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 3
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.*/
/**********************************************************************************************************************/
#include "./lua-5.3.4/src/lua.h"
#include "./lua-5.3.4/src/lauxlib.h"
#include "./lua-5.3.4/src/lualib.h"
//#include "./bruisercapstone.h"
#include <inttypes.h>
/**********************************************************************************************************************/
#ifndef ASM_REWRITER_H
#define ASM_REWRITER_H
#ifdef __cplusplus
extern "C" {
#endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
static JMP_S_T* convert_jmpt(lua_State* __ls, int index);
static JMP_S_T* check_jmpt(lua_State* __ls, int index);
JMP_S_T* push_jmpt(lua_State* __ls);
int jmpt_push_args(lua_State* __ls, JMP_S_T* jmpt);
int new_jmpt_2(lua_State* __ls);
int new_jmpt(lua_State* __ls);
static int jmpt_custom(lua_State* __ls);
#define SET_GENERATOR(X) \
static int jmpt_set_##X(lua_State* __ls);
#define X_LIST_GEN \
X(type, "setter method for type")\
X(location, "setter method for location")\
X(size, "setter method for size")\
X(address, "setter method for address")\
X(address_y, "setter method for address_y")\
X(address_n, "setter method for address_n")\
X(y, "setter method for y")\
X(n, "setter method for n")\
X(z, "setter method for z")
#define X(X1,X2) SET_GENERATOR(X1)
X_LIST_GEN
#undef X
#undef X_LIST_GEN
#undef SET_GENERATOR
#define GET_GENERATOR(X) \
static int X(lua_State* __ls);
#define X_LIST_GEN \
X(type, "setter method for type")\
X(location, "setter method for location")\
X(size, "setter method for size")\
X(address, "setter method for address")\
X(address_y, "setter method for address_y")\
X(address_n, "setter method for address_n")\
X(y, "setter method for y")\
X(n, "setter method for n")\
X(z, "setter method for z")
#define X(X1,X2) GET_GENERATOR(X1)
X_LIST_GEN
#undef X
#undef X_LIST_GEN
#undef GET_GENERATOR
static int next(lua_State* __ls);
static int next_y(lua_State* __ls);
static int next_n(lua_State* __ls);
static int inext(lua_State* __ls);
static int jmpt_set_next(lua_State* __ls);
static int jmpt_set_next_y(lua_State* __ls);
static int jmpt_set_next_n(lua_State* __ls);
static int jmpt_gc(lua_State* __ls);
int jmpt_register(lua_State* __ls);
#ifdef __cplusplus
}
#endif
#endif
/**********************************************************************************************************************/
/*last line intentionally left blank.*/
|