Skip to content

Commit abb370b

Browse files
committed
Initial implementation of ShellTunnel
1 parent 67eac5a commit abb370b

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

.golangci.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ linters:
5757
- importas
5858
- interfacebloat
5959
- intrange
60-
- lll
60+
#- lll
6161
- loggercheck
6262
- makezero
6363
- mirror
@@ -93,8 +93,6 @@ linters:
9393

9494

9595
linters-settings:
96-
lll:
97-
line-length: 160
9896
cyclop:
9997
max-complexity: 25
10098
issues:
@@ -111,10 +109,13 @@ issues:
111109
linters:
112110
- staticcheck
113111
text: SA1019
112+
- path: c2/shelltunnel/shelltunnel.go
113+
linters:
114+
- staticcheck
115+
text: SA1019
116+
- path: cli/commandline_test.go
117+
linters:
118+
- staticcheck
119+
text: SA1019
114120
exclude-files:
115-
- protocol/mikrotik/mikrotik_test.go
116121
- protocol/mikrotik/msg.go
117-
- protocol/rocketmq/remoting.go
118-
- protocol/payloads
119-
- cli/commandline_test.go
120-
- payload/wrapper_test.go

c2/factory.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"github.com/vulncheck-oss/go-exploit/c2/external"
66
"github.com/vulncheck-oss/go-exploit/c2/httpservefile"
77
"github.com/vulncheck-oss/go-exploit/c2/httpserveshell"
8+
"github.com/vulncheck-oss/go-exploit/c2/shelltunnel"
89
"github.com/vulncheck-oss/go-exploit/c2/simpleshell"
910
"github.com/vulncheck-oss/go-exploit/c2/sslshell"
1011
"github.com/vulncheck-oss/go-exploit/output"
@@ -35,6 +36,7 @@ const (
3536
HTTPServeFileCategory category = 3
3637
HTTPServeShellCategory category = 4
3738
ExternalCategory category = 5
39+
ShellTunnelCategory category = 6
3840
)
3941

4042
// Simplified names in order to keep the old calling convention and allow
@@ -45,6 +47,7 @@ var (
4547
SSLShellServer = internalSupported["SSLShellServer"]
4648
HTTPServeFile = internalSupported["HTTPServeFile"]
4749
HTTPServeShell = internalSupported["HTTPServeShell"]
50+
ShellTunnel = internalSupported["ShellTunnel"]
4851
// We do not want external to be called directly because external
4952
// internally is not useful.
5053
)
@@ -60,7 +63,8 @@ var internalSupported = map[string]Impl{
6063
"HTTPServeShell": {Name: "HTTPServeShell", Category: HTTPServeShellCategory},
6164
// Insure the internal supported External module name is an error if used
6265
// directly.
63-
"External": {Name: "", Category: InvalidCategory},
66+
"External": {Name: "", Category: InvalidCategory},
67+
"ShellTunnel": {Name: "ShellTunnel", Category: ShellTunnelCategory},
6468
}
6569

6670
// Add an external C2 to the supported list. Use this to integrate a new C2
@@ -99,6 +103,8 @@ func GetInstance(implementation Impl) (Interface, bool) {
99103
if implementation.Name != "" {
100104
return external.GetInstance(implementation.Name), true
101105
}
106+
case ShellTunnelCategory:
107+
return shelltunnel.GetInstance(), true
102108
case InvalidCategory:
103109
// Calling your external C2 as explicitly invalid is odd.
104110
output.PrintFrameworkError("Invalid C2 Server")
@@ -126,6 +132,8 @@ func CreateFlags(implementation Impl) {
126132
if implementation.Name != "" {
127133
external.GetInstance(implementation.Name).CreateFlags()
128134
}
135+
case ShellTunnelCategory:
136+
shelltunnel.GetInstance().CreateFlags()
129137
case InvalidCategory:
130138
// Calling your external C2 as explicitly invalid is odd.
131139
output.PrintFrameworkError("Invalid C2 Server")

docs/c2.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ In `go-exploit`, the command and control (C2) provides very basic second stage a
99
3. *SSLShellServer* - An encrypted shell via a reverse shell.
1010
4. *HTTPServeFile* - An HTTP server that serves a user provided file (e.g. to server a Meterpreter payload).
1111
5. *HTTPServeShell* - An HTTP server that serves a user provided binary that will connect back to the exploit for `SSLShellServer` or `SimpleShellServer`.
12+
6. *ShellTunnel* - A C2 that will catch a reverse shell, connect to a listener, and proxy the data between the two.
1213

1314
`go-exploit` also supports a `-o` option which means "The c2 is handled by an outside program so don't expect any type of connect back."
1415

0 commit comments

Comments
 (0)