Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
BITS 64
CPU X64
section .text
global _start
_start:
dec ecx ; counter register used for repnz
pop rdi ; throw away argc, could be not 1
pop rdi ; get argv[0]
repnz scasb ; get end of argv[0], since beginning may be garbage (./)
mov rdi, [byte rdi - 5]
and rdi, 1
mov rax, 0x3c ; sys_exit
syscall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment