MCPcopy Create free account
hub / github.com/Xenov-X/csbot / executeSpawnBeaconUnder

Method executeSpawnBeaconUnder

workflow/executor_spawn.go:171–196  ·  view source on GitHub ↗

executeSpawnBeaconUnder spawns a beacon with specified PID as parent

(ctx context.Context, client *csclient.Client, beaconID string, action Action)

Source from the content-addressed store, hash-verified

169
170// executeSpawnBeaconUnder spawns a beacon with specified PID as parent
171func (e *Executor) executeSpawnBeaconUnder(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) {
172 pidVal, ok := action.Parameters["pid"]
173 if !ok {
174 return "", fmt.Errorf("pid parameter required for spawn_beacon_under")
175 }
176 var pid int
177 switch v := pidVal.(type) {
178 case float64:
179 pid = int(v)
180 case int:
181 pid = v
182 default:
183 return "", fmt.Errorf("pid must be a number")
184 }
185
186 listener, ok := action.Parameters["listener"].(string)
187 if !ok {
188 return "", fmt.Errorf("listener parameter required for spawn_beacon_under")
189 }
190
191 resp, err := client.SpawnBeaconUnder(ctx, beaconID, pid, listener)
192 if err != nil {
193 return "", err
194 }
195 return e.waitForOutput(ctx, client, resp.TaskID)
196}
197
198// executeInjectBeacon injects beacon shellcode into a process
199func (e *Executor) executeInjectBeacon(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) {

Callers 1

executeActionMethod · 0.95

Calls 1

waitForOutputMethod · 0.95

Tested by

no test coverage detected