Documentation ¶
Overview ¶
httpservefile c2 spawns an HTTP or HTTPS server and hosts arbitrary user-provided files. The normal use case is for an exploit to curl/wget the file and execute it. This is useful to spawn connections to other tools (e.g. Metasploit, nc, etc.) or to go-exploit. This is not a traditional "c2" but serves as a useful backend that logically plugs into our c2 design.
Files are provided on the command line as a comma delimited string. For example:
-httpServeFile.FilesToServe ./build/reverse_shell_windows-arm64.exe,./build/reverse_shell_linux-amd64
The above will load two files: a windows reverse shell and a linux reverse shell. This c2 will then generate random names for the files and host them on an HTTP / HTTPS server. To interact with the files from an implementing exploit, you can fetch the filename to random name mapping using GetRandomName(). For example:
httpservefile.GetInstance().GetRandomName(linux64)
Where linux64 is a variable that contains "reverse_shell_linux-amd64".
If you are only hosting one file, then GetRandom("") will also return your one file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HostedFile ¶ added in v1.3.0
type Server ¶
type Server struct { // The HTTP address to bind to HTTPAddr string // The HTTP port to bind to HTTPPort int // Set to the Server field in HTTP response ServerField string // Indicates if TLS should be enabled TLS bool // The file path to the user provided private key (if provided) PrivateKeyFile string // The file path to the user provided certificate (if provided) CertificateFile string // Loaded certificate Certificate tls.Certificate // A map of hosted files HostedFiles map[string]HostedFile // RealName -> struct // A comma delimited list of all the files to serve FilesToServe string }
func (*Server) CreateFlags ¶
func (httpServer *Server) CreateFlags()
User options for serving a file over HTTP as the "c2".
func (*Server) GetRandomName ¶ added in v1.3.0
Returns the random name of the provided filename. If filename is empty, return the first entry.