2014/08/27

How to compile and test your shellcode


I want to develop my hacking skills by learning how to do reverse engineering, so I’m learning assembly language. Without the assembly language, you’ll not be able to understand whats going on in the program.
But that’s not all. Assembly allows you also to make your own shellcode more cleanly and precise. But in this exercise you need to test your shellcode and see if it works as you expected. This will be a repeated task over and over agen so automating it will make you much faster and less prone to mistakes.



Here is a simple bash script I wrote to make it more easy for me :

compile and test shellcode

Usage:

You only supply the name of your assembly file without the .asm extension. As you can see in the image above you get in the output your shellcode in multiline format ant one line format.
The execve3_shellcode.c is the one that will test your shellcode, and it is already compiled. Here it is in c format :


Hope this will help you with your assembly compilation and make it more easy to compile and test it.

2 comments:

  1. hello, what type of assembly language are you learning ? i want to learn to reverse engineering. but there're so many assembly language such as nasm, masm etc.. please advise me

    ReplyDelete
    Replies
    1. Hi, intel x86 assembly with nasm assembler will be the place to start in my opinion. Then do some intel x64 and once you master these 2 arm is the next step. With these skills I think you can reverse engineer almost any software out there, even if it is a different architecture you'll be able to adapt very quickly.

      Delete