Files
Sigma-C2/operator/commands.go
Pavlo Khazov 0df36d871e Read changelog
2025-08-18 16:03:04 +02:00

125 lines
3.5 KiB
Go

package main
// Available commands fpr tab completion in main context
var availableGeneralCommands = []struct {
command string
subcommands map[string][]string
}{
{"help", nil},
{"agents", nil},
{"show", map[string][]string{
"agent": {""}, // Updated dynamically
"listeners": nil,
}},
{"tasks", nil},
{"clear", map[string][]string{
"tasks": {""}, // Updated dynamically
}},
{"listen", map[string][]string{
"-t": {"ssl", "tcp", "https"},
"-h": {""},
"-p": {""},
"-n": {""},
}},
{"modules", nil},
{"stop", map[string][]string{
"listener": {""}, // Updated dynamically
}},
{"generate", map[string][]string{
"agent": {""}, // Updated dynamically
"beacon": {""}, // Updated dynamically
}},
{"interact", map[string][]string{
"": {""}, // Updated dynamically
}},
{"exit", nil},
{"quit", nil},
}
// Available commands fpr tab completion in agent context
var availableContextCommands = []struct {
command string
subcommands map[string][]string
}{
{"help", nil},
{"agents", nil},
{"show", map[string][]string{
"agent": {""}, // Updated dynamically
}},
{"tasks", nil},
{"clear", map[string][]string{
"tasks": {""}, // Updated dynamically
}},
{"info", nil},
{"modules", nil},
{"getinfo", map[string][]string{"": {""}}},
{"sleep", map[string][]string{"": {""}}},
{"cmd", map[string][]string{"": {""}}},
{"powershell", map[string][]string{"": {""}}},
{"cd", map[string][]string{"": {""}}},
{"ls", map[string][]string{"": {""}}},
{"pwd", nil},
{"dir", map[string][]string{"": {""}}},
{"inject-self", map[string][]string{"": {""}}},
{"inject-remote", map[string][]string{"": {""}}},
{"spawn", map[string][]string{"": {""}}},
{"set-ppid", nil},
{"keylogger", map[string][]string{
"start": {""},
"stop": {""},
}},
{"persistence", map[string][]string{
"add": {""},
"remove": {""},
}},
{"download", map[string][]string{"": {""}}},
{"upload", map[string][]string{"": {""}}},
{"proxy", map[string][]string{
"start": {""},
"stop": {""},
}},
{"kill", map[string][]string{"": {""}}},
{"cleanup", map[string][]string{"": {""}}},
{"exit", nil},
{"quit", nil},
}
// Commands which agentID is appended to
var implantCommands = []string{
"tasks", "sleep", "cmd", "powershell", "getinfo", "keylogger",
"persistence", "download", "upload", "artifacts", "kill", "cleanup",
"exit", "cd", "ls", "pwd", "dir", "proxy", "ps", "inject-self",
"inject-remote", "spawn", "set-ppid", "info",
}
// Update available listener names for "generate agent" and "generate beacon" and for "stop listeners"
func UpdateListenersSubCommands(listeners []string) {
for i := range availableGeneralCommands {
switch availableGeneralCommands[i].command {
case "generate":
availableGeneralCommands[i].subcommands["agent"] = listeners
availableGeneralCommands[i].subcommands["beacon"] = listeners
case "stop":
availableGeneralCommands[i].subcommands["listener"] = listeners
}
}
}
// Update available commands to auto-complete agent names
func UpdateAgentsSubCommands(agentList []string) {
agents = agentList
for i := range availableGeneralCommands {
switch availableGeneralCommands[i].command {
case "show":
availableGeneralCommands[i].subcommands["agent"] = agentList
availableContextCommands[i].subcommands["agent"] = agentList
// availableGeneralCommands[i].subcommands["tasks"] = agentList
case "clear":
availableGeneralCommands[i].subcommands["tasks"] = agentList
availableContextCommands[i].subcommands["tasks"] = agentList
case "interact":
availableGeneralCommands[i].subcommands[""] = agentList
}
}
}