summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/plugin.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2012-08-03 13:03:26 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2012-08-03 13:03:26 (GMT)
commitb7c83221f2a60be8ee5d44a7599dbe6869af005f (patch)
tree814e294533920d18f8734baa9aaef47c676e520a /plugins/pychrysa/plugin.c
parent7d2b7ca95966c2d687526cd75a96d1ea67d3f503 (diff)
Loaded the permissions used by an APK file.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@255 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'plugins/pychrysa/plugin.c')
-rw-r--r--plugins/pychrysa/plugin.c43
1 files changed, 18 insertions, 25 deletions
diff --git a/plugins/pychrysa/plugin.c b/plugins/pychrysa/plugin.c
index b04dd09..9dc0c29 100644
--- a/plugins/pychrysa/plugin.c
+++ b/plugins/pychrysa/plugin.c
@@ -72,7 +72,7 @@ static PluginAction g_python_plugin_get_action(const GPythonPlugin *);
static MatchingFormatAction g_python_plugin_is_matching(const GPythonPlugin *, char **, bin_t **, off_t *);
/* Exécute une action définie sur un binaire chargé. */
-static bool g_python_plugin_execute(GPythonPlugin *, GOpenidaBinary *, PluginAction);
+static bool g_python_plugin_execute_on_binary(GPythonPlugin *, GOpenidaBinary *, PluginAction);
/* Exécute une action relative à un débogueur. */
@@ -247,7 +247,7 @@ static void g_python_plugin_init(GPythonPlugin *plugin)
plugin_parent = G_PLUGIN_MODULE(plugin);
- plugin_parent->exec_on_bin = (execute_action_on_binary_fc)g_python_plugin_execute;
+ plugin_parent->exec_on_bin = (execute_action_on_binary_fc)g_python_plugin_execute_on_binary;
plugin_parent->handle_debugger = (execute_on_debugger_fc)g_python_plugin_handle_debugger;
}
@@ -331,6 +331,9 @@ GPluginModule *g_python_plugin_new(const char *modname, const char *filename)
result = g_object_new(G_TYPE_PYTHON_PLUGIN, NULL);
+ G_PLUGIN_MODULE(result)->name = strdup(modname);
+ G_PLUGIN_MODULE(result)->name = stradd(G_PLUGIN_MODULE(result)->name, ".py");
+
G_PLUGIN_MODULE(result)->get_action = g_python_plugin_get_action;
G_PLUGIN_MODULE(result)->is_matching = g_python_plugin_is_matching;
@@ -494,38 +497,25 @@ static MatchingFormatAction g_python_plugin_is_matching(const GPythonPlugin *plu
* *
******************************************************************************/
-static bool g_python_plugin_execute(GPythonPlugin *plugin, GOpenidaBinary *binary, PluginAction action)
+static bool g_python_plugin_execute_on_binary(GPythonPlugin *plugin, GOpenidaBinary *binary, PluginAction action)
{
+ bool result; /* Bilan à remonter */
PyObject *args; /* Arguments pour l'appel */
- PyObject *arg; /* Un des arguments de l'appel */
- PyObject *value; /* Valeur obtenue */
-
-
-
- printf("I am running !!");
-
- args = PyTuple_New(1);
-
+ PyObject *value; /* Valeurs obtenues */
- arg = Py_BuildValue("O&", py_binary_new_from_existing, binary);
- PyTuple_SetItem(args, 0, arg);
+ args = PyTuple_New(2);
+ PyTuple_SetItem(args, 0, py_loaded_binary_from_c(binary));
+ PyTuple_SetItem(args, 1, PyInt_FromLong(action));
- value = run_python_method(plugin->module, "get_instance", args);
-
- if (value != NULL)
- {
- printf("Result of call: %ld\n", PyLong_AsLong(value));
- Py_DECREF(value);
- }
+ value = run_python_method(plugin->instance, "execute_on_binary", args);
+ result = (value == Py_True);
+ Py_XDECREF(value);
Py_DECREF(args);
-
-
-
-
+ return result;
}
@@ -638,6 +628,9 @@ static bool pychrysa_plugin_define_constants(PyObject *dict)
ret = PyDict_SetItemString(dict, "PGA_DISASSEMBLE", PyInt_FromLong(PGA_DISASSEMBLE));
if (ret == -1) return false;
+ ret = PyDict_SetItemString(dict, "PGA_DISASS_PROCESS", PyInt_FromLong(PGA_DISASS_PROCESS));
+ if (ret == -1) return false;
+
ret = PyDict_SetItemString(dict, "PGA_CODE_PROCESS", PyInt_FromLong(PGA_CODE_PROCESS));
if (ret == -1) return false;