Implement persistent interactive shell module

This commit is contained in:
Maxime dcb
2025-07-30 22:03:45 +02:00
parent 2eeb53d38d
commit b79b9f9663
5 changed files with 272 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
#include "../Shell.hpp"
#include <iostream>
int main()
{
Shell shell;
std::vector<std::string> cmd = {"shell"};
C2Message msg, ret;
shell.init(cmd, msg);
shell.process(msg, ret);
cmd = {"shell", "echo", "hello"};
shell.init(cmd, msg);
msg.set_cmd("echo hello");
shell.process(msg, ret);
bool ok = ret.returnvalue().find("hello") != std::string::npos;
cmd = {"shell", "exit"};
shell.init(cmd, msg);
msg.set_cmd("exit");
shell.process(msg, ret);
std::cout << (ok ? "[+]" : "[-]") << " shell test" << std::endl;
return ok ? 0 : 1;
}