Skip to content

Commit 67eac5a

Browse files
authored
Merge pull request #259 from vulncheck-oss/fixfileserve
Fixes stand-alone fileserve
2 parents dc85a28 + 807c185 commit 67eac5a

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

c2/httpservefile/httpservefile.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,21 @@ func (httpServer *Server) Init(channel channel.Channel) bool {
101101

102102
return false
103103
}
104-
httpServer.HTTPAddr = channel.HTTPAddr
105-
httpServer.HTTPPort = channel.HTTPPort
104+
105+
switch {
106+
case channel.HTTPPort == 0 && channel.Port != 0:
107+
// must be stand-alone invocation of HTTPServeFile
108+
httpServer.HTTPAddr = channel.IPAddr
109+
httpServer.HTTPPort = channel.Port
110+
case channel.HTTPPort != 0:
111+
// must be used with another C2
112+
httpServer.HTTPAddr = channel.HTTPAddr
113+
httpServer.HTTPPort = channel.HTTPPort
114+
default:
115+
output.PrintFrameworkError("Called HTTPServeFile without specifying a bind port.")
116+
117+
return false
118+
}
106119

107120
// split the provided files, read them in, and store them in the map
108121
files := strings.Split(httpServer.FilesToServe, ",")

0 commit comments

Comments
 (0)