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

     1  package common
     2  
     3  import (
     4  	"errors"
     5  	"fmt"
     6  	"strconv"
     7  
     8  	"github.com/Coalfire-Research/Slackor/internal/config"
     9  	"github.com/Coalfire-Research/Slackor/pkg/command"
    10  )
    11  
    12  // Beacon changes the polling frequency
    13  type Beacon struct{}
    14  
    15  // Name is the name of the command
    16  func (b Beacon) Name() string {
    17  	return "beacon"
    18  }
    19  
    20  // Run changes the polling frequency
    21  func (b Beacon) Run(clientID string, jobID string, args []string) (string, error) {
    22  	if len(args) != 1 {
    23  		return "", errors.New("beacon takes 1 argument")
    24  	}
    25  	config.Beacon, _ = strconv.Atoi(args[0])
    26  	return fmt.Sprintf("Implant will now poll every %d second(s).", config.Beacon), nil
    27  }
    28  
    29  func init() {
    30  	command.RegisterCommand(Beacon{})
    31  }