Skip to content

🖥 Nm and otool implementation in C. Parse Mach-o files, supports fat binaries, archives and corrupted binaries. A medium article is available in description.

pombredanne/42-nm-otool

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

42-nm-otool

Custom C implementation of nm and otool commands.

  • ft_nm <args> displays the name list (symbol table of nlist structures) of the <args> files
  • ft_tool displays the content of the (__TEXT,__text) segment

This project will makes you understand how Mach-O files are structured.

How to use

Build

make

# Clean commands
make clean
make fclean
make re

Usage

# Files supported: exec, .a, .so, .dylib, .o.
./ft_nm file
./ft_otool file

Implementation

  • Support for archives
  • Support for fat binaries
  • Support for debug symbols (gcc -g <args> files).
  • Many flags (see ./ft_nm -h or ./ft_otool -h)
  • Checks for corruption

To understand how I implemented this program, you can refer to the medium article of this project.

File structure

/inc
    # Self made printf
    # Self made libc
    nm_otool.h
/src
    /cmd # Parse argv and set the program state
    /hande # Handle structure for magic files
    /parse # Parse the inner structures
    /shared

    # Root files
    ft_nm.c
    ft_otool.c

Predefined values

About

🖥 Nm and otool implementation in C. Parse Mach-o files, supports fat binaries, archives and corrupted binaries. A medium article is available in description.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 95.3%
  • Makefile 3.4%
  • Other 1.3%