MCPcopy Create free account
hub / github.com/Adaptix-Framework/AdaptixC2 / ProcessHelp

Method ProcessHelp

AdaptixClient/Source/Agent/Commander.cpp:424–639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

422QString Commander::GetError() { return error; }
423
424CommanderResult Commander::ProcessHelp(QStringList commandParts)
425{
426 QString result;
427 QTextStream output(&result);
428 if (commandParts.isEmpty()) {
429 int TotalWidth = 24;
430 output << QString("\n");
431 output << QString(" Command Description\n");
432 output << QString(" ------- -----------\n");
433
434 for (auto command : mainCommandsGroup.commands) {
435 QString commandName = command.name;
436 if (!command.subcommands.isEmpty())
437 commandName += '*';
438
439 QString tab = QString(TotalWidth - commandName.size(), ' ');
440 output << " " + commandName + tab + " " + command.description + "\n";
441 }
442
443 for (const auto &server_group : serverGroups) {
444 if (!server_group.enabled)
445 continue;
446 if (server_group.group.groupName != agentType)
447 continue;
448
449 for (const auto &command : server_group.group.commands) {
450 QString commandName = command.name;
451 if (command.subcommands.isEmpty()) {
452 QString tab = QString(TotalWidth - commandName.size(), ' ');
453 output << " " + commandName + tab + " " + command.description + "\n";
454 } else {
455 for (const auto &subcmd : command.subcommands) {
456 QString subcmdName = commandName + " " + subcmd.name;
457 QString tab = QString(TotalWidth - subcmdName.size(), ' ');
458 output << " " + subcmdName + tab + " " + subcmd.description + "\n";
459 }
460 }
461 }
462 }
463
464 for (const auto &server_group : serverGroups) {
465 if (!server_group.enabled)
466 continue;
467 if (server_group.group.groupName == agentType)
468 continue;
469
470 output << QString("\n");
471 output << QString(" Group - " + server_group.group.groupName + "\n");
472 output << QString(" =====================================\n");
473
474 for (const auto &command : server_group.group.commands) {
475 QString commandName = command.name;
476 if (command.subcommands.isEmpty()) {
477 QString tab = QString(TotalWidth - commandName.size(), ' ');
478 output << " " + commandName + tab + " " + command.description + "\n";
479 } else {
480 for (const auto &subcmd : command.subcommands) {
481 QString subcmdName = commandName + " " + subcmd.name;

Callers 1

ProcessInputMethod · 0.95

Calls 3

QStringClass · 0.50
isEmptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected