@@ -15,7 +15,7 @@ import (
15
15
"strings"
16
16
)
17
17
18
- const version = "2.0.24 "
18
+ const version = "2.0.25 "
19
19
20
20
var payloadDefinition = agentstructs.PayloadType {
21
21
Name : "poseidon" ,
@@ -88,6 +88,13 @@ var payloadDefinition = agentstructs.PayloadType{
88
88
ParameterType : agentstructs .BUILD_PARAMETER_TYPE_NUMBER ,
89
89
DefaultValue : 10 ,
90
90
},
91
+ {
92
+ Name : "static" ,
93
+ Description : "Statically compile the payload" ,
94
+ Required : false ,
95
+ ParameterType : agentstructs .BUILD_PARAMETER_TYPE_BOOLEAN ,
96
+ DefaultValue : false ,
97
+ },
91
98
},
92
99
BuildSteps : []agentstructs.BuildStep {
93
100
{
@@ -141,6 +148,12 @@ func build(payloadBuildMsg agentstructs.PayloadBuildMessage) agentstructs.Payloa
141
148
payloadBuildResponse .BuildStdErr = err .Error ()
142
149
return payloadBuildResponse
143
150
}
151
+ static , err := payloadBuildMsg .BuildParameters .GetBooleanArg ("static" )
152
+ if err != nil {
153
+ payloadBuildResponse .Success = false
154
+ payloadBuildResponse .BuildStdErr = err .Error ()
155
+ return payloadBuildResponse
156
+ }
144
157
failedConnectionCountThresholdString , err := payloadBuildMsg .BuildParameters .GetNumberArg ("failover_threshold" )
145
158
if err != nil {
146
159
payloadBuildResponse .Success = false
@@ -154,7 +167,12 @@ func build(payloadBuildMsg agentstructs.PayloadBuildMessage) agentstructs.Payloa
154
167
155
168
// Build Go link flags that are passed in at compile time through the "-ldflags=" argument
156
169
// https://golang.org/cmd/link/
157
- ldflags := fmt .Sprintf ("-s -w -X '%s.UUID=%s'" , poseidon_repo_profile , payloadBuildMsg .PayloadUUID )
170
+ ldflags := ""
171
+ if static {
172
+ ldflags += fmt .Sprintf ("-extldflags=-static -s -w -X '%s.UUID=%s'" , poseidon_repo_profile , payloadBuildMsg .PayloadUUID )
173
+ } else {
174
+ ldflags += fmt .Sprintf ("-s -w -X '%s.UUID=%s'" , poseidon_repo_profile , payloadBuildMsg .PayloadUUID )
175
+ }
158
176
ldflags += fmt .Sprintf (" -X '%s.debugString=%v'" , poseidon_repo_utils , debug )
159
177
ldflags += fmt .Sprintf (" -X '%s.egress_failover=%s'" , poseidon_repo_profile , egress_failover )
160
178
ldflags += fmt .Sprintf (" -X '%s.failedConnectionCountThresholdString=%v'" , poseidon_repo_profile , failedConnectionCountThresholdString )
@@ -259,6 +277,9 @@ func build(payloadBuildMsg agentstructs.PayloadBuildMessage) agentstructs.Payloa
259
277
goarch = "arm64"
260
278
}
261
279
tags := []string {}
280
+ if static {
281
+ tags = []string {"osusergo" , "netgo" }
282
+ }
262
283
for index , _ := range payloadBuildMsg .C2Profiles {
263
284
tags = append (tags , payloadBuildMsg .C2Profiles [index ].Name )
264
285
}
0 commit comments