common + arch diff
This commit is contained in:
6
README.md
Normal file
6
README.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# todo
|
||||||
|
|
||||||
|
- display e_type and rest of header for 32/64
|
||||||
|
- display protections
|
||||||
|
- colorful
|
||||||
|
- maybe display elf sections if command entered (??)
|
||||||
55
main.c
55
main.c
@@ -1,5 +1,30 @@
|
|||||||
// goal:
|
// This is free and unencumbered software released into the public domain.
|
||||||
// replace "file" + "checksec"
|
//
|
||||||
|
// Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
|
// distribute this software, either in source code form or as a compiled
|
||||||
|
// binary, for any purpose, commercial or non-commercial, and by any
|
||||||
|
// means.
|
||||||
|
//
|
||||||
|
// In jurisdictions that recognize copyright laws, the author or authors
|
||||||
|
// of this software dedicate any and all copyright interest in the
|
||||||
|
// software to the public domain. We make this dedication for the benefit
|
||||||
|
// of the public at large and to the detriment of our heirs and
|
||||||
|
// successors. We intend this dedication to be an overt act of
|
||||||
|
// relinquishment in perpetuity of all present and future rights to this
|
||||||
|
// software under copyright law.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
//
|
||||||
|
// For more information, please refer to <https://unlicense.org/>
|
||||||
|
//
|
||||||
|
// @author xamidev <xamidev@riseup.net>
|
||||||
|
// @brief Recon tool for ELF32/64
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -83,14 +108,36 @@ int read_elf_magic(FILE* fp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void display_elf_common(unsigned char e_ident[EI_NIDENT])
|
||||||
|
{
|
||||||
|
// EI_DATA
|
||||||
|
switch(e_ident[5])
|
||||||
|
{
|
||||||
|
case 0x01:
|
||||||
|
printf("(LSB) ");
|
||||||
|
break;
|
||||||
|
case 0x02:
|
||||||
|
printf("(MSB) ");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("\nInvalid data encoding!\n");
|
||||||
|
exit(-EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// EI_VERSION
|
||||||
|
printf("version %d", e_ident[6]);
|
||||||
|
}
|
||||||
|
|
||||||
void display_elf32(struct Elf32_Ehdr* header)
|
void display_elf32(struct Elf32_Ehdr* header)
|
||||||
{
|
{
|
||||||
printf("32-bit ELF\n");
|
printf("32-bit ELF ");
|
||||||
|
display_elf_common(header->e_ident);
|
||||||
}
|
}
|
||||||
|
|
||||||
void display_elf64(struct Elf64_Ehdr* header)
|
void display_elf64(struct Elf64_Ehdr* header)
|
||||||
{
|
{
|
||||||
printf("64-bit ELF\n");
|
printf("64-bit ELF ");
|
||||||
|
display_elf_common(header->e_ident);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char read_elf_obj_size(FILE* fp)
|
unsigned char read_elf_obj_size(FILE* fp)
|
||||||
|
|||||||
Reference in New Issue
Block a user