Using the NASM shell for writing assembly instructions

Metasploit provides an excellent utility for writing short assembly code using the NASM shell. We wrote a small assembly code in the previous section, \xeb\x0a, which denoted a short jump of 12 bytes. However, after eliminating the use of searching the internet or toggling through assembly op-codes, we can use the NASM shell to write assembly code with ease.

In the previous example, we had a simple assembly call, which was JMP SHORT 12. However, we did not know what op-codes match this instruction. Therefore, let's use the NASM shell and find out, as follows:

We can see in the preceding ...

Get Mastering Metasploit - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.