diff --git a/client/command/alias/load.go b/client/command/alias/load.go index 5226271813..77e495620f 100644 --- a/client/command/alias/load.go +++ b/client/command/alias/load.go @@ -158,12 +158,13 @@ func LoadAlias(manifestPath string, con *console.SliverConsoleClient) (*AliasMan } helpMsg := fmt.Sprintf("[%s] %s", aliasManifest.Name, aliasManifest.Help) - helpMsg += "\n\n⚠️ If you're having issues passing arguments to the alias please read:\n" - helpMsg += "https://github.com/BishopFox/sliver/wiki/Aliases-&-Extensions#aliases-command-parsing" + longHelpMsg := help.FormatHelpTmpl(aliasManifest.LongHelp) + longHelpMsg += "\n\n⚠️ If you're having issues passing arguments to the alias please read:\n" + longHelpMsg += "https://github.com/BishopFox/sliver/wiki/Aliases-&-Extensions#aliases-command-parsing" addAliasCmd := &grumble.Command{ Name: aliasManifest.CommandName, Help: helpMsg, - LongHelp: help.FormatHelpTmpl(aliasManifest.LongHelp), + LongHelp: longHelpMsg, Run: func(extCtx *grumble.Context) error { con.Println() runAliasCommand(extCtx, con) diff --git a/client/command/armory/armory.go b/client/command/armory/armory.go index 1841979c28..d428a8fddc 100644 --- a/client/command/armory/armory.go +++ b/client/command/armory/armory.go @@ -315,9 +315,26 @@ func PrintArmoryBundles(bundles []*ArmoryBundle, con *console.SliverConsoleClien {Name: "Name", Mode: table.Asc}, }) for _, bundle := range bundles { + if len(bundle.Packages) < 1 { + continue + } + packages := bundle.Packages[0] + if 1 < len(packages) { + packages += ", " + } + for index, pkgName := range bundle.Packages[1:] { + if index%5 == 4 { + packages += pkgName + "\n" + } else { + packages += pkgName + if index != len(bundle.Packages)-2 { + packages += ", " + } + } + } tw.AppendRow(table.Row{ bundle.Name, - strings.Join(bundle.Packages, ", "), + packages, }) } con.Printf("%s\n", tw.Render()) diff --git a/client/command/armory/parsers.go b/client/command/armory/parsers.go index 712284578e..3499e71e14 100644 --- a/client/command/armory/parsers.go +++ b/client/command/armory/parsers.go @@ -30,6 +30,7 @@ import ( "net/url" "path" "strings" + "time" "github.com/bishopfox/sliver/client/assets" "github.com/bishopfox/sliver/server/cryptography/minisign" @@ -416,6 +417,7 @@ func githubLatestTagParser(armoryPkg *ArmoryPackage, clientConfig ArmoryHTTPConf if err != nil { return "", fmt.Errorf("http get failed armory pkg url '%s': %s", armoryPkg.RepoURL, err) } + defer latestRedirect.Body.Close() if latestRedirect.StatusCode != http.StatusFound { return "", fmt.Errorf("unexpected response status (wanted 302) '%s': %s", armoryPkg.RepoURL, latestRedirect.Status) } @@ -455,9 +457,8 @@ func httpClient(config ArmoryHTTPConfig) *http.Client { Dial: (&net.Dialer{ Timeout: config.Timeout, }).Dial, - - Proxy: http.ProxyURL(config.ProxyURL), - + IdleConnTimeout: time.Millisecond, + Proxy: http.ProxyURL(config.ProxyURL), TLSHandshakeTimeout: config.Timeout, TLSClientConfig: &tls.Config{ InsecureSkipVerify: config.DisableTLSValidation, diff --git a/client/command/extensions/load.go b/client/command/extensions/load.go index 9d3521ddaa..4b021d9b6f 100644 --- a/client/command/extensions/load.go +++ b/client/command/extensions/load.go @@ -31,6 +31,7 @@ import ( "strings" "github.com/bishopfox/sliver/client/assets" + "github.com/bishopfox/sliver/client/command/help" "github.com/bishopfox/sliver/client/console" consts "github.com/bishopfox/sliver/client/constants" "github.com/bishopfox/sliver/client/core" @@ -58,6 +59,7 @@ type ExtensionManifest struct { OriginalAuthor string `json:"original_author"` RepoURL string `json:"repo_url"` Help string `json:"help"` + LongHelp string `json:"long_help"` Files []*extensionFile `json:"files"` Arguments []*extensionArgument `json:"arguments"` Entrypoint string `json:"entrypoint"` @@ -171,8 +173,9 @@ func ExtensionRegisterCommand(extCmd *ExtensionManifest, con *console.SliverCons loadedExtensions[extCmd.CommandName] = extCmd helpMsg := extCmd.Help extensionCmd := &grumble.Command{ - Name: extCmd.CommandName, - Help: helpMsg, + Name: extCmd.CommandName, + Help: helpMsg, + LongHelp: help.FormatHelpTmpl(extCmd.LongHelp), Run: func(extCtx *grumble.Context) error { con.Println() runExtensionCmd(extCtx, con) @@ -192,12 +195,15 @@ func ExtensionRegisterCommand(extCmd *ExtensionManifest, con *console.SliverCons defaultValue grumble.ArgOption ) switch arg.Type { - case "int", "short": + case "int", "integer", "short": argFunc = a.Int defaultValue = grumble.Default(0) case "string", "wstring", "file": argFunc = a.String defaultValue = grumble.Default("") + default: + con.PrintErrorf("Invalid argument type: %s\n", arg.Type) + return } if arg.Optional { argFunc(arg.Name, arg.Desc, defaultValue) @@ -420,6 +426,8 @@ func getBOFArgs(ctx *grumble.Context, binPath string, ext *ExtensionManifest) ([ // Parse BOF arguments from grumble for _, arg := range ext.Arguments { switch arg.Type { + case "integer": + fallthrough case "int": val := ctx.Args.Int(arg.Name) err = argsBuffer.AddInt(uint32(val))