command

package
v1.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2024 License: GPL-3.0 Imports: 58 Imported by: 0

README

Command

This package contains all of the client command implementations that are shared between the client and the server console.

Developers

General guidance on the structure of this package:

  • One command per file and the name of the file should reflect the command it implements (or there about, trivial commands can go into the same file). This makes it easy to find where a command implementation lives within a package or to search by file name if it is not clear which package implements a given command.
  • The root command, and reused code should go into the file named after the command
    • For example, code shared between the generate and the regenerate command should go in generate.go, and any regenerate specific code should go in regenerate.go
  • Command entrypoint functions should have the suffix Cmd e.g., GenerateCmd is the entrypoint for generate
    • Command entrypoints should always a function signature of func (ctx *grumble.Context, con *console.SliverConsoleClient)
  • Functions that are only ever exported for other commands to use should go in a helpers.go, if the function is used internally and exported follow the guidance above on shared code.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bind

func Bind(name string, persistent bool, cmd *cobra.Command, flags func(f *pflag.FlagSet))

Bind is a convenience function to bind flags to a given command. name - The name of the flag set (can be empty). cmd - The command to which the flags should be bound. flags - A function exposing the flag set through which flags are declared.

func BindFlagCompletions

func BindFlagCompletions(cmd *cobra.Command, bind func(comp *carapace.ActionMap))

BindFlagCompletions is a convenience function for adding completions to a command's flags. cmd - The command owning the flags to complete. bind - A function exposing a map["flag-name"]carapace.Action.

func RestrictTargets

func RestrictTargets(filters ...string) map[string]string

RestrictTargets generates a cobra annotation map with a single console.CommandHiddenFilter key to a comma-separated list of filters to use in order to expose/hide commands based on requirements. Ex: cmd.Annotations = RestrictTargets("windows") will only show the command if the target is Windows. Ex: cmd.Annotations = RestrictTargets("windows", "beacon") show the command if target is a beacon on Windows.

func ServerCommands

func ServerCommands(con *client.SliverClient, serverCmds func() []*cobra.Command) console.Commands

ServerCommands returns all commands bound to the server menu, optionally accepting a function returning a list of additional (admin) commands.

func SliverCommands

func SliverCommands(con *client.SliverClient) console.Commands

SliverCommands returns all commands bound to the implant menu.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL