summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis/loading.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/analysis/loading.c')
-rw-r--r--plugins/pychrysalide/analysis/loading.c97
1 files changed, 97 insertions, 0 deletions
diff --git a/plugins/pychrysalide/analysis/loading.c b/plugins/pychrysalide/analysis/loading.c
index 77ff7fa..44930cd 100644
--- a/plugins/pychrysalide/analysis/loading.c
+++ b/plugins/pychrysalide/analysis/loading.c
@@ -31,6 +31,8 @@
#include <analysis/loading.h>
+#include "content.h"
+#include "loaded.h"
#include "../access.h"
#include "../helpers.h"
@@ -39,10 +41,18 @@
/* --------------------- EXPLORATION NON BLOQUANTE DES CONTENUS --------------------- */
+/* Ajoute un nouveau contenu découvert au crédit d'un groupe. */
+static PyObject *py_content_explorer_populate_group(PyObject *, PyObject *);
+
+
/* ------------------- RESOLUTION DE CONTENUS BINAIRES EN CHARGES ------------------- */
+/* Intègre un contenu chargé dans les résultats. */
+static PyObject *py_content_resolver_add_detected(PyObject *, PyObject *);
+
+
/* ---------------------------------------------------------------------------------- */
/* EXPLORATION NON BLOQUANTE DES CONTENUS */
@@ -51,6 +61,44 @@
/******************************************************************************
* *
+* Paramètres : self = classe représentant un binaire. *
+* args = arguments fournis à l'appel. *
+* *
+* Description : Ajoute un nouveau contenu découvert au crédit d'un groupe. *
+* *
+* Retour : None. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_content_explorer_populate_group(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Valeur à retourner */
+ unsigned long long wid; /* Identifiant de groupe */
+ PyObject *content_obj; /* Nouveau contenu Python */
+ int ret; /* Bilan de lecture des args. */
+ GContentExplorer *explorer; /* Explorateur à manipuler */
+ GBinContent *content; /* Contenu nouveau au final */
+
+ ret = PyArg_ParseTuple(args, "KO!", &wid, get_python_binary_content_type(), &content_obj);
+ if (!ret) Py_RETURN_NONE;
+
+ explorer = G_CONTENT_EXPLORER(pygobject_get(self));
+ content = G_BIN_CONTENT(pygobject_get(content_obj));
+
+ g_content_explorer_populate_group(explorer, wid, content);
+
+ result = Py_None;
+ Py_INCREF(result);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : - *
* *
* Description : Fournit un accès à une définition de type à diffuser. *
@@ -64,6 +112,11 @@
PyTypeObject *get_python_content_explorer_type(void)
{
static PyMethodDef py_content_explorer_methods[] = {
+ {
+ "populate_group", py_content_explorer_populate_group,
+ METH_VARARGS,
+ "populate_group($self, wid, content, /)\n--\n\nPush a new binary content into the list to explore."
+ },
{ NULL }
};
@@ -135,6 +188,44 @@ bool ensure_python_content_explorer_is_registered(void)
/******************************************************************************
* *
+* Paramètres : self = classe représentant un binaire. *
+* args = arguments fournis à l'appel. *
+* *
+* Description : Intègre un contenu chargé dans les résultats. *
+* *
+* Retour : None. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_content_resolver_add_detected(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Valeur à retourner */
+ unsigned long long wid; /* Identifiant de groupe */
+ PyObject *loaded_obj; /* Contenu chargé en Python */
+ int ret; /* Bilan de lecture des args. */
+ GContentResolver *resolver; /* Résolveur à manipuler */
+ GLoadedContent *loaded; /* Contenu chargé au final */
+
+ ret = PyArg_ParseTuple(args, "KO!", &wid, get_python_loaded_content_type(), &loaded_obj);
+ if (!ret) Py_RETURN_NONE;
+
+ resolver = G_CONTENT_RESOLVER(pygobject_get(self));
+ loaded = G_LOADED_CONTENT(pygobject_get(loaded_obj));
+
+ g_content_resolver_add_detected(resolver, wid, loaded);
+
+ result = Py_None;
+ Py_INCREF(result);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : - *
* *
* Description : Fournit un accès à une définition de type à diffuser. *
@@ -148,6 +239,12 @@ bool ensure_python_content_explorer_is_registered(void)
PyTypeObject *get_python_content_resolver_type(void)
{
static PyMethodDef py_content_resolver_methods[] = {
+
+ {
+ "add_detected", py_content_resolver_add_detected,
+ METH_VARARGS,
+ "add_detected($self, wid, loaded, /)\n--\n\nAdd a binary content as loaded content ready to get analyzed."
+ },
{ NULL }
};