Skip to content

Commit

Permalink
Merge pull request #59 from mitre/origin-link-fix
Browse files Browse the repository at this point in the history
Handle origin link ID as string
  • Loading branch information
uruwhy authored Oct 18, 2021
2 parents 3a3b826 + 9ed2ff3 commit 5e2ce57
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ type Agent struct {
exe_name string
paw string
initialDelay float64
originLinkID int
originLinkID string
hostIPAddrs []string
availableDataEncoders []string

Expand All @@ -89,7 +89,7 @@ type Agent struct {
}

// Set up agent variables.
func (a *Agent) Initialize(server string, tunnelConfig *contact.TunnelConfig, group string, c2Config map[string]string, enableLocalP2pReceivers bool, initialDelay int, paw string, originLinkID int) error {
func (a *Agent) Initialize(server string, tunnelConfig *contact.TunnelConfig, group string, c2Config map[string]string, enableLocalP2pReceivers bool, initialDelay int, paw string, originLinkID string) error {
host, err := os.Hostname()
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion agent/agent_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

// Creates and initializes a new Agent. Upon success, returns a pointer to the agent and nil Error.
// Upon failure, returns nil and an error.
func AgentFactory(server string, tunnelConfig *contact.TunnelConfig, group string, c2Config map[string]string, enableLocalP2pReceivers bool, initialDelay int, paw string, originLinkID int) (*Agent, error) {
func AgentFactory(server string, tunnelConfig *contact.TunnelConfig, group string, c2Config map[string]string, enableLocalP2pReceivers bool, initialDelay int, paw string, originLinkID string) (*Agent, error) {
newAgent := &Agent{}
if err := newAgent.Initialize(server, tunnelConfig, group, c2Config, enableLocalP2pReceivers, initialDelay, paw, originLinkID); err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ import (
)

// Initializes and returns sandcat agent.
func initializeCore(server string, tunnelConfig *contact.TunnelConfig, group string, contactConfig map[string]string, p2pReceiversOn bool, initialDelay int, verbose bool, paw string, originLinkID int) (*agent.Agent, error) {
func initializeCore(server string, tunnelConfig *contact.TunnelConfig, group string, contactConfig map[string]string, p2pReceiversOn bool, initialDelay int, verbose bool, paw string, originLinkID string) (*agent.Agent, error) {
output.SetVerbose(verbose)
output.VerbosePrint("Starting sandcat in verbose mode.")
return agent.AgentFactory(server, tunnelConfig, group, contactConfig, p2pReceiversOn, initialDelay, paw, originLinkID)
}

//Core is the main function as wrapped by sandcat.go
func Core(server string, tunnelConfig *contact.TunnelConfig, group string, delay int, contactConfig map[string]string, p2pReceiversOn bool, verbose bool, paw string, originLinkID int) {
func Core(server string, tunnelConfig *contact.TunnelConfig, group string, delay int, contactConfig map[string]string, p2pReceiversOn bool, verbose bool, paw string, originLinkID string) {
sandcatAgent, err := initializeCore(server, tunnelConfig, group, contactConfig, p2pReceiversOn, delay, verbose, paw, originLinkID)
if err != nil {
output.VerbosePrint(fmt.Sprintf("[-] Error when initializing agent: %s", err.Error()))
Expand Down
2 changes: 1 addition & 1 deletion sandcat.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func main() {
delay := flag.Int("delay", 0, "Delay starting this agent by n-seconds")
verbose := flag.Bool("v", false, "Enable verbose output")
listenP2P := flag.Bool("listenP2P", parsedListenP2P, "Enable peer-to-peer receivers")
originLinkID := flag.Int("originLinkID", 0, "Optionally set originating link ID")
originLinkID := flag.String("originLinkID", "", "Optionally set originating link ID")
tunnelProtocol := flag.String("tunnelProtocol", "", "C2 comms tunnel type to use.")
tunnelAddr := flag.String("tunnelAddr", "", "Address used to connect to or start the tunnel.")
tunnelUsername := flag.String("tunnelUser", "", "Username used to authenticate to the tunnel.")
Expand Down

0 comments on commit 5e2ce57

Please sign in to comment.