summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-08-06 21:34:51 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-08-06 21:34:51 (GMT)
commitb070fb755b9e32bfa80e8854606f431d285ca23e (patch)
tree4a5cf3b8e6516cf3b93ac1fc64c1d18008c0f3e2 /plugins
parentc4b5b5d4d88dc60caad7a10b22c38cc796fdec08 (diff)
Extended the API to allow obfuscators detections.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/pychrysalide/analysis/loaded.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/plugins/pychrysalide/analysis/loaded.c b/plugins/pychrysalide/analysis/loaded.c
index 0c94a88..9b280a2 100644
--- a/plugins/pychrysalide/analysis/loaded.c
+++ b/plugins/pychrysalide/analysis/loaded.c
@@ -26,6 +26,7 @@
#include <assert.h>
+#include <malloc.h>
#include <pygobject.h>
@@ -42,6 +43,9 @@ static PyObject *py_loaded_content_analyze(PyObject *, PyObject *);
/* Lance l'analyse de l'élément chargé et attend sa conclusion. */
static PyObject *py_loaded_content_analyze_and_wait(PyObject *, PyObject *);
+/* Etablit une liste d'obscurcissements présents. */
+static PyObject *py_loaded_content_detect_obfuscators(PyObject *, PyObject *);
+
/* Détermine le nombre de vues disponibles pour un contenu. */
static PyObject *py_loaded_content_count_views(PyObject *, PyObject *);
@@ -106,6 +110,52 @@ static PyObject *py_loaded_content_analyze_and_wait(PyObject *self, PyObject *ar
/******************************************************************************
* *
+* Paramètres : self = contenu binaire à manipuler. *
+* args = non utilisé ici. *
+* *
+* Description : Etablit une liste d'obscurcissements présents. *
+* *
+* Retour : Désignations humaines correspondantes. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_loaded_content_detect_obfuscators(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Bilan à retourner */
+ int version; /* Avec la version si possible */
+ int ret; /* Bilan de lecture des args. */
+ GLoadedContent *content; /* Version GLib de l'élément */
+ size_t count; /* Nombre de détections */
+ char **detections; /* Liste d'obscurcissements */
+ size_t i; /* Boucle de parcours */
+
+ ret = PyArg_ParseTuple(args, "p", &version);
+ if (!ret) Py_RETURN_NONE;
+
+ content = G_LOADED_CONTENT(pygobject_get(self));
+
+ detections = g_loaded_content_detect_obfuscators(content, version, &count);
+
+ result = PyTuple_New(count);
+
+ for (i = 0; i < count; i++)
+ {
+ PyTuple_SetItem(result, i, PyUnicode_FromString(detections[i]));
+ free(detections[i]);
+ }
+
+ if (detections != NULL)
+ free(detections);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : self = contenu chargé à manipuler. *
* args = non utilisé ici. *
* *
@@ -162,6 +212,11 @@ PyTypeObject *get_python_loaded_content_type(void)
"wait for its completion."
},
{
+ "detect_obfuscators", py_loaded_content_detect_obfuscators,
+ METH_VARARGS,
+ "detect_obfuscators($self, version, /)\n--\n\nList all detected obfuscators."
+ },
+ {
"count_views", py_loaded_content_count_views,
METH_NOARGS,
"count_views($self, /)\n--\n\nCompute the quantity of available views."