Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle origin link ID as string #59

Merged
merged 3 commits into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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