Reverse Engineeringassemblerdisassemblerx86ndisasmbinary

nasm

NASM is a general-purpose x86 assembler that outputs various object file formats including flat binary, a.out, COFF, ELF, and Microsoft DOS/Win32 files. It includes NDISASM, a prototype x86 binary-file disassembler using the same instruction table.

Description

NASM, the Netwide Assembler, is a portable 80x86 assembler designed for producing flat-form binary files, Unix object files (a.out, COFF, ELF), and Microsoft 16-bit DOS and Win32 object files. It serves as a key tool for low-level programming and assembly code development in cybersecurity contexts like exploit development.

NDISASM, included with NASM, functions as a prototype disassembler for x86 binary files, leveraging NASM's instruction table for accurate disassembly. This makes it valuable for reverse engineering tasks where analyzing binary code is essential.

Released under the 2-clause BSD license, NASM is lightweight with an installed size of 3.67 MB and depends on libc6. It supports Kali Linux environments for hands-on labs in x86 skill paths and exploit development essentials.

How It Works

NASM assembles x86 assembly code into specified output formats like ELF, COFF, or flat binary using its instruction table. NDISASM disassembles x86 binary files by parsing bytes with the same table, supporting processor modes (16/32/64-bit), auto-sync, and vendor-specific adjustments for accurate instruction recognition.

Installation

bash
sudo apt install nasm

Flags

-vprint the NASM version number and exit
-@ fileresponse file; one command line option per line
-hlist command line options and exit (also --help)
-h -optshow additional help for option "-opt"
-h allshow all available command line help
-h topicsshow list of help topics (also -h list)
-o outfilewrite output to outfile
-aactivates auto (intelligent) sync (for ndisasm)
-b bitssets the processor mode, e.g. -b 16, -b 32 or -b 64 (for ndisasm)
-usame as -b 32 (for ndisasm)
-lsame as -b 64 (for ndisasm)
-wwide output (avoids continuation lines) (for ndisasm)
-rdisplays the version number (for ndisasm)

Examples

Lists command line options and exits
nasm -h
Prints the NASM version number and exits
nasm -v
Uses a response file with one command line option per line
nasm -@ response_file
Assembles filename and writes output to outfile
nasm -o outfile filename
Shows additional help for a specific option -opt
nasm -h -opt
Shows all available command line help
nasm -h all
Displays ndisasm usage and options
ndisasm -h
Disassembles file in 32-bit processor mode
ndisasm -b 32 file
Updated 2026-04-16kali.org ↗