summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-07-23 17:38:17 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-07-23 17:38:17 (GMT)
commit50eb8c462e7ad2b4e5b82d27b1af6e86091ea272 (patch)
tree0b9fd98ab67eb317925c7a6bc800794f7b41633d
parent040904901f919932738cd50878ca2d4ca8ba43f9 (diff)
Created a hook to act when loaded content analysis is over.
-rw-r--r--plugins/pychrysalide/plugin.c2
-rw-r--r--src/analysis/loaded.c4
-rw-r--r--src/plugins/pglist.h3
-rw-r--r--src/plugins/plugin-def.h3
-rw-r--r--src/plugins/plugin-int.h17
-rw-r--r--src/plugins/plugin.c30
-rw-r--r--src/plugins/plugin.h3
7 files changed, 55 insertions, 7 deletions
diff --git a/plugins/pychrysalide/plugin.c b/plugins/pychrysalide/plugin.c
index 57891a6..b57794c 100644
--- a/plugins/pychrysalide/plugin.c
+++ b/plugins/pychrysalide/plugin.c
@@ -345,7 +345,7 @@ GPluginModule *g_python_plugin_new(const char *modname, const char *filename)
case PGA_CONTENT_EXPLORER:
case PGA_CONTENT_RESOLVER:
if (!register_python_binding(instance, handle_content, \
- (pg_handle_content)g_python_plugin_handle_binary_content))
+ (pg_handle_content_fc)g_python_plugin_handle_binary_content))
goto gppn_bad_plugin;
break;
diff --git a/src/analysis/loaded.c b/src/analysis/loaded.c
index 203868d..a035e5e 100644
--- a/src/analysis/loaded.c
+++ b/src/analysis/loaded.c
@@ -32,6 +32,7 @@
#include "../core/queue.h"
#include "../glibext/chrysamarshal.h"
#include "../glibext/gloadedpanel.h"
+#include "../plugins/pglist.h"
@@ -665,6 +666,9 @@ static void g_loaded_analysis_process(GLoadedAnalysis *analysis, GtkStatusStack
analysis->success = iface->analyze(analysis->content, gid, status);
+ if (analysis->success)
+ handle_loaded_content(PGA_CONTENT_ANALYZED, analysis->content, gid, status);
+
g_work_queue_delete_work_group(queue, gid);
}
diff --git a/src/plugins/pglist.h b/src/plugins/pglist.h
index 20f0031..c602839 100644
--- a/src/plugins/pglist.h
+++ b/src/plugins/pglist.h
@@ -93,6 +93,9 @@ GPluginModule **get_all_plugins_for_action(PluginAction, size_t *);
#define handle_binary_content(a, c, i, s) \
process_all_plugins_for(a, g_plugin_module_handle_binary_content, c, i, s)
+#define handle_loaded_content(a, c, i, s) \
+ process_all_plugins_for(a, g_plugin_module_handle_loaded_content, c, i, s)
+
/* DPS_FORMAT */
#define handle_binary_format(a, f, s) \
diff --git a/src/plugins/plugin-def.h b/src/plugins/plugin-def.h
index c32c9e3..a497517 100644
--- a/src/plugins/plugin-def.h
+++ b/src/plugins/plugin-def.h
@@ -121,6 +121,9 @@ typedef enum _PluginAction
/* Conversion de contenus binaires en contenus chargés */
PGA_CONTENT_RESOLVER = DPC_BINARY_PROCESSING | DPS_CONTENT | DEFINE_PLUGIN_ACTION(1),
+ /* Intervention en toute fin d'analyse de contenu chargé */
+ PGA_CONTENT_ANALYZED = DPC_BINARY_PROCESSING | DPS_CONTENT | DEFINE_PLUGIN_ACTION(2),
+
/**
* DPC_BINARY_PROCESSING | DPS_FORMAT
*/
diff --git a/src/plugins/plugin-int.h b/src/plugins/plugin-int.h
index 03040d1..04b87bb 100644
--- a/src/plugins/plugin-int.h
+++ b/src/plugins/plugin-int.h
@@ -32,6 +32,7 @@
#include "plugin.h"
#include "plugin-def.h"
#include "../analysis/content.h"
+#include "../analysis/loaded.h"
#include "../common/bits.h"
#include "../core/logs.h"
@@ -47,13 +48,16 @@ typedef void (* pg_process_disassembly_fc) (const GPluginModule *, PluginAction,
/* Procède à une opération liée à un contenu binaire. */
-typedef void (* pg_handle_content) (const GPluginModule *, PluginAction, GBinContent *, wgroup_id_t, GtkStatusStack *);
+typedef void (* pg_handle_content_fc) (const GPluginModule *, PluginAction, GBinContent *, wgroup_id_t, GtkStatusStack *);
+
+/* Procède à une opération liée à un contenu chargé. */
+typedef void (* pg_handle_loaded_fc) (const GPluginModule *, PluginAction, GLoadedContent *, wgroup_id_t, GtkStatusStack *);
/* Procède à une opération liée au format de fichier uniquement. */
-typedef bool (* pg_handle_format) (const GPluginModule *, PluginAction, GBinFormat *, GtkStatusStack *);
+typedef bool (* pg_handle_format_fc) (const GPluginModule *, PluginAction, GBinFormat *, GtkStatusStack *);
/* Procède à un préchargement de format de fichier. */
-typedef bool (* pg_preload_format) (const GPluginModule *, PluginAction, GBinFormat *, GPreloadInfo *, GtkStatusStack *);
+typedef bool (* pg_preload_format_fc) (const GPluginModule *, PluginAction, GBinFormat *, GPreloadInfo *, GtkStatusStack *);
@@ -115,9 +119,10 @@ struct _GPluginModule
//execute_on_debugger_fc handle_debugger; /* Action liée à un débogueur */
- pg_handle_content handle_content; /* Explorations ou résolutions */
- pg_handle_format handle_format; /* Manipulation du format */
- pg_preload_format preload_format; /* Préchargement d'un format */
+ pg_handle_content_fc handle_content; /* Explorations ou résolutions */
+ pg_handle_loaded_fc handle_loaded; /* Traitement de contenu chargé*/
+ pg_handle_format_fc handle_format; /* Manipulation du format */
+ pg_preload_format_fc preload_format; /* Préchargement d'un format */
};
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index d1e90c8..58671b6 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -272,6 +272,13 @@ GPluginModule *g_plugin_module_new(const gchar *filename)
goto bad_plugin;
break;
+ case PGA_CONTENT_ANALYZED:
+ if (!load_plugin_symbol(result->module,
+ "chrysalide_plugin_handle_loaded_content",
+ &result->handle_loaded))
+ goto bad_plugin;
+ break;
+
default:
log_variadic_message(LMT_WARNING,
_("Unknown action '0x%02x' in plugin '%s'..."),
@@ -707,6 +714,29 @@ void g_plugin_module_handle_binary_content(const GPluginModule *plugin, PluginAc
/******************************************************************************
* *
+* Paramètres : plugin = greffon à manipuler. *
+* action = type d'action attendue. *
+* content = contenu chargé à traiter. *
+* wid = identifiant du groupe de traitement. *
+* status = barre de statut à tenir informée. *
+* *
+* Description : Procède à une opération liée à un contenu chargé. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_plugin_module_handle_loaded_content(const GPluginModule *plugin, PluginAction action, GLoadedContent *content, wgroup_id_t wid, GtkStatusStack *status)
+{
+ return plugin->handle_loaded(plugin, action, content, wid, status);
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : plugin = greffon à manipuler. *
* action = type d'action attendue. *
* format = format de binaire à manipuler pendant l'opération. *
diff --git a/src/plugins/plugin.h b/src/plugins/plugin.h
index 17a9f33..d0aeb28 100644
--- a/src/plugins/plugin.h
+++ b/src/plugins/plugin.h
@@ -94,6 +94,9 @@ bool g_plugin_module_load(GPluginModule *, GPluginModule **, size_t);
/* Procède à une opération liée à un contenu binaire. */
void g_plugin_module_handle_binary_content(const GPluginModule *, PluginAction, GBinContent *, wgroup_id_t, GtkStatusStack *);
+/* Procède à une opération liée à un contenu chargé. */
+void g_plugin_module_handle_loaded_content(const GPluginModule *, PluginAction, GLoadedContent *, wgroup_id_t, GtkStatusStack *);
+
/* Procède à une opération liée au format de fichier uniquement. */
bool g_plugin_module_handle_binary_format(const GPluginModule *, PluginAction, GBinFormat *, GtkStatusStack *);