Skip to content

Commit

Permalink
make client work with updated manifest schema
Browse files Browse the repository at this point in the history
  • Loading branch information
C-Sto committed Sep 30, 2023
1 parent 7815b67 commit 4421ec1
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
52 changes: 52 additions & 0 deletions client/command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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{
Expand Down
8 changes: 6 additions & 2 deletions client/command/sliver.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package command
*/

import (
"fmt"

"github.com/reeflective/console"
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 4421ec1

Please sign in to comment.