diff --git a/client/command/server.go b/client/command/server.go index 45e852418d..74a62aae12 100644 --- a/client/command/server.go +++ b/client/command/server.go @@ -34,6 +34,7 @@ import ( "github.com/bishopfox/sliver/client/command/crack" "github.com/bishopfox/sliver/client/command/creds" "github.com/bishopfox/sliver/client/command/exit" + "github.com/bishopfox/sliver/client/command/extensions" "github.com/bishopfox/sliver/client/command/generate" "github.com/bishopfox/sliver/client/command/help" "github.com/bishopfox/sliver/client/command/hosts" @@ -146,6 +147,57 @@ func ServerCommands(con *client.SliverConsoleClient, serverCmds func() []*cobra. carapace.Gen(aliasRemove).PositionalCompletion(alias.AliasCompleter()) aliasCmd.AddCommand(aliasRemove) + // [ Extensions ] --------------------------------------------- + + extCmd := &cobra.Command{ + Use: consts.ExtensionsStr, + Short: "List current exts", + Long: help.GetHelpFor([]string{consts.ExtensionsStr}), + Run: func(cmd *cobra.Command, args []string) { + extensions.ExtensionsCmd(cmd, con) + }, + GroupID: consts.GenericHelpGroup, + } + server.AddCommand(extCmd) + + extLoadCmd := &cobra.Command{ + Use: consts.LoadStr + " [EXT]", + Short: "Load a command EXT", + Long: help.GetHelpFor([]string{consts.ExtensionsStr, consts.LoadStr}), + Args: cobra.ExactArgs(1), + Run: func(cmd *cobra.Command, args []string) { + extensions.ExtensionLoadCmd(cmd, con, args) + }, + } + carapace.Gen(extLoadCmd).PositionalCompletion( + carapace.ActionDirectories().Tag("ext directory").Usage("path to the ext directory")) + extCmd.AddCommand(extLoadCmd) + + extInstallCmd := &cobra.Command{ + Use: consts.InstallStr + " [EXT]", + Short: "Install a command ext", + Long: help.GetHelpFor([]string{consts.ExtensionsStr, consts.InstallStr}), + Args: cobra.ExactArgs(1), + Run: func(cmd *cobra.Command, args []string) { + extensions.ExtensionsInstallCmd(cmd, con, args) + }, + } + carapace.Gen(extInstallCmd).PositionalCompletion(carapace.ActionFiles().Tag("ext file")) + extCmd.AddCommand(extInstallCmd) + + extendo := &cobra.Command{ + Use: consts.RmStr + " [EXT]", + Short: "Remove an ext", + Long: help.GetHelpFor([]string{consts.RmStr}), + Args: cobra.ExactArgs(1), + Run: func(cmd *cobra.Command, args []string) { + //alias.AliasesRemoveCmd(cmd, con, args) + extensions.ExtensionsRemoveCmd(cmd, con, args) + }, + } + carapace.Gen(extendo).PositionalCompletion(carapace.ActionFiles().Tag("ext I guess?")) + extCmd.AddCommand(extendo) + // [ Armory ] --------------------------------------------- armoryCmd := &cobra.Command{ diff --git a/client/command/sliver.go b/client/command/sliver.go index 11e36501ea..bd52cb5559 100644 --- a/client/command/sliver.go +++ b/client/command/sliver.go @@ -19,6 +19,8 @@ package command */ import ( + "fmt" + "github.com/reeflective/console" "github.com/rsteube/carapace" "github.com/spf13/cobra" @@ -97,10 +99,12 @@ func SliverCommands(con *client.SliverConsoleClient) console.Commands { mext, err := extensions.LoadExtensionManifest(manifest) // Absorb error in case there's no extensions manifest if err != nil { - con.PrintErrorf("Failed to load extension: %s", err) + //con doesn't appear to be initialised here? + //con.PrintErrorf("Failed to load extension: %s", err) + fmt.Printf("Failed to load extension: %s\n", err) continue } - for _, ext := range mext { + for _, ext := range mext.ExtCommand { extensions.ExtensionRegisterCommand(ext, sliver, con) } }