我有这样的功能
void smbProcess(){
string smbTargetIP;
cout<<"Target IP: ";
cin>>smbTargetIP;
string commandSmb_S = "crackmapexec smb " + smbTargetIP;
int smbLength = commandSmb_S.length();
char commandSmb_C[smbLength + 1];
strcpy(commandSmb_C, commandSmb_S.c_str());
system("xterm -hold -e commandSmb_C");
}
我想创建一个新终端并运行我的命令(例如“crackmapexec smb 192.168.1.0/24”)。但它不起作用。当我尝试这个时,它有效
system("xterm -hold -e date");
这些也不起作用
system("xterm -hold -e 'commandSmb_C'");
system("xterm -hold -e "commandSmb_C"");
如果您知道另一种方法,它也可以
回答1
将“xterm -hold -e”添加到 commandSmb_S
void smbProcess(){
string smbTargetIP;
cout<<"Target IP: ";
cin>>smbTargetIP;
string commandSmb_S = "xterm -hold -e crackmapexec smb " + smbTargetIP;
int smbLength = commandSmb_S.length();
char commandSmb_C[smbLength + 1];
strcpy(commandSmb_C, commandSmb_S.c_str());
system(commandSmb_C);
}