diff --git a/README.md b/README.md
new file mode 100644
index 0000000..1009baf
--- /dev/null
+++ b/README.md
@@ -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 (??)
diff --git a/helpelf b/helpelf
index 37bda3b..d32093b 100755
Binary files a/helpelf and b/helpelf differ
diff --git a/main.c b/main.c
index d2adc18..aebcc84 100644
--- a/main.c
+++ b/main.c
@@ -1,5 +1,30 @@
-// goal:
-// replace "file" + "checksec"
+// This is free and unencumbered software released into the public domain.
+//
+// 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
+//
+// @author xamidev
+// @brief Recon tool for ELF32/64
#include
#include
@@ -83,14 +108,36 @@ int read_elf_magic(FILE* fp)
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)
{
- printf("32-bit ELF\n");
+ printf("32-bit ELF ");
+ display_elf_common(header->e_ident);
}
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)