executeSetPpid sets the parent process ID for the specified beacon
(ctx context.Context, client *csclient.Client, beaconID string, action Action)
| 138 | |
| 139 | // executeSetPpid sets the parent process ID for the specified beacon |
| 140 | func (e *Executor) executeSetPpid(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) { |
| 141 | ppidVal, ok := action.Parameters["ppid"] |
| 142 | if !ok { |
| 143 | return "", fmt.Errorf("ppid parameter required for set_ppid") |
| 144 | } |
| 145 | |
| 146 | var ppid int |
| 147 | switch v := ppidVal.(type) { |
| 148 | case float64: |
| 149 | ppid = int(v) |
| 150 | case int: |
| 151 | ppid = v |
| 152 | default: |
| 153 | return "", fmt.Errorf("ppid parameter must be a number") |
| 154 | } |
| 155 | |
| 156 | resp, err := client.SetPpid(ctx, beaconID, ppid) |
| 157 | if err != nil { |
| 158 | return "", err |
| 159 | } |
| 160 | return e.fireAndForget(resp.TaskID, fmt.Sprintf("set ppid %d", ppid)) |
| 161 | } |
| 162 | |
| 163 | // executeUnsetPpid unsets the parent process ID for the specified beacon |
| 164 | func (e *Executor) executeUnsetPpid(ctx context.Context, client *csclient.Client, beaconID string) (string, error) { |
no test coverage detected