summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis/binary.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-09-08 17:41:58 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-09-08 17:41:58 (GMT)
commit1430874c1ce9d5e38a23bf27049ebc5f6a6619bb (patch)
tree5b57937b6b5a98244b8d63f969d2350eb00739ec /plugins/pychrysalide/analysis/binary.c
parent8002f34e4060e25cb3acee76a0c2ae2970f9e9dc (diff)
Provided a way to save the database updates from Python.
Diffstat (limited to 'plugins/pychrysalide/analysis/binary.c')
-rw-r--r--plugins/pychrysalide/analysis/binary.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/plugins/pychrysalide/analysis/binary.c b/plugins/pychrysalide/analysis/binary.c
index 98b20dc..9d57952 100644
--- a/plugins/pychrysalide/analysis/binary.c
+++ b/plugins/pychrysalide/analysis/binary.c
@@ -45,6 +45,9 @@
/* Crée un nouvel objet Python de type 'LoadedBinary'. */
static PyObject *py_loaded_binary_new(PyTypeObject *, PyObject *, PyObject *);
+/* Fournit un client assurant la liaison avec un serveur. */
+static PyObject *py_loaded_binary_get_client(PyObject *, PyObject *);
+
/* Demande l'intégration d'une modification dans une collection. */
static PyObject *py_loaded_binary_add_to_collection(PyObject *, PyObject *);
@@ -103,6 +106,58 @@ static PyObject *py_loaded_binary_new(PyTypeObject *type, PyObject *args, PyObje
* Paramètres : self = objet représentant un binaire chargé. *
* args = arguments fournis pour l'opération. *
* *
+* Description : Fournit un client assurant la liaison avec un serveur. *
+* *
+* Retour : Client connecté ou None. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_loaded_binary_get_client(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Bilan à retourner */
+ bool internal; /* Nature du client visé */
+ int ret; /* Bilan de lecture des args. */
+ GLoadedBinary *binary; /* Binaire en cours d'analyse */
+ GHubClient *client; /* Eventuel client en place */
+
+#define LOADED_BINARY_GET_CLIENT_METHOD PYTHON_METHOD_DEF \
+( \
+ get_client, "$self, /, internal=True", \
+ METH_VARARGS, py_loaded_binary, \
+ "Provide the client connected to an internal or remote server" \
+ " if defined, or return None otherwise.\n" \
+)
+
+ ret = PyArg_ParseTuple(args, "|p", &internal);
+ if (!ret) return NULL;
+
+ binary = G_LOADED_BINARY(pygobject_get(self));
+
+ client = g_loaded_binary_get_client(binary, internal);
+
+ if (client != NULL)
+ {
+ result = pygobject_new(G_OBJECT(client));
+ g_object_unref(G_OBJECT(client));
+ }
+ else
+ {
+ result = Py_None;
+ Py_INCREF(result);
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = objet représentant un binaire chargé. *
+* args = arguments fournis pour l'opération. *
+* *
* Description : Demande l'intégration d'une modification dans une collection.*
* *
* Retour : Bilan partiel de l'opération demandée. *
@@ -303,6 +358,7 @@ static PyObject *py_loaded_binary_get_disassembled_cache(PyObject *self, void *c
PyTypeObject *get_python_loaded_binary_type(void)
{
static PyMethodDef py_loaded_binary_methods[] = {
+ LOADED_BINARY_GET_CLIENT_METHOD,
LOADED_BINARY_ADD_TO_COLLECTION_METHOD,
{ NULL }
};