This is a shellcode generator in ASM to fastdevelopment and test it in a C template, I prefer Intel syntax but if you found any AT&T syntaxis in experiments code don't worry, only read documentation inside source code
All source codes run on Debian, I will try to test in some many distros.
If you want to compile and create a trace of all your code use the traditional steps. I know this is hard to remember, use the next snippets.
Disclaimer: This section is under x86 support, all code above is only for x86 architectures. In next versions support x64 and x84_64.
nasm -f elf sourceCode.asm
ld -o executableName sourceCode.o
objdump -d executableName
Normal purposes
gcc -o cExecutableName sourceCode.c
Testing shellcodes
gcc cExecutableName.c -o cExecutableName -fno-stack-protector -z execstack -no-pie
To easy extracting shellcodes use shellcode.sh script contained in root project folder to generate shellcode strings and test it. You can extract a shellcode and print in console, save in a text file, inject into test project, build to check errors and run injected shellcode. Documentation is exposed below.
> bash shellcode.sh [<options>] [<asm_filename>]
-e, --extract Extract shellcode from binary and print
-s, --save Save shellcode into a .txt file
-t, --test Inject shellcode into shellcode.c source code, ready to compile
-tb, --testbuild Inject shellcode and build C program
-tbr, --testbuildrun Inject shellcode, build and run C program
Example:
> bash shellcode.sh -tbr ~/ASM/HelloWorld/Helloworld.asm
I know that start a new project and contain all generated files is hard, for that reason I developed another tool for fast development in asm, you could create new projects with folder structure and using the shellcode script to compile and test use following tool:
Disclaimer: This section is under x86 support, all code above is only for x86 architectures. In next versions support x64 and x84_64.
> bash ASMFastDevelopment.sh [<options>] [<folder name>]
-h, --help Show helps'
-n, --new Create new project with folder name given
-c, --compile Compile .asm file inside folder
Disclaimer: This script works in current folder, do not try to compile outside this folder
Example:
> bash ASMFastDevelopment.sh -c HelloWorld
bash ASMFastDevelopment.sh --new HelloWorld
This command create a new .asm file inside folder, open and develop!
It generates:
| ~/ASM/
|- HelloWorld/
|- HelloWorld.asm
Warning: Do not change the .asm file name!. If you need change it, you need to change folder name
bash ASMFastDevelopment.sh --compile HelloWorld
It generates:
| ~/ASM/
|- HelloWorld/
|- HelloWorld.asm
|- HelloWorld.o
|- HelloWorld [Executable file]
