Skip to content

Instantly share code, notes, and snippets.

@kjensenxz
Created June 12, 2017 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjensenxz/1b08c76ec82b3c5fe74f04a57adc0988 to your computer and use it in GitHub Desktop.
Save kjensenxz/1b08c76ec82b3c5fe74f04a57adc0988 to your computer and use it in GitHub Desktop.
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