Skip to content

Instantly share code, notes, and snippets.

@charles-l
Last active January 29, 2024 17:51
Show Gist options
  • Save charles-l/5455a3caba992b02187225a8ac749771 to your computer and use it in GitHub Desktop.
Save charles-l/5455a3caba992b02187225a8ac749771 to your computer and use it in GitHub Desktop.
my xchg rax,rax getting started guide (https://www.xorpd.net/pages/xchg_rax/snip_00.html)
  1. Install gdb
  2. Install GDB PEDA
  3. Install nasm
  4. Create a makefile:
    %: %.asm
      nasm -f elf64 $< && ld -s -o $@ [email protected]
    
    all: $(patsubst %.asm,%,$(wildcard *.asm))
    
    clean: $(patsubst %.asm,%,$(wildcard *.asm))
      rm $^
      rm *.o
  5. Have a tab with https://www.felixcloutier.com/x86/ handy.
  6. Create a skeleton asm file (e.g. 0x00.asm) and write some assembly:
    section .text
    global _start
    _start:
    ; your asm code here
  7. make && gdb ./0x00
  8. starti to break at first instruction in executable, si to step instruction. Update registers with set (e.g. set $rax=3). Loop 6.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment