Created
June 12, 2017 19:39
-
-
Save kjensenxz/1b08c76ec82b3c5fe74f04a57adc0988 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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