你能使用NASM向Linux终端发送bash命令吗?

时间:2020-12-01 02:52:49

Can you send a bash command to the Linux terminal using NASM.

Would like to see if it is possible to do and showing an example of the correct Nasm code used.

想看看是否可以做和显示使用的正确Nasm代码的示例。

Also With or without using the printf Cpp library’s.

使用或不使用printf Cpp库的。

And before anyone asks i know it is possible to use BASH its self or Python etc. To do this.

在任何人问我知道之前可以使用BASH自己或Python等。为此。

Example commands:

示例命令:

ifconfig
groupdel

1 个解决方案

#1


2  

Use fork and execve syscalls. First use fork to create a new process. In the new process, use execve to load an instance of shell (/bin/sh) with the arguments -c and the command to execute.

使用fork和execve系统调用。首先使用fork来创建一个新进程。在新进程中,使用execve加载一个shell实例(/ bin / sh),并带有参数-c和要执行的命令。

And then you'll have your own implementation of C RTL's system().

然后你将拥有自己的C RTL系统实现()。

#1


2  

Use fork and execve syscalls. First use fork to create a new process. In the new process, use execve to load an instance of shell (/bin/sh) with the arguments -c and the command to execute.

使用fork和execve系统调用。首先使用fork来创建一个新进程。在新进程中,使用execve加载一个shell实例(/ bin / sh),并带有参数-c和要执行的命令。

And then you'll have your own implementation of C RTL's system().

然后你将拥有自己的C RTL系统实现()。