diff options
Diffstat (limited to 'plugins/pychrysa/pychrysa.c')
-rw-r--r-- | plugins/pychrysa/pychrysa.c | 207 |
1 files changed, 9 insertions, 198 deletions
diff --git a/plugins/pychrysa/pychrysa.c b/plugins/pychrysa/pychrysa.c index a985294..ebe79d8 100644 --- a/plugins/pychrysa/pychrysa.c +++ b/plugins/pychrysa/pychrysa.c @@ -24,203 +24,7 @@ #include "pychrysa.h" - - -#if 0 - -#include <dirent.h> -#include <pygobject.h> -#include <string.h> -//#include <pygtk/pygtk.h> - - -#include <config.h> - - -#include "quirks.h" -#include "analysis/module.h" -#include "arch/module.h" -#include "debug/module.h" -#include "format/module.h" -#include "glibext/module.h" -#include "gtkext/module.h" -#include "gui/module.h" - -/* -#include "analysis/py_binary.h" -#include "analysis/py_line.h" -#include "analysis/py_line_code.h" -#include "analysis/roptions.h" -*/ -#include "../../src/common/environment.h" -#include "../../src/common/extstr.h" -#include "../../src/plugins/plugin-int.h" - - - - - -/****************************************************************************** -* * -* Paramètres : plugin = instance représentant le greffon en chargement. * -* ref = espace de référencement global. * -* * -* Description : Initialise le greffon permettant l'usage de Python. * -* * -* Retour : true. * -* * -* Remarques : - * -* * -******************************************************************************/ - -bool init_plugin(GPluginModule *plugin, GObject *ref) -{ - char *paths; /* Emplacements de greffons */ - char *path; /* Chemin à fouiller */ - char *save; /* Sauvegarde pour ré-entrance */ - DIR *dir; /* Répertoire à parcourir */ - struct dirent entry; /* Elément trouvé */ - struct dirent *next; /* Prochain élément fourni */ - int ret; /* Bilan d'un appel système */ - char *filename; /* Chemin d'accès reconstruit */ - - - - - GPluginModule *pyplugin; - - - - /* Définition des zones d'influence */ - - add_to_env_var("PYTHONPATH", PLUGINS_DIR G_DIR_SEPARATOR_S "python", ";"); - - paths = get_env_var("PYTHONPATH"); - - /* Intialisations Python */ - - - //return false; - - define_internal_ref(ref); - - Py_Initialize(); - - //pychrysalide_set_gc_threshold(INT_MAX, INT_MAX, INT_MAX); - //pychrysalide_set_gc_threshold(1, 1, 1); - - initpychrysa(); - - - - /* Chargement des greffons */ - - save = NULL; /* gcc... */ - - for (path = strtok_r(paths, ";", &save); - path != NULL; - path = strtok_r(NULL, ";", &save)) - { - dir = opendir(path); - if (dir == NULL) - { - perror("opendir"); - continue; - } - - for (ret = readdir_r(dir, &entry, &next); - ret == 0 && next != NULL; - ret = readdir_r(dir, &entry, &next)) - { - if (entry.d_name[0] == '.') continue; - //if (strcmp(entry.d_name, "test") != 0) continue; - - printf("NAME :: '%s'\n", entry.d_name); - if (strcmp(entry.d_name, "apkfiles") != 0) continue; - - filename = strdup(entry.d_name); - filename = stradd(filename, "."); - filename = stradd(filename, "__init__"); - - pyplugin = g_python_plugin_new(entry.d_name, filename); - - if (pyplugin == NULL) - g_plugin_module_log_variadic_message(plugin, LMT_ERROR, - _("No suitable Python plugin found in '%s'"), - filename); - else - { - g_plugin_module_log_variadic_message(plugin, LMT_PROCESS, - _("Loaded Python plugin '<b>%s</b>' from the '<b>%s</b>' directory"), - g_plugin_module_get_name(G_PLUGIN_MODULE(pyplugin)), path); - add_plugin_to_main_list(pyplugin); - } - - free(filename); - - } - - closedir(dir); - - } - - return true; - -} - - - - - - - -#endif - - - - - - -#include <locale.h> #include <pygobject.h> - - - - - -#include <core/core.h> - - - -#include "analysis/module.h" -#include "arch/module.h" -#include "common/module.h" -#include "core/module.h" -#include "format/module.h" -#include "glibext/module.h" -#include "gtkext/module.h" -#include "gui/module.h" - - - -// TODO : à bouger ? -#include "../../src/arch/processor.h" -#include "../../src/format/format.h" - - - - - - - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////://///////////////////////// -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////://///////////////////////// -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////://///////////////////////// -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////://///////////////////////// -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////://///////////////////////// - - #include <stdio.h> #include <stdbool.h> #include <string.h> @@ -231,14 +35,21 @@ bool init_plugin(GPluginModule *plugin, GObject *ref) #include <common/cpp.h> #include <common/environment.h> #include <common/extstr.h> +#include <core/core.h> #include <plugins/plugin-def.h> #include <plugins/plugin-int.h> #include "plugin.h" #include "quirks.h" - - +#include "analysis/module.h" +#include "arch/module.h" +#include "common/module.h" +#include "core/module.h" +#include "format/module.h" +#include "glibext/module.h" +#include "gtkext/module.h" +#include "gui/module.h" |