executeSpawnBeaconUnder spawns a beacon with specified PID as parent
(ctx context.Context, client *csclient.Client, beaconID string, action Action)
| 169 | |
| 170 | // executeSpawnBeaconUnder spawns a beacon with specified PID as parent |
| 171 | func (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 |
| 199 | func (e *Executor) executeInjectBeacon(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) { |
no test coverage detected