workflows


Workflows examples
The examples within this folder focus on leveraging CrowdStrike's Falcon Falcon Fusion SOAR API.
Workflow Manager (Terminal version)
This sample demonstrates how to leverage the Workflows API to provide the following functionality:
List all workflows
Execute a workflow
List all executions for a workflow
Print the results of a workflow execution
Import a workflow
Export a workflow
Running the program
In order to run this demonstration, you you will need access to CrowdStrike API keys with the following scopes:
Workflows
READ, WRITE
Required packages
In order to run this sample, you will need to have the tabulate and termcolor packages installed.
Execution syntax
This sample leverages simple command-line arguments to implement functionality.
Basic usage
Execute the default example. This will default to listing all workflows discovered in tabular format.
[!TIP] This sample supports Environment Authentication, meaning you can execute any of the command lines shown below without providing credentials if you have the values
FALCON_CLIENT_IDandFALCON_CLIENT_SECRETdefined in your environment.
Change the CrowdStrike region with the -b argument.
Execute a workflow using a custom payload.
List all executions of a workflow using the -le argument.
Retrieve the results of an execution with the -g argument.
Export a workflow to a local YAML file using the -ex argument.
[!NOTE] Exporting to an existing file will overwrite it's contents.
Import a workflow from a local YAML file using the -im argument.
[!NOTE] If the workflow name defined within your workflow YAML file exists within your tenant, an error will be thrown. Use the
-nargument to import this file as a new workflow with a new name.
[!TIP] You can validate this workflow import without saving by providing the
-vargument with the above command.
API debugging can be enabled using the -d argument.
Adjust the output table format using the -t argument.
Swap to JSON output with the -j argument.
Command-line help
Command-line help is available via the -h argument.
Example source code
The source code for this example can be found here.
Workflow Manager (GUI version)
Running the program || Authentication || Basic Usage || Advanced Usage || Command-line help || Source Code
Like the sample above, this sample demonstrates how to leverage the Workflows API to provide the following functionality:

List all workflows
Execute a workflow
List all executions for a workflow
Print the results of a workflow execution
Import a workflow
Export a workflow
Additional functionality provided by this sample include:
Full GUI interface
Activity logging (to a local file)
Exporting list results to CSV
Running the program
In order to run this demonstration, you you will need access to CrowdStrike API keys with the following scopes:
Workflows
READ, WRITE
This application can be started using a simple command line without arguments.
Required packages
In order to run this sample, you will need to have the Gooey, requests and tabulate packages installed.
Authentication

API credentials can be specified on the Environment tab.
These will be pre-populated if provided by the command line or environment.
[!TIP] These values can be provided on the command line using the
-kand-sarguments or the--client_idand--client_secretarguments. This sample also supports Environment Authentication, meaning these values will be pre-populated for you from the variablesFALCON_CLIENT_IDandFALCON_CLIENT_SECRETif they are present in the execution environment.
Basic Usage
The GUI workflow manager application supports all of the same command functionality provided by the terminal version.
Listing workflows

To retrieve a list of all workflows within the tenant, select list_workflows on the Command tab.
Listing all workflows within the tenant requires no additional parameters (beyond authentication).
[!NOTE] This is the default command when no command is specified.

Results will be shown in a console window.
[!TIP] Review advanced configuration options below for more detail regarding table formatting and outputting results to CSV.
Executing a workflow

To execute a workflow, first select the execute action on the Command tab.

Provide the workflow definition ID of the workflow to execute in the id field on the Workflow tab.

If authentication credentials are provided via the command line or detected within the environment, the application will attempt to display a dropdown of all available workflows.
[!TIP] Bypass this behavior by providing the
-skor--skip_preflightcommand line argument when starting the application.

The dropdown is editable and will accept custom values.

Once your ID has been specified, provide the necessary execution payload for the workflow in the payload field.

Clicking the Start button will execute the options specified and display the results to the console.
Retrieving all executions for a workflow

Select the list_executions option on the Command tab to begin.

Provide the desired workflow definition ID in the id field on the Workflow tab.

Clicking the Start button will execute the search.
Results are displayed to the console.
Getting the results of a workflow execution

To retrieve results for a specific execution, first select the get_result option on the Command tab.

Provide the Workflow execution ID in the execution_id field on the Workflow tab.

To return results in indented JSON format, select the json option on the Environment tab.

Clicking the Start button will execute the request using the specified options and display the results to the console.
[!NOTE] Device IDs were redacted for this screen shot but are typically shown by the application.
Exporting a workflow to a YAML file

Select the workflow_export option on the Command tab.

Provide the desired workflow definition ID in the id field on the Workflow tab.

Use the export_workflow field on the Export tab to specify the save file for the export.

This file will be saved in YAML format.

The Browse button may be used to specify this value.

Clicking the Start button will export the selected workflow to the specified file.
If this file already exists, it will be overwritten.
Importing a workflow from a YAML file

Select the workflow_import option on the Command tab.

On the Import tab, provide the location of the workflow template YAML file in the import_workflow field.

The Browse button can be used to search and select the desired workflow template to import.

If the workflow name defined within the YAML file already exists in your tenant, an error will be thrown.
You can specify a new name for this workflow using the workflow_name field.

Use the validate checkbox to specify that this workflow will be validated for successful import, but no action will be taken.

Clicking the Start button will begin the import as specified.
Results will be displayed to the console upon completion.
Advanced Usage

There are several advanced options that can be specified on the Environment tab or via the command line.
Formatting output

Specify the json option to output results in formatted JSON.

Different table formats may be selected using the table_format dropdown.

Output can compressed in the console to display when running multiple executions with the compress_output option.
Exporting list results to CSV

Select the csv option in the table_format dropdown field to export list results to CSV for the list_workflows and list_executions commands.
Results will be saved to workflows.csv or workflow_executions.csv depending on the operation selected.
Execution results are still displayed to the console using the simple table format when the Start button is pressed.
Providing configuration via the command line
Configuration options may be specified on the command line when starting the application. These values will be pre-populated on the configuration form. Command line provided configuration options take precedence over values specified as defaults or detected within the running environment.
Specifying the list executions command option and a workflow definition ID
Importing a workflow using the command line
Adjusting the console display font size
The font point size for the console display can be adjusted using a positional command line argument. This value should be an integer.
[!NOTE] Positional command line arguments may be mixed with named arguments.
Auto-starting execution via the command line
Execution can be triggered at runtime by providing the go positional argument.
[!NOTE] The font size and auto-execution positional arguments can be mixed together along with named arguments. When using font size and auto-execution together, the font size should be specified first.
Debugging API activity

Select the debug option to enable API debugging.
This will show detailed information regarding interactions performed with the CrowdStrike Falcon API, listing endpoints used, payloads provided, and responses received.
Logging results

To keep a separate log file of all results produced by the application, use the logfile field.

The Browse button can be used to select the log file.

[!WARNING] If this file exists, you may be prompted to replace the existing file.
This is a known issue. Log files will not be overwritten. Instead, results will be appended to the bottom of the file regardless of the operating system message.
Command-line help
Command-line help is available via the -h argument.
Example source code
The source code for this example can be found here.
Last updated
Was this helpful?