summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-02-01 18:12:31 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-02-01 18:12:31 (GMT)
commit113f37b954e395beb2a335e5e364746c70af625d (patch)
treed58b2839f1dd95096f72221c07c4b2a508eca6e9 /plugins/pychrysalide
parent9d4a0ba0e5a217bf4ac63c21e14d5f44580b6138 (diff)
Inserted an option to render disassembly even in batch mode.
Diffstat (limited to 'plugins/pychrysalide')
-rw-r--r--plugins/pychrysalide/analysis/loaded.c30
-rw-r--r--plugins/pychrysalide/analysis/project.c19
2 files changed, 34 insertions, 15 deletions
diff --git a/plugins/pychrysalide/analysis/loaded.c b/plugins/pychrysalide/analysis/loaded.c
index 9c30261..37d11b4 100644
--- a/plugins/pychrysalide/analysis/loaded.c
+++ b/plugins/pychrysalide/analysis/loaded.c
@@ -61,7 +61,7 @@ static PyObject *py_loaded_content_get_content(PyObject *, void *);
/******************************************************************************
* *
* Paramètres : self = contenu binaire à manipuler. *
-* args = non utilisé ici. *
+* args = arguments fournis à l'appel. *
* *
* Description : Lance l'analyse propre à l'élément chargé. *
* *
@@ -73,11 +73,18 @@ static PyObject *py_loaded_content_get_content(PyObject *, void *);
static PyObject *py_loaded_content_analyze(PyObject *self, PyObject *args)
{
+ int cache; /* Préparation de rendu ? */
+ int ret; /* Bilan de lecture des args. */
GLoadedContent *content; /* Version GLib de l'élément */
+ cache = 0;
+
+ ret = PyArg_ParseTuple(args, "|p", &cache);
+ if (!ret) return NULL;
+
content = G_LOADED_CONTENT(pygobject_get(self));
- g_loaded_content_analyze(content);
+ g_loaded_content_analyze(content, cache);
Py_RETURN_NONE;
@@ -87,7 +94,7 @@ static PyObject *py_loaded_content_analyze(PyObject *self, PyObject *args)
/******************************************************************************
* *
* Paramètres : self = contenu binaire à manipuler. *
-* args = non utilisé ici. *
+* args = arguments fournis à l'appel. *
* *
* Description : Lance l'analyse de l'élément chargé et attend sa conclusion. *
* *
@@ -100,15 +107,22 @@ static PyObject *py_loaded_content_analyze(PyObject *self, PyObject *args)
static PyObject *py_loaded_content_analyze_and_wait(PyObject *self, PyObject *args)
{
PyObject *result; /* Bilan à retourner */
+ int cache; /* Préparation de rendu ? */
+ int ret; /* Bilan de lecture des args. */
PyThreadState *_save; /* Sauvegarde de contexte */
GLoadedContent *content; /* Version GLib de l'élément */
bool status; /* Bilan de l'opération */
+ cache = 0;
+
+ ret = PyArg_ParseTuple(args, "|p", &cache);
+ if (!ret) return NULL;
+
content = G_LOADED_CONTENT(pygobject_get(self));
Py_UNBLOCK_THREADS;
- status = g_loaded_content_analyze_and_wait(content);
+ status = g_loaded_content_analyze_and_wait(content, cache);
Py_BLOCK_THREADS;
@@ -245,14 +259,14 @@ PyTypeObject *get_python_loaded_content_type(void)
static PyMethodDef py_loaded_content_methods[] = {
{
"analyze", py_loaded_content_analyze,
- METH_NOARGS,
- "analyze($self, /)\n--\n\nStart the analysis of the loaded binary and " \
+ METH_VARARGS,
+ "analyze($self, cache, /)\n--\n\nStart the analysis of the loaded binary and " \
"send an \"analyzed\" signal when done."
},
{
"analyze_and_wait", py_loaded_content_analyze_and_wait,
- METH_NOARGS,
- "analyze_and_wait($self, /)\n--\n\nRun the analysis of the loaded binary and " \
+ METH_VARARGS,
+ "analyze_and_wait($self, cache, /)\n--\n\nRun the analysis of the loaded binary and " \
"wait for its completion."
},
{
diff --git a/plugins/pychrysalide/analysis/project.c b/plugins/pychrysalide/analysis/project.c
index 137efbf..9046bf3 100644
--- a/plugins/pychrysalide/analysis/project.c
+++ b/plugins/pychrysalide/analysis/project.c
@@ -77,16 +77,18 @@ static PyObject *py_study_project_new(PyTypeObject *type, PyObject *args, PyObje
{
PyObject *result; /* Instance à retourner */
const char *filename; /* Destination de la sauvegarde*/
+ int cache; /* Préparation de rendu ? */
int ret; /* Bilan de lecture des args. */
GStudyProject *project; /* Version GLib du projet */
filename = NULL;
+ cache = 0;
- ret = PyArg_ParseTuple(args, "|s", &filename);
+ ret = PyArg_ParseTuple(args, "|sp", &filename, &cache);
if (!ret) return NULL;
if (filename != NULL)
- project = g_study_project_open(filename);
+ project = g_study_project_open(filename, cache);
else
project = g_study_project_new();
@@ -202,15 +204,18 @@ static bool filter_loadable_content_with_python(GLoadedContent *content, PyObjec
static PyObject *py_study_project_discover_binary_content(PyObject *self, PyObject *args)
{
- PyObject *callable; /* Filtre de contenus éventuel */
GBinContent *content; /* Instance de contenu binaire */
+ int cache; /* Préparation de rendu ? */
+ PyObject *callable; /* Filtre de contenus éventuel */
int ret; /* Bilan de lecture des args. */
GStudyProject *project; /* Version GLib du format */
+ cache = 0;
callable = NULL;
- ret = PyArg_ParseTuple(args, "O&|O&",
+ ret = PyArg_ParseTuple(args, "O&|pO&",
convert_to_binary_content, &content,
+ &cache,
convert_to_callable, &callable);
if (!ret) return NULL;
@@ -220,14 +225,14 @@ static PyObject *py_study_project_discover_binary_content(PyObject *self, PyObje
{
Py_INCREF(callable);
- g_study_project_discover_binary_content(project, content,
+ g_study_project_discover_binary_content(project, content, cache,
(filter_loadable_cb)filter_loadable_content_with_python,
callable);
}
else
- g_study_project_discover_binary_content(project, content, NULL, NULL);
+ g_study_project_discover_binary_content(project, content, cache, NULL, NULL);
Py_RETURN_NONE;
@@ -331,7 +336,7 @@ PyTypeObject *get_python_study_project_type(void)
{
"discover", py_study_project_discover_binary_content,
METH_VARARGS,
- "discover($self, content, /)\n--\n\nExplore a new binary content for the project."
+ "discover($self, content, cache, filter/)\n--\n\nExplore a new binary content for the project."
},
{
"attach", py_study_project_attach_content,