summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/plugin.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysa/plugin.c')
-rw-r--r--plugins/pychrysa/plugin.c69
1 files changed, 7 insertions, 62 deletions
diff --git a/plugins/pychrysa/plugin.c b/plugins/pychrysa/plugin.c
index 1bda007..c562044 100644
--- a/plugins/pychrysa/plugin.c
+++ b/plugins/pychrysa/plugin.c
@@ -132,7 +132,7 @@ static PyObject *pychrysa_plugin_handle_debugger(PyObject *, PyObject *);
-
+#if 0
@@ -155,19 +155,7 @@ main2(const char *filename, const char *method)
if (pFunc && PyCallable_Check(pFunc)) {
pArgs = PyTuple_New(0/*argc - 3*/);
-#if 0
- for (i = 0; i < argc - 3; ++i) {
- pValue = PyLong_FromLong(atoi(argv[i + 3]));
- if (!pValue) {
- Py_DECREF(pArgs);
- Py_DECREF(pModule);
- fprintf(stderr, "Cannot convert argument\n");
- return 1;
- }
- /* pValue reference stolen here: */
- PyTuple_SetItem(pArgs, i, pValue);
- }
-#endif
+
pValue = PyObject_CallObject(pFunc, pArgs);
Py_DECREF(pArgs);
if (pValue != NULL) {
@@ -199,7 +187,7 @@ main2(const char *filename, const char *method)
}
-
+#endif
@@ -540,7 +528,7 @@ static bool g_python_plugin_execute_on_binary(GPythonPlugin *plugin, GLoadedBina
args = PyTuple_New(2);
- PyTuple_SetItem(args, 0, py_loaded_binary_from_c(binary));
+ PyTuple_SetItem(args, 0, pygobject_new(G_OBJECT(binary)));
PyTuple_SetItem(args, 1, PyInt_FromLong(action));
value = run_python_method(plugin->instance, "execute_on_binary", args);
@@ -752,7 +740,9 @@ static PyObject *pychrysa_plugin_is_matching(PyObject *self, PyObject *args)
result = PyTuple_New(3);
PyTuple_SetItem(result, 0, PyInt_FromLong(MFA_NONE));
+ Py_DECREF(Py_None);
PyTuple_SetItem(result, 1, Py_None);
+ Py_DECREF(Py_None);
PyTuple_SetItem(result, 2, Py_None);
return result;
@@ -797,52 +787,12 @@ static PyObject *pychrysa_plugin_handle_debugger(PyObject *self, PyObject *args)
static PyObject *pychrysa_plugin_run(PyObject *self, PyObject *args)
{
- return Py_None;
-
-}
-
-
-
-
-
-#include <pygtk-2.0/pygobject.h>
-
-static int convert_to_w(PyGObject *obj, void **out)
-{
-
- //if (!pygobject_check(obj,
-
- *out = pygobject_get(obj);
-
- return (1);
+ Py_RETURN_NONE;
}
-static PyObject *add_wgt(PyObject *self, PyObject *args)
-{
- GtkWidget *result;
- GtkWidget *button;
-
- result = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_widget_set_size_request(result, 400, 300);
- gtk_window_set_position(GTK_WINDOW(result), GTK_WIN_POS_CENTER);
- gtk_container_set_border_width(GTK_CONTAINER(result), 4);
- gtk_window_set_title(GTK_WINDOW(result), _("ChrysalideWWW"));
-
- gtk_widget_show (result);
-
-
- if (!PyArg_ParseTuple(args, "O&", convert_to_w, &button))
- return Py_None;
-
- gtk_container_add(GTK_CONTAINER(result), button);
-
-
- return Py_None;
-
-}
@@ -893,11 +843,6 @@ static PyMethodDef pychrysa_plugin_methods[] = {
METH_VARARGS,
"Run the plugin for a specific action."
},
- {
- "add_wgt", (PyCFunction)add_wgt,
- METH_VARARGS,
- "Run the plugin for a specific action."
- },
NULL
};