diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-05-11 00:58:05 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-05-11 00:58:05 (GMT) |
commit | 46bcc7f122245f22772fd3e38d16e6afa7bd5881 (patch) | |
tree | d3c2ba1a9999e373428954f24d0e60c1ea63b756 /plugins/ropgadgets/helper_arm.c | |
parent | 1bda6c517d30d873ff0d92a96380946ef944c9ae (diff) |
Provided a way to look for ROP gadgets in binary code.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@533 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'plugins/ropgadgets/helper_arm.c')
-rw-r--r-- | plugins/ropgadgets/helper_arm.c | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/plugins/ropgadgets/helper_arm.c b/plugins/ropgadgets/helper_arm.c new file mode 100644 index 0000000..7288399 --- /dev/null +++ b/plugins/ropgadgets/helper_arm.c @@ -0,0 +1,76 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * helper_arm.c - prise en compte des spécifités ARM pour la recherche de gadgets + * + * Copyright (C) 2015 Cyrille Bagard + * + * This file is part of Chrysalide. + * + * OpenIDA is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * OpenIDA is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar. If not, see <http://www.gnu.org/licenses/>. + */ + + +#include "helper_arm.h" + + +#include <malloc.h> + + +#include <arch/arm/v7/context.h> + + + +/****************************************************************************** +* * +* Paramètres : proc = processeur lié à l'architecture visée. * +* names = noms attribués aux différents contextes. * +* count = nombre de gadgets trouvés. [OUT] * +* * +* Description : Etablit une liste des contextes utiles à la recherche. * +* * +* Retour : Liste de contextes mis en place. * +* * +* Remarques : Toues les tableaux créés sont à libérer après usage. * +* * +******************************************************************************/ + +GProcContext **get_rop_contexts_for_arm(const GArchProcessor *proc, char ***names, size_t *count) +{ + GProcContext **result; /* Contextes à retourner */ + + result = (GProcContext **)calloc(2, sizeof(GProcContext *)); + + (*names) = (char **)calloc(2, sizeof(char *)); + + *count = 2; + + /* Thumb */ + + result[0] = g_arch_processor_get_context(proc); + + g_armv7_context_define_encoding(G_ARMV7_CONTEXT(result[0]), 0, AV7IS_THUMB); + + (*names)[0] = "Thumb"; + + /* ARMM */ + + result[1] = g_arch_processor_get_context(proc); + + g_armv7_context_define_encoding(G_ARMV7_CONTEXT(result[1]), 0, AV7IS_ARM); + + (*names)[1] = "ARM"; + + return result; + +} |