asrepl is an assembly based REPL. The REPL processes each line of user input, the output can be witnessed by issuing the command 'regs' and looking at the register state.
asrepl works by the following steps when not using Unicorn + Keystone:
- Fork a process that will be used to execute user supplied asm. The terminology to recognize is: "The parent process forks the child process."
- The parent process listens for user supplied asm instructions.
- When a newline is encountered (pressing enter in the REPL), the asm is assembled via the host assembler.
- The parent process opens the object file generated from the host assembler, which contains the user's supplied asm, assembled down to machine instructions.
- Those instructions are injected into the child process, and the child process is single stepped one instruction. goto 2.
- Run
./configure
to generate a Makefile and autodetect a build configuration based on libraries available on your system. - Run
make
from the directory. Once you jump into the REPL issue a "?" to get a list of commands. - The resulting application is called
asrepl
, so have at it!
- mips32 support is not functioning.
- This tool is alpha. (Lame excuse if something doesn't work).
- This tool creates and overwrites two files: .asrepl.foo.s, .asrepl.foo.o. Be aware if you already have those files. Additionally, since asrepl leaves these files around, ensure that you do not leave any super secret leet asm marinating, or others might get your leet secretz.
- GNU readline library, you probably have this.
- x86-64 bit architecture.
- An assembler, ideally GNU as: https://www.gnu.org/software/binutils/
- I've only tested this on Linux.
- Optional: Keystone and Unicorn Engine (for arm, mips, x8632 support).
Special thanks goes out to sibios who added the Keystone and Unicorn support. That feature allows asrepl to act as a repl for a multitude of architectures.
Matt Davis (enferex)
If you want more features or find a bug, feel free to reach out to me via github: http://github.com/enferex