Author Topic: [ASM] Build script, save your worthless time :)  (Read 863 times)

0 Members and 1 Guest are viewing this topic.

Offline R4k0Z

  • /dev/null
  • *
  • Posts: 7
  • Cookies: 1
    • View Profile
[ASM] Build script, save your worthless time :)
« on: April 25, 2015, 01:26:24 am »
Hi everyone,


i've been coding some shellcode in nasm and found really tedious the building steps asm->bin->shellcode->c->exe so i made a script to automate that stuff, nothing fancy, anyways, here it is:


to use it just pass the name of your asm (if its potatoe.asm, you should run "builder.bat potatoe")


NOTE: the bat and asm files must be in the same directory


Code: [Select]

@ECHO OFF


nasm -f bin -o %1.bin %1.asm


xxd -c 1 -p %1.bin %1.txt


if exist %1.c (del %1.c)


set /p "=char code[] = "^"<nul >%1.c


for /F %%i in (%1.txt) do set /p "=\x%%i"<nul >>%1.c


echo ^";>>%1.c


echo int main(int argc, char **argv)>>%1.c
echo {>>%1.c
echo     int (*func)();>>%1.c
echo     func = (int (*)()) code;>>%1.c
echo     (int)(*func)();>>%1.c
echo }>>%1.c


gcc -o %1 %1.c


@ECHO ON

This is just my tiny contribution, thanks everyone for the support and advice!


Hope ill be able to contribute with something more significant in the future :D
Being an idiot isnt against the rules its just frowned upon.

Offline HTH

  • Official EZ Slut
  • Administrator
  • Knight
  • *
  • Posts: 395
  • Cookies: 158
  • EZ Titan
    • View Profile
Re: [ASM] Build script, save your worthless time :)
« Reply #1 on: April 25, 2015, 01:40:31 am »
or...


Code: [Select]
nasm input.asm -f win32 -o output.exe


« Last Edit: April 25, 2015, 01:41:21 am by HTH »
<ande> HTH is love, HTH is life
<TurboBorland> hth is the only person on this server I can say would successfully spitefuck peoples women

Offline R4k0Z

  • /dev/null
  • *
  • Posts: 7
  • Cookies: 1
    • View Profile
Re: [ASM] Build script, save your worthless time :)
« Reply #2 on: April 25, 2015, 02:21:43 am »
may be a good idea :P


but you dont feel the thrill of the shellcode  ;D
« Last Edit: April 25, 2015, 02:22:02 am by R4k0Z »
Being an idiot isnt against the rules its just frowned upon.