GithubHelp home page GithubHelp logo

elf-parser's Introduction

elf-parser

A simple parser for ELF files format (Both types are supported ELF32 and ELF64)

Usage of the library

...
struct SELF elfData;

	if (PElf(argv[1]) != ELF_VALID)
		return fprintf(stderr,
			       "%s:  formatted doesn't look like an elf \n",
			       argv[0]);

	ElfStruct(&elfData);	// Get 16 bytes of information
	if (elfData.classElf != ELFCLASS64)
		return fprintf(stderr,
			       "%s is a 32 bit ELF, the parser only supports ELF 64 bits version\n",
			       argv[1]);

	puts("Elf Header :");
	// Magic header elf
	printf(" Magic:");
	for (int8_t i = 0; i < EI_NIDENT; i++)
		printf(" %02x", ElfMagic()[i]);
	puts("");		// \n
	if (elfData.elf64Header->e_version == EV_CURRENT)
		printf(" Version: %i (Current)\n",
		       elfData.elf64Header->e_version);
	else
		printf(" Version: %i \n", elfData.elf64Header->e_version);
	printf(" Entry Point: 0x%x\n", elfData.elf64Header->e_entry);
	printf(" Start of program headers: %lu\n",
	       elfData.elf64Header->e_phoff);
	printf(" Start of section headers: %lu\n",
	       elfData.elf64Header->e_shoff);
	printf(" ABI Version: 0x%x\n",
	       elfData.elf64Header->e_ident[EI_ABIVERSION]);
	printf(" Flags : 0x%x\n", elfData.elf64Header->e_flags);
	printf(" Size of this header: %i\n", elfData.elf64Header->e_ehsize);
	printf(" Size of program headers: %i\n",
	       elfData.elf64Header->e_phentsize);
	printf(" Number of program headers: %i\n",
	       elfData.elf64Header->e_phnum);
	printf(" Size of section headers: %i\n",
	       elfData.elf64Header->e_shentsize);
	printf(" Number of section headers: %i\n",
	       elfData.elf64Header->e_shnum);
...

Information

  • This project has been wrote by VitorMob
  • And forked from here: relf

In his words:

This parser is just a project I'm keeping to study elf format, the features for now are: elf header

How to compile

mkdir build
cd build
cmake ..
make

How to use the sample

./elf_parser ./elf_parser
+ For looking inside of

elf-parser's People

Contributors

ifgpuelse avatar vitormob avatar

Stargazers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.