summaryrefslogtreecommitdiff
path: root/plugins/elf/program.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-11-29 16:24:20 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-11-29 16:24:20 (GMT)
commit7fd6e0b76f33de5934fad17efb75366904a3875b (patch)
tree51ddde83844efe7a653bb33bf93e73d6323c9f45 /plugins/elf/program.c
parent046c2cfac39e686dee65cdf54035dc5a975bc57f (diff)
Provided the list of needed shared objects for an Elf binary.
Diffstat (limited to 'plugins/elf/program.c')
-rw-r--r--plugins/elf/program.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/plugins/elf/program.c b/plugins/elf/program.c
index 3016feb..7e6f2e4 100644
--- a/plugins/elf/program.c
+++ b/plugins/elf/program.c
@@ -108,7 +108,7 @@ const char *get_elf_program_type_desc(const GElfFormat *format, uint32_t p_type)
/******************************************************************************
* *
* Paramètres : format = description de l'exécutable à consulter. *
-* index = indice de la section recherchée. *
+* index = indice de la partie recherchée. *
* program = ensemble d'informations à faire remonter. [OUT] *
* *
* Description : Recherche un programme donné au sein de binaire par indice. *
@@ -135,6 +135,41 @@ bool find_elf_program_by_index(const GElfFormat *format, uint16_t index, elf_phd
/******************************************************************************
* *
+* Paramètres : format = description de l'exécutable à consulter. *
+* type = type de la partie recherchée. *
+* program = ensemble d'informations à faire remonter. [OUT] *
+* *
+* Description : Recherche un programme donné au sein de binaire par type. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool find_elf_program_by_type(const GElfFormat *format, uint32_t type, elf_phdr *program)
+{
+ bool result; /* Bilan à retourner */
+ uint16_t i; /* Boucle de parcours */
+
+ result = false;
+
+ for (i = 0; i < ELF_HDR(format, format->header, e_phnum) && !result; i++)
+ {
+ find_elf_program_by_index(format, i, program);
+
+ if (ELF_PHDR(format, *program, p_type) == type)
+ result = true;
+
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : format = description de l'exécutable à consulter. *
* off = position physique à retrouver. *
* pos = position correspondante. [OUT] *