Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printing file headers #278

Open
XVilka opened this issue Sep 23, 2020 · 1 comment
Open

Printing file headers #278

XVilka opened this issue Sep 23, 2020 · 1 comment

Comments

@XVilka
Copy link
Contributor

XVilka commented Sep 23, 2020

Print the following workflow:

r2 -e io.va=false /bin/ls
[0x000068d0]> pfo elf64
[0x000068d0]> pf.elf_
pf.elf_ident    pf.elf_phdr     pf.elf_header   pf.elf_shdr     
[0x000068d0]> pf.elf_ident @ 0
   magic : 0x00000000 = "\x7fELF"
   class : 0x00000004 = class (enum elf_class) = 0x2 ; ELFCLASS64
    data : 0x00000005 = data (enum elf_data) = 0x1 ; ELFDATA2LSB
 version : 0x00000006 = version (enum elf_hdr_version) = 0x1 ; EV_CURRENT
[0x000068d0]> pf.elf_header @ 0
     ident : 
                struct<elf_ident>
           magic : 0x00000000 = "\x7fELF"
           class : 0x00000004 = class (enum elf_class) = 0x2 ; ELFCLASS64
            data : 0x00000005 = data (enum elf_data) = 0x1 ; ELFDATA2LSB
         version : 0x00000006 = version (enum elf_hdr_version) = 0x1 ; EV_CURRENT
      type : 0x00000010 = type (enum elf_type) = 0x3 ; ET_DYN
   machine : 0x00000012 = machine (enum elf_machine) = 0x3e ; EM_X86_64
   version : 0x00000014 = version (enum elf_obj_version) = 0x1 ; EV_CURRENT
     entry : 0x00000018 = (qword)0x00000000000068d0
     phoff : 0x00000020 = (qword)0x0000000000000040
     shoff : 0x00000028 = (qword)0x0000000000024778
     flags : 0x00000030 = 0x00000000
    ehsize : 0x00000034 = 64
 phentsize : 0x00000036 = 56
     phnum : 0x00000038 = 13
 shentsize : 0x0000003a = 64
     shnum : 0x0000003c = 31
  shstrndx : 0x0000003e = 30
[0x000068d0]> 

In this chapter:

@Maijin
Copy link
Contributor

Maijin commented Sep 23, 2020

https://radareorg.github.io/blog/posts/parsing-a-fileformat-with-radare2/ You can also reuse a lot from here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants