-
Notifications
You must be signed in to change notification settings - Fork 36
/
SYS.cpp
49 lines (38 loc) · 1.9 KB
/
SYS.cpp
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
#include <Python.h>
#include "pin.H"
PyObject* Python_PIN_GetSyscallArgument(PyObject* self, PyObject* args) {
PyObject* context;
PyObject* std;
PyObject* number;
PyArg_ParseTuple(args, "O|O|O", &context, &std, &number);
return Py_BuildValue("k", PIN_GetSyscallArgument((CONTEXT*) *(CONTEXT**)PyInt_AsLong(context), (SYSCALL_STANDARD) *(SYSCALL_STANDARD*)PyInt_AsLong(std), (int) PyInt_AsLong(number)));
}
PyObject* Python_PIN_GetSyscallReturn(PyObject* self, PyObject* args) {
PyObject* context;
PyObject* std;
PyArg_ParseTuple(args, "O|O", &context, &std);
return Py_BuildValue("k", PIN_GetSyscallReturn((CONTEXT*) *(CONTEXT**)PyInt_AsLong(context), (SYSCALL_STANDARD) *(SYSCALL_STANDARD*)PyInt_AsLong(std)));
}
PyObject* Python_PIN_GetSyscallNumber(PyObject* self, PyObject* args) {
PyObject* context;
PyObject* std;
PyArg_ParseTuple(args, "O|O", &context, &std);
return Py_BuildValue("k", PIN_GetSyscallNumber((CONTEXT*) *(CONTEXT**)PyInt_AsLong(context), (SYSCALL_STANDARD) *(SYSCALL_STANDARD*)PyInt_AsLong(std)));
}
PyObject* Python_PIN_SetSyscallArgument(PyObject* self, PyObject* args) {
PyObject* context;
PyObject* std;
PyObject* number;
PyObject* value;
PyArg_ParseTuple(args, "O|O|O|O", &context, &std, &number, &value);
PIN_SetSyscallArgument((CONTEXT*) *(CONTEXT**)PyInt_AsLong(context), (SYSCALL_STANDARD) *(SYSCALL_STANDARD*)PyInt_AsLong(std), (int) PyInt_AsLong(number), (ADDRINT) PyInt_AsLong(value));
return Py_BuildValue("O", Py_None);
}
PyObject* Python_PIN_SetSyscallNumber(PyObject* self, PyObject* args) {
PyObject* context;
PyObject* std;
PyObject* value;
PyArg_ParseTuple(args, "O|O|O", &context, &std, &value);
PIN_SetSyscallNumber((CONTEXT*) *(CONTEXT**)PyInt_AsLong(context), (SYSCALL_STANDARD) *(SYSCALL_STANDARD*)PyInt_AsLong(std), (ADDRINT) PyInt_AsLong(value));
return Py_BuildValue("O", Py_None);
}