-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1704 from BishopFox/improve_socks_menu
Improve socks menu
- Loading branch information
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package socks | ||
|
||
import ( | ||
"github.com/bishopfox/sliver/client/command/flags" | ||
"github.com/bishopfox/sliver/client/command/help" | ||
"github.com/bishopfox/sliver/client/console" | ||
consts "github.com/bishopfox/sliver/client/constants" | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
"github.com/spf13/pflag" | ||
) | ||
|
||
// Commands returns the “ command and its subcommands. | ||
func RootCommands(con *console.SliverClient) []*cobra.Command { | ||
socksCmd := &cobra.Command{ | ||
Use: consts.Socks5Str, | ||
Short: "In-band SOCKS5 Proxy", | ||
Long: help.GetHelpFor([]string{consts.Socks5Str}), | ||
GroupID: consts.NetworkHelpGroup, | ||
Annotations: flags.RestrictTargets(consts.SessionCmdsFilter), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
SocksCmd(cmd, con, args) | ||
}, | ||
} | ||
flags.Bind("", true, socksCmd, func(f *pflag.FlagSet) { | ||
f.Int64P("timeout", "t", flags.DefaultTimeout, "grpc timeout in seconds") | ||
}) | ||
|
||
socksStopCmd := &cobra.Command{ | ||
Use: consts.StopStr, | ||
Short: "Stop a SOCKS5 proxy", | ||
Long: help.GetHelpFor([]string{consts.Socks5Str}), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
SocksStopCmd(cmd, con, args) | ||
}, | ||
} | ||
socksCmd.AddCommand(socksStopCmd) | ||
flags.Bind("", false, socksStopCmd, func(f *pflag.FlagSet) { | ||
f.Uint64P("id", "i", 0, "id of portfwd to remove") | ||
}) | ||
flags.BindFlagCompletions(socksStopCmd, func(comp *carapace.ActionMap) { | ||
(*comp)["id"] = SocksIDCompleter(con) | ||
}) | ||
|
||
return []*cobra.Command{socksCmd} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters