Skip to content

Commit

Permalink
Merge pull request #693 from BishopFox/armory/all
Browse files Browse the repository at this point in the history
Added 'armory install all' option
  • Loading branch information
moloch-- authored May 29, 2022
2 parents 524bfdb + 6dfb64a commit 1d4422b
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions client/command/armory/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ package armory

import (
"errors"
"fmt"
"io/ioutil"
"net/url"
"os"
"path/filepath"

"github.com/AlecAivazis/survey/v2"
"github.com/bishopfox/sliver/client/command/alias"
"github.com/bishopfox/sliver/client/command/extensions"
"github.com/bishopfox/sliver/client/console"
Expand All @@ -45,6 +47,19 @@ func ArmoryInstallCmd(ctx *grumble.Context, con *console.SliverConsoleClient) {
}
clientConfig := parseArmoryHTTPConfig(ctx)
refresh(clientConfig)
if name == "all" {
aliases, extensions := packagesInCache()
confirm := false
prompt := &survey.Confirm{
Message: fmt.Sprintf("Install %d aliases and %d extensions?",
len(aliases), len(extensions),
),
}
survey.AskOne(prompt, &confirm)
if !confirm {
return
}
}
err := installPackageByName(name, clientConfig, con)
if err == nil {
return
Expand Down Expand Up @@ -73,17 +88,26 @@ func installBundle(bundle *ArmoryBundle, clientConfig ArmoryHTTPConfig, con *con
func installPackageByName(name string, clientConfig ArmoryHTTPConfig, con *console.SliverConsoleClient) error {
aliases, extensions := packagesInCache()
for _, alias := range aliases {
if alias.CommandName == name {
if alias.CommandName == name || name == "all" {
installAlias(alias, clientConfig, con)
return nil
if name != "all" {
return nil
}
}
}
for _, ext := range extensions {
if ext.CommandName == name {
if ext.CommandName == name || name == "all" {
installExtension(ext, clientConfig, con)
return nil
if name != "all" {
return nil
}
}
}
if name == "all" {
con.Printf("\n")
con.PrintInfof("All packages installed\n")
return nil
}
return ErrPackageNotFound
}

Expand Down

0 comments on commit 1d4422b

Please sign in to comment.