TypedArray
. This doesn’t apply to BuildParameters or C2Profile Parameters because you can only supply those values through the GUI or through scripting. When issuing tasks though, you generally have the option of using a modal popup window or freeform text. This typedarray_parse_function
is to help with parsing freeform text when issuing tasks.
TypedArray
parameter, the choices
attribute is the set of options presented to the user in the dropdowns for the modal and the default_value
attribute is the option that’s selected by default when the user adds a new array entry.TypedArray
provides two things from the operator to the agent - an array of values and a type for each value. This makes its way to the payload type containers during tasking and building as an array of arrays (ex: [ ["int", "5"], ["string", "hello"] ]
). However, nobody types like that on the command line when issuing tasks. That’s where this function comes into play.
Let’s say you have a command, my_bof
, with a TypedArray parameter called bof_args
. bof_args
has type options (i.e. the choices
of the parameter) of int
, wstring
, and char*
. When issuing this command on the command line, you’d want the operator to be able to issue something a bit easier than multiple nested arrays. Something like:
my_bof -bof_args int:5 char*:testing
on the command line and hits enter
my_bof -bof_args int:5 char*:testing
on the command line and hits SHIFT+enter to open up a modal dialog box. This will call your parsing function to turn that array into an array of arrays so that the modal dialog can display what the user has typed out so far.
bof_args
in this case, you just need to make sure that one of the following is true after you’re done parsing with either of these functions:
["int:5", "char*:testing"]
[ ["", "int:5"], ["", "char*:testing"] ]
parse_arguments
or parse_dictionary
function is called, the mythic_container code will check for any typed_array parameters and check their value. If the value is one of the above two instances, it’ll make it match what’s expected for the typedarray parse function, call your function, then automatically update the value.
""
displayed to the user, but the agents parameters
section will show you the final value after all the parsing happens. That’s where you’ll see the result of your parsing.