mirror of
https://github.com/BishopFox/sliver.git
synced 2026-11-07 17:08:13 -10:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
321da76fd9 |
No files matched your search
@@ -43,6 +43,7 @@ import (
|
||||
"github.com/bishopfox/sliver/client/command/sessions"
|
||||
"github.com/bishopfox/sliver/client/command/settings"
|
||||
sgn "github.com/bishopfox/sliver/client/command/shikata-ga-nai"
|
||||
"github.com/bishopfox/sliver/client/command/socks"
|
||||
"github.com/bishopfox/sliver/client/command/taskmany"
|
||||
"github.com/bishopfox/sliver/client/command/update"
|
||||
"github.com/bishopfox/sliver/client/command/use"
|
||||
@@ -105,6 +106,7 @@ func ServerCommands(con *client.SliverClient, serverCmds func() []*cobra.Command
|
||||
websites.Commands,
|
||||
wireguard.Commands,
|
||||
c2profiles.Commands,
|
||||
socks.RootCommands,
|
||||
)
|
||||
|
||||
// Payloads
|
||||
|
||||
@@ -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}
|
||||
}
|
||||
@@ -42,6 +42,8 @@ func SocksCmd(cmd *cobra.Command, con *console.SliverClient, args []string) {
|
||||
return socks[i].ID < socks[j].ID
|
||||
})
|
||||
|
||||
session := con.ActiveTarget.GetSession()
|
||||
|
||||
tw := table.NewWriter()
|
||||
tw.SetStyle(settings.GetTableStyle(con))
|
||||
tw.AppendHeader(table.Row{
|
||||
@@ -52,6 +54,10 @@ func SocksCmd(cmd *cobra.Command, con *console.SliverClient, args []string) {
|
||||
"Passwords",
|
||||
})
|
||||
for _, p := range socks {
|
||||
// if we're in an active session, just display socks proxies for the session
|
||||
if session != nil && session.ID != p.SessionID {
|
||||
continue
|
||||
}
|
||||
tw.AppendRow(table.Row{p.ID, p.SessionID, p.BindAddr, p.Username, p.Password})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user