我想将我的 shell 脚本转换为二进制可执行文件,以便其他人无法编辑或阅读它。有没有办法将其转换为二进制可执行文件?
目标:以 root 身份运行程序(C++ 二进制文件)。同:SetUID 位在 Ubuntu 中不起作用?
./a.out 输出:
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
psurana //output for "whoami" Look below for the code.
ls -l 输出:
-rwsrwxr-x 1 root root 46136 Jun 7 20:13 a.out
编码 :
#include <string>
#include <stdlib.h>
int main(int argc, char *argv[]){
std::string input = "apt-get install " + std::string(argv[1]);
system(input.c_str());
system("whoami"); …
Run Code Online (Sandbox Code Playgroud)