Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
grrrrrrrrr committed Oct 2, 2017
1 parent e65477d commit 2538742
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions yara-python.c
Original file line number Diff line number Diff line change
Expand Up @@ -2083,6 +2083,30 @@ static PyObject* yara_load(
}


static PyObject* yara_process_memory_iterator(
PyObject* self,
PyObject* args,
PyObject* keywords)
{
static char *kwlist[] = {
"pid", NULL};

unsigned int pid = UINT_MAX;

if (!PyArg_ParseTupleAndKeywords(
args,
keywords,
"|I",
kwlist,
&pid))
{
return PyErr_Format(
PyExc_TypeError,
"Error parsing arguments.");
}
return Py_BuildValue("I", pid);
}

void finalize(void)
{
yr_finalize();
Expand All @@ -2102,6 +2126,13 @@ static PyMethodDef yara_methods[] = {
METH_VARARGS | METH_KEYWORDS,
"Loads a previously saved YARA rules file and returns an instance of class Rules"
},
{
"process_memory_iterator",
(PyCFunction) yara_process_memory_iterator,
METH_VARARGS | METH_KEYWORDS,
"Returns an iterator over blocks of memory of a process.\n"
"Signature: process_memory_iterator(pid=None)"
},
{ NULL, NULL }
};

Expand Down

0 comments on commit 2538742

Please sign in to comment.