Skip to content

Commit

Permalink
Outlined major refactor of client/
Browse files Browse the repository at this point in the history
  • Loading branch information
moloch-- committed Jul 3, 2021
1 parent f318c00 commit b8671cc
Show file tree
Hide file tree
Showing 40 changed files with 8,566 additions and 8,627 deletions.
26 changes: 25 additions & 1 deletion client/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ import (
"path"

"github.com/bishopfox/sliver/client/assets"
"github.com/bishopfox/sliver/client/command"
"github.com/bishopfox/sliver/client/console"
"github.com/bishopfox/sliver/client/transport"
"github.com/bishopfox/sliver/client/version"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -69,13 +71,35 @@ var rootCmd = &cobra.Command{
defer logFile.Close()

os.Args = os.Args[:1] // Stops grumble from complaining
err := console.StartClientConsole()
err := StartClientConsole()
if err != nil {
fmt.Printf("[!] %s\n", err)
}
},
}

// StartClientConsole - Start the client console
func StartClientConsole() error {
configs := assets.GetConfigs()
if len(configs) == 0 {
fmt.Printf("No config files found at %s or -import\n", assets.GetConfigDir())
return nil
}
config := selectConfig()
if config == nil {
return nil
}

fmt.Printf("Connecting to %s:%d ...\n", config.LHost, config.LPort)
rpc, ln, err := transport.MTLSConnect(config)
if err != nil {
fmt.Printf("Connection to server failed %v", err)
return nil
}
defer ln.Close()
return console.Start(rpc, command.BindCommands, func(*console.SliverConsoleClient) {}, false)
}

// Execute - Execute root command
func Execute() {
if err := rootCmd.Execute(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion client/console/console-cfg.go → client/cli/config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package console
package cli

/*
Sliver Implant Framework
Expand Down
Loading

0 comments on commit b8671cc

Please sign in to comment.