Metasm is a cross-architecture assembler, disassembler, linker, and debugger. It is written in such a way that it is easy to add support for new architectures. For now, the following architectures are in:
Intel Ia32.txt (16 and 32bits)
Intel X86_64.txt (aka Ia32 64bits, X64, AMD64)
Supports low and high-level debugging support (Ia32 only for now) under Windows, Linux and remote (via a gdbserver). Metasm is included in Metasploit by default.
Install Metasm gem
gem install metasm
More about installation here.
You can find metasm-shell in ruby gems default path after installation. In my case, it's located in
ruby metasm-shell.rbtype "exit" or "quit" to quituse ";" for newlineasm>
as you can see you are now in the shell's prompt
Find assembly op-code
asm> nop nop"\x90\x90"asm> call [eax]"\xff\x10"asm> push esp"\x54"asm> pop eax"\x58"
Note: it is possible to do exactly the same thing with a metasploit embedded tool:
$ /opt/metasploit/tools/exploit/nasm_shell.rbnasm > jmp esp00000000 FFE4 jmp esp