如何在linux汇编程序中使用exec syscall

时间:2021-05-15 21:13:42

标签: linux assembly x86-64 system-calls fasm

format ELF64

public _start


section '.data' writable
command db "/usr/bin/nc", 0x0
argument1 db "-l", 0x0
argument2 db "127.0.0.1", 0x0
argument3 db "12345", 0x0
last_arg dq 0x0
argv dq command, argument1, argument2, argument3, 0x0


section '.text' executable
_start:
    mov rax, 11
    mov rbx, command
    mov rcx, argv
    mov rdx, 0
    int 0x80

这是我的简单汇编程序,应该只是使用 exec 来加载 nc 的内存映像,但是出了点问题

execve("/usr/bin/nc", ["/usr/bin/nc"], NULL)

这是strace的输出。它只传递程序名称而忘记了其他参数。 我应该如何修复我的程序?

0 个答案:

没有答案
相关问题