summaryrefslogtreecommitdiff
path: root/plugins/lnxsyscalls
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/lnxsyscalls')
-rw-r--r--plugins/lnxsyscalls/core.c17
-rw-r--r--plugins/lnxsyscalls/core.h2
-rw-r--r--plugins/lnxsyscalls/db.c51
-rw-r--r--plugins/lnxsyscalls/db.h6
-rw-r--r--plugins/lnxsyscalls/hunter.c13
-rw-r--r--plugins/lnxsyscalls/hunter.h4
6 files changed, 41 insertions, 52 deletions
diff --git a/plugins/lnxsyscalls/core.c b/plugins/lnxsyscalls/core.c
index fffb72f..02e109d 100644
--- a/plugins/lnxsyscalls/core.c
+++ b/plugins/lnxsyscalls/core.c
@@ -29,6 +29,7 @@
#include <core/global.h>
#include <core/nproc.h>
+#include <plugins/self.h>
#include "db.h"
@@ -37,8 +38,9 @@
-DEFINE_CHRYSALIDE_PLUGIN("GLnxSyscallsPlugin", "Linux System Calls", "Describes each Linux system call with its arguments", \
- "0.1.0", EMPTY_PG_LIST(.required), AL(PGA_PLUGIN_INIT, PGA_DISASSEMBLY_ENDED));
+DEFINE_CHRYSALIDE_PLUGIN("LinuxSyscalls", "Describes each Linux system call with its arguments",
+ PACKAGE_VERSION, CHRYSALIDE_WEBSITE(""),
+ NO_REQ, AL(PGA_PLUGIN_INIT, PGA_DISASSEMBLY_ENDED));
@@ -59,11 +61,11 @@ G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin)
bool result; /* Bilan à retourner */
sqlite3 *db; /* Base de données présente */
- db = open_syscalls_database(plugin);
+ db = open_syscalls_database();
if (db != NULL)
{
- introduce_syscalls_database(db, plugin);
+ introduce_syscalls_database(db);
close_syscalls_database(db);
@@ -94,7 +96,7 @@ G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin)
* *
******************************************************************************/
-G_MODULE_EXPORT void process_binary_disassembly(const GPluginModule *plugin, PluginAction action, GLoadedBinary *binary, GtkStatusStack *status, GProcContext *context)
+G_MODULE_EXPORT void chrysalide_plugin_process_binary_disassembly(const GPluginModule *plugin, PluginAction action, GLoadedBinary *binary, GtkStatusStack *status, GProcContext *context)
{
GBinFormat *format; /* Format du binaire chargé */
const char *arch; /* Architecture d'exécution */
@@ -121,8 +123,7 @@ G_MODULE_EXPORT void process_binary_disassembly(const GPluginModule *plugin, Plu
else
{
- g_plugin_module_log_variadic_message(plugin, LMT_WARNING,
- _("No suitable backend to track syscalls!"));
+ log_plugin_simple_message(LMT_WARNING, _("No suitable backend to track syscalls!"));
goto pbd_exit;
}
@@ -147,7 +148,7 @@ G_MODULE_EXPORT void process_binary_disassembly(const GPluginModule *plugin, Plu
else
end = begin + run_size;
- hunter = g_gate_hunter_new(plugin, binary, context, begin, end, id, hops);
+ hunter = g_gate_hunter_new(binary, context, begin, end, id, hops);
g_work_queue_schedule_work(queue, G_DELAYED_WORK(hunter), gid);
diff --git a/plugins/lnxsyscalls/core.h b/plugins/lnxsyscalls/core.h
index a8e987e..dcf5c11 100644
--- a/plugins/lnxsyscalls/core.h
+++ b/plugins/lnxsyscalls/core.h
@@ -34,7 +34,7 @@
G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *);
/* Exécute une action pendant un désassemblage de binaire. */
-G_MODULE_EXPORT void process_binary_disassembly(const GPluginModule *, PluginAction , GLoadedBinary *, GtkStatusStack *, GProcContext *);
+G_MODULE_EXPORT void chrysalide_plugin_process_binary_disassembly(const GPluginModule *, PluginAction , GLoadedBinary *, GtkStatusStack *, GProcContext *);
diff --git a/plugins/lnxsyscalls/db.c b/plugins/lnxsyscalls/db.c
index 1c28981..33dd727 100644
--- a/plugins/lnxsyscalls/db.c
+++ b/plugins/lnxsyscalls/db.c
@@ -32,13 +32,13 @@
#include <core/paths.h>
-#include <plugins/plugin-int.h>
+#include <plugins/self.h>
/******************************************************************************
* *
-* Paramètres : plugin = greffon à manipuler. *
+* Paramètres : - *
* *
* Description : Ouvre la base de connaissances quant aux appels système. *
* *
@@ -48,7 +48,7 @@
* *
******************************************************************************/
-sqlite3 *open_syscalls_database(const GPluginModule *plugin)
+sqlite3 *open_syscalls_database(void)
{
sqlite3 *result; /* Base de données à renvoyer */
char *filename; /* Chemin vers la base */
@@ -58,7 +58,7 @@ sqlite3 *open_syscalls_database(const GPluginModule *plugin)
if (filename == NULL)
{
- g_plugin_module_log_simple_message(plugin, LMT_ERROR, _("Unable to find the syscalls database"));
+ log_plugin_simple_message(LMT_ERROR, _("Unable to find the syscalls database"));
result = NULL;
}
@@ -68,7 +68,7 @@ sqlite3 *open_syscalls_database(const GPluginModule *plugin)
if (ret != SQLITE_OK)
{
- g_plugin_module_log_simple_message(plugin, LMT_ERROR, _("Unable to load the syscalls database"));
+ log_plugin_simple_message(LMT_ERROR, _("Unable to load the syscalls database"));
result = NULL;
}
@@ -115,8 +115,7 @@ void close_syscalls_database(sqlite3 *db)
/******************************************************************************
* *
-* Paramètres : db = base de données SQLite à consulter. *
-* plugin = greffon à manipuler. *
+* Paramètres : db = base de données SQLite à consulter. *
* *
* Description : Présente le contenu de la base des appels système. *
* *
@@ -126,7 +125,7 @@ void close_syscalls_database(sqlite3 *db)
* *
******************************************************************************/
-void introduce_syscalls_database(sqlite3 *db, const GPluginModule *plugin)
+void introduce_syscalls_database(sqlite3 *db)
{
const char *sql; /* Requête SQL à construire */
sqlite3_stmt *stmt; /* Déclaration mise en place */
@@ -137,18 +136,16 @@ void introduce_syscalls_database(sqlite3 *db, const GPluginModule *plugin)
ret = sqlite3_prepare_v2(db, sql, -1, &stmt, NULL);
if (ret != SQLITE_OK)
{
- g_plugin_module_log_variadic_message(plugin, LMT_ERROR,
- _("Can't prepare statment '%s' (ret=%d): %s"),
- sql, ret, sqlite3_errmsg(db));
+ log_plugin_variadic_message(LMT_ERROR, _("Can't prepare statment '%s' (ret=%d): %s"),
+ sql, ret, sqlite3_errmsg(db));
goto isd_exit;
}
for (ret = sqlite3_step(stmt); ret == SQLITE_ROW; ret = sqlite3_step(stmt))
{
- g_plugin_module_log_variadic_message(plugin, LMT_INFO,
- _("The database contains %d syscalls for the '%s' architecture"),
- sqlite3_column_int(stmt, 1),
- (char *)sqlite3_column_text(stmt, 0));
+ log_plugin_variadic_message(LMT_INFO, _("The database contains %d syscalls for the '%s' architecture"),
+ sqlite3_column_int(stmt, 1),
+ (char *)sqlite3_column_text(stmt, 0));
}
sqlite3_finalize(stmt);
@@ -162,10 +159,9 @@ void introduce_syscalls_database(sqlite3 *db, const GPluginModule *plugin)
/******************************************************************************
* *
-* Paramètres : db = base de données SQLite à consulter. *
-* plugin = greffon à manipuler. *
-* arch = architecture visée par la procédure. *
-* : nr = indice de l'appel système à décrire. *
+* Paramètres : db = base de données SQLite à consulter. *
+* arch = architecture visée par la procédure. *
+* nr = indice de l'appel système à décrire. *
* *
* Description : Construit l'identité d'un appel système pour un indice donné.*
* *
@@ -175,7 +171,7 @@ void introduce_syscalls_database(sqlite3 *db, const GPluginModule *plugin)
* *
******************************************************************************/
-syscall_info_t *extract_from_syscalls_database(sqlite3 *db, const GPluginModule *plugin, const char *arch, unsigned int nr)
+syscall_info_t *extract_from_syscalls_database(sqlite3 *db, const char *arch, unsigned int nr)
{
syscall_info_t *result; /* Description à retourner */
const char *sql; /* Requête SQL à construire */
@@ -193,27 +189,24 @@ syscall_info_t *extract_from_syscalls_database(sqlite3 *db, const GPluginModule
ret = sqlite3_prepare_v2(db, sql, -1, &stmt, NULL);
if (ret != SQLITE_OK)
{
- g_plugin_module_log_variadic_message(plugin, LMT_ERROR,
- _("Can't prepare statment '%s' (ret=%d): %s"),
- sql, ret, sqlite3_errmsg(db));
+ log_plugin_variadic_message(LMT_ERROR, _("Can't prepare statment '%s' (ret=%d): %s"),
+ sql, ret, sqlite3_errmsg(db));
goto efsd_exit;
}
ret = sqlite3_bind_text(stmt, 1, arch, -1, NULL);
if (ret != SQLITE_OK)
{
- g_plugin_module_log_variadic_message(plugin, LMT_ERROR,
- _("Can't bind value for parameter nb 0 in '%s' (ret=%d): %s"),
- sql, ret, sqlite3_errmsg(db));
+ log_plugin_variadic_message(LMT_ERROR, _("Can't bind value for parameter nb 0 in '%s' (ret=%d): %s"),
+ sql, ret, sqlite3_errmsg(db));
goto efsd_clean_exit;
}
ret = sqlite3_bind_int(stmt, 2, nr);
if (ret != SQLITE_OK)
{
- g_plugin_module_log_variadic_message(plugin, LMT_ERROR,
- _("Can't bind value for parameter nb 1 in '%s' (ret=%d): %s"),
- sql, ret, sqlite3_errmsg(db));
+ log_plugin_variadic_message(LMT_ERROR, _("Can't bind value for parameter nb 1 in '%s' (ret=%d): %s"),
+ sql, ret, sqlite3_errmsg(db));
goto efsd_clean_exit;
}
diff --git a/plugins/lnxsyscalls/db.h b/plugins/lnxsyscalls/db.h
index 7eae005..d0efe8b 100644
--- a/plugins/lnxsyscalls/db.h
+++ b/plugins/lnxsyscalls/db.h
@@ -36,16 +36,16 @@
/* Ouvre la base de connaissances quant aux appels système. */
-sqlite3 *open_syscalls_database(const GPluginModule *);
+sqlite3 *open_syscalls_database(void);
/* Ferme la base de connaissances quant aux appels système. */
void close_syscalls_database(sqlite3 *);
/* Présente le contenu de la base des appels système. */
-void introduce_syscalls_database(sqlite3 *, const GPluginModule *);
+void introduce_syscalls_database(sqlite3 *);
/* Construit l'identité d'un appel système pour un indice donné. */
-syscall_info_t *extract_from_syscalls_database(sqlite3 *, const GPluginModule *, const char *, unsigned int);
+syscall_info_t *extract_from_syscalls_database(sqlite3 *, const char *, unsigned int);
diff --git a/plugins/lnxsyscalls/hunter.c b/plugins/lnxsyscalls/hunter.c
index 30329fd..afe73fb 100644
--- a/plugins/lnxsyscalls/hunter.c
+++ b/plugins/lnxsyscalls/hunter.c
@@ -37,8 +37,6 @@ struct _GGateHunter
{
GDelayedWork parent; /* A laisser en premier */
- const GPluginModule *plugin; /* Liens pour les messages */
-
GLoadedBinary *binary; /* Binaire chargé et concerné */
GBinFormat *format; /* Format de fichier manipulé */
GProcContext *context; /* Contexte de désassemblage */
@@ -179,8 +177,7 @@ static void g_gate_hunter_finalize(GGateHunter *hunter)
/******************************************************************************
* *
-* Paramètres : plugin = greffon à manipuler. *
-* binary = binaire dont la définition est à compléter. *
+* Paramètres : binary = binaire dont la définition est à compléter. *
* context = contexte de désassemblage. *
* begin = point de départ du parcours de liste. *
* end = point d'arrivée exclu du parcours. *
@@ -195,14 +192,12 @@ static void g_gate_hunter_finalize(GGateHunter *hunter)
* *
******************************************************************************/
-GGateHunter *g_gate_hunter_new(const GPluginModule *plugin, GLoadedBinary *binary, GProcContext *context, size_t begin, size_t end, activity_id_t id, const hunting_ops *hops)
+GGateHunter *g_gate_hunter_new(GLoadedBinary *binary, GProcContext *context, size_t begin, size_t end, activity_id_t id, const hunting_ops *hops)
{
GGateHunter *result; /* Tâche à retourner */
result = g_object_new(G_TYPE_GATE_HUNTER, NULL);
- result->plugin = plugin;
-
result->binary = binary;
g_object_ref(G_OBJECT(binary));
@@ -220,7 +215,7 @@ GGateHunter *g_gate_hunter_new(const GPluginModule *plugin, GLoadedBinary *binar
result->hops = hops;
- result->db = open_syscalls_database(plugin);
+ result->db = open_syscalls_database();
if (result->db == NULL) goto gghn_db_error;
return result;
@@ -291,7 +286,7 @@ static void g_gate_hunter_process(GGateHunter *hunter, GtkStatusStack *status)
ret = hunter->hops->resolve_nr(exec, proc, hunter->hops, &nr);
if (!ret) goto unknown_syscall;
- info = extract_from_syscalls_database(hunter->db, hunter->plugin, hunter->hops->arch, nr);
+ info = extract_from_syscalls_database(hunter->db, hunter->hops->arch, nr);
if (info == NULL) goto unknown_syscall;
loop = count_register_tracker_stacks(exec);
diff --git a/plugins/lnxsyscalls/hunter.h b/plugins/lnxsyscalls/hunter.h
index ba244e2..ed191f4 100644
--- a/plugins/lnxsyscalls/hunter.h
+++ b/plugins/lnxsyscalls/hunter.h
@@ -26,7 +26,7 @@
#include <analysis/binary.h>
-#include <plugins/plugin.h>
+#include <gtkext/gtkstatusstack.h>
#include "hops.h"
@@ -52,7 +52,7 @@ typedef struct _GGateHunterClass GGateHunterClass;
GType g_gate_hunter_get_type(void);
/* Crée une tâche d'étude de routines différée. */
-GGateHunter *g_gate_hunter_new(const GPluginModule *, GLoadedBinary *, GProcContext *, size_t, size_t, activity_id_t, const hunting_ops *);
+GGateHunter *g_gate_hunter_new(GLoadedBinary *, GProcContext *, size_t, size_t, activity_id_t, const hunting_ops *);