Parameters

Every command is different – some take no parameters, some take arrays, strings, integers, or a number of other things. To help accommodate this, you can add parameters to commands so that operators know what they need to be providing. You must give each parameter a name and they must be unique within that command. You can also indicate if the parameter is required or not.

You can then specify what type of parameter it is from the following:

  • String

  • Credential

  • Number

  • Array

  • Boolean

  • Choose One

  • Choose Many

  • File

If you choose String, then you can provide a hint which is just placeholder text to help describe what the operator should be putting there (like a file path for example). If you choose Credential, then you’ll be able to select a field from any of the current credentials stored for the operation (more on this later). If you select one of the Choose options, then you provide choices (one per line) that the user can select from. Lastly, if you choose File, then the user will be allowed to upload a file via the GUI when you type out the command. In this case, the file is uploaded, registered in the database, and given a file_id number – this number is then what gets passed to the agent.

If a command takes named parameters, but none are supplied on the command line, a GUI modal will pop up to assist the operator.

If a command takes named parameters, then they should be passed in via a JSON string. In order to prevent Apfell from having to do potentially problematic command line parsing, the structured format of JSON reduces ambiguity.

If a command takes parameters, and something is provided on the command line, Apfell does NOT do any checking to make sure you provide the right information in the right format. This is meant simply as a well to help operators

There is no absolute requirement that the input parameters be in JSON format, it's just recommended. For the above upload command, you're allowed to type upload -RemotePath "/Users/test/upload.png" -FileID 5 or upload /users/test/upload.png 5 or any other format you want, but you must make sure that the agent you're tasking knows how to parse what you supply. The native Apfell agents for example, expect JSON strings and will fail to parse it if you provide anything else.

Last updated