Skip to content

Commit 2538742

Browse files
committed
.
1 parent e65477d commit 2538742

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

yara-python.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2083,6 +2083,30 @@ static PyObject* yara_load(
20832083
}
20842084

20852085

2086+
static PyObject* yara_process_memory_iterator(
2087+
PyObject* self,
2088+
PyObject* args,
2089+
PyObject* keywords)
2090+
{
2091+
static char *kwlist[] = {
2092+
"pid", NULL};
2093+
2094+
unsigned int pid = UINT_MAX;
2095+
2096+
if (!PyArg_ParseTupleAndKeywords(
2097+
args,
2098+
keywords,
2099+
"|I",
2100+
kwlist,
2101+
&pid))
2102+
{
2103+
return PyErr_Format(
2104+
PyExc_TypeError,
2105+
"Error parsing arguments.");
2106+
}
2107+
return Py_BuildValue("I", pid);
2108+
}
2109+
20862110
void finalize(void)
20872111
{
20882112
yr_finalize();
@@ -2102,6 +2126,13 @@ static PyMethodDef yara_methods[] = {
21022126
METH_VARARGS | METH_KEYWORDS,
21032127
"Loads a previously saved YARA rules file and returns an instance of class Rules"
21042128
},
2129+
{
2130+
"process_memory_iterator",
2131+
(PyCFunction) yara_process_memory_iterator,
2132+
METH_VARARGS | METH_KEYWORDS,
2133+
"Returns an iterator over blocks of memory of a process.\n"
2134+
"Signature: process_memory_iterator(pid=None)"
2135+
},
21052136
{ NULL, NULL }
21062137
};
21072138

0 commit comments

Comments
 (0)