Last active
March 13, 2019 15:17
-
-
Save ilmanzo/082d04e0c4a965dd3d5cdbe2ce5963d0 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
; setup | |
; | |
; sudo apt-get install cmatrix nasm ; nasm -f elf64 -o matrix.o matrix.asm ; ld -o matrix matrix.o; ./matrix | |
SECTION .text | |
global _start | |
_start: | |
mov rdx, environment ; address of environment variables | |
mov rsi, arguments ; address of the arguments to pass to the commandline | |
mov rdi, command ; address of the file to execute | |
mov rax, 59 ; invoke SYS_EXECVE | |
syscall | |
mov eax, 60 ; exit(0) | |
xor rdi, rdi | |
syscall | |
SECTION .data | |
command db '/usr/bin/cmatrix', 0 ; command to execute | |
arg1 db '-a', 0 | |
arg2 db '-b', 0 | |
envp1 db 'TERM=xterm',0 | |
arguments dq command | |
dq arg1,arg2 ; arguments to pass to commandline | |
dq 0h ; end the struct | |
environment dq envp1 | |
dq 0h ; arguments to pass as environment variables (inthis case none) end the struct |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment