mirror of
https://github.com/maxDcb/C2Core
synced 2026-06-08 15:48:01 +00:00
Implement persistent interactive shell module
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user