forked from NytroRST/ShellcodeCompiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunctionCalls.h
More file actions
86 lines (57 loc) · 1.82 KB
/
FunctionCalls.h
File metadata and controls
86 lines (57 loc) · 1.82 KB
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
#ifndef FUNCTIONCALLS_H
#define FUNCTIONCALLS_H
#include <string>
#include <vector>
#include "DeclaredFunctions.h"
#include "StringOffsetAddress.h"
#include "FunctionOffsetAddress.h"
#include "Platform.h"
#include "LinuxSyscalls.h"
using namespace std;
class FunctionCalls
{
public:
static const int PARAMETER_TYPE_INT;
static const int PARAMETER_TYPE_STRING;
// Struct used to save a parameter
struct Parameter
{
size_t Type;
size_t IntValue;
string StringValue;
};
// Struct to save data for a function call
struct FunctionCall
{
string Name;
vector<Parameter> Parameters;
};
// All function calls and index
static size_t AllFunctionCallsNr;
static vector<FunctionCall> AllFunctionCalls;
static bool FirstFunctionCall;
// Constructor
FunctionCalls()
{
AllFunctionCallsNr = 0;
FirstFunctionCall = true;
}
// Put a string (function parameter) on the stack
static string GeneratePutStringToStack_x86(string p_sString);
static string GeneratePutStringToStack_x64(string p_sString);
// Generate a function call / syscall
static string GenerateFunctionCall(FunctionCalls::FunctionCall p_oFunctionCall);
static string GenerateFunctionCall_x86(FunctionCalls::FunctionCall p_oFunctionCall);
static string GenerateFunctionCall_x64(FunctionCalls::FunctionCall p_oFunctionCall);
static string GenerateLinuxSyscall_x86(FunctionCalls::FunctionCall p_oFunctionCall);
static string GenerateLinuxSyscall_x64(FunctionCalls::FunctionCall p_oFunctionCall);
// Add function call name
static void AddFunctionCallName(string p_sFunctionName);
// Add function call int parameter
static void AddFunctionCallIntParameter(string p_sIntParameter);
// Add function call string parameter
static void AddFunctionCallStringParameter(string p_sStringParameter);
// Check if a function exists
static bool FunctionExists(string p_sFunctionName);
};
#endif