Removed unnecessary "chan" and "select" blocks from listener.go and remove some other minor redundant pieces of code.

This commit is contained in:
Pavlo Khazov
2025-04-01 20:28:14 +02:00
parent 9d87226065
commit 278d7c5293
9 changed files with 84 additions and 99 deletions

View File

@@ -6,8 +6,8 @@ import (
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"strings"
"github.com/chzyer/readline"
@@ -26,7 +26,7 @@ var availableCommands = []struct {
command string
subcommands map[string][]string // Changed to a map for better nesting
}{
{"show agents", nil},
{"agents", nil},
{"show agent", map[string][]string{
"": {""}, // To be dynamically updated
}},
@@ -46,10 +46,10 @@ var availableCommands = []struct {
{"sleep", map[string][]string{
"": {""},
}},
{"shell", map[string][]string{
{"cmd", map[string][]string{
"": {""},
}},
{"ps", map[string][]string{
{"powershell", map[string][]string{
"": {""},
}},
{"run", map[string][]string{
@@ -189,7 +189,7 @@ func main() {
fmt.Println("Client's username and password provided")
// Load CA certificate
caCert, err := ioutil.ReadFile(caCertPath)
caCert, err := os.ReadFile(caCertPath)
if err != nil {
log.Fatalf("Failed to read CA certificate: %v", err)
}