×
Built-In: Python Node
Nevelex Labs Logo

Overview

The NL Python node executes the supplied Python script within a Python Virtual Environment. The Application Settings screen should be used to manage the Python virtual environment.

Functionality

The Python node exposes the following functionality:

  • Execute a python script via the NL Python node.

Flow Node

This node executes the supplied Python script defined in Python Script within a Python Virtual Environment. This node executes the supplied Python script defined in the Python Script field within a Python 3.6.x virtual environment. The script must be written with a function entry point called sfEntryPoint which accepts any value parsed from the Argument. The method must return a value. The value will be converted to a JSON string or left as the original value if the conversion fails via json.dumps.
Property
Description

Name

The display name of the node within the flows.


Argument

The default Argument is payload.ioc.


Python Script

The supplied python script is used by the Python Virtual Environment to execute the uncommented functions. The object provides helper functions for communicating with the Security Flow stack. The Python script must not be a long running script because the message will be blocked by the flow until the script completes.

The sample below includes commented out calls to the securityflow global instance.

    def sfEntryPoint( arg ):
    if not arg:
    raise Exception( ‘No argument provided’ )
    # Sample Security Flow Operations
    # securityflow.addNote( ‘This is my new note.’ )
    # securityflow.getPluginInstanceConfig( uniqueId=’azuread1′ )
    # securityflow.addMessageAudit( AuditCode.INFORMATION, ‘This is an informational message.’ )
    # securityflow.addMessageAudit( AuditCode.ERROR, ‘This is an error message.’ )
    # securityflow.addMessageAudit( AuditCode.UPDATE, ‘This is an update message.’, msgDiff={‘payload’: { ‘sample’: ‘sample update’ } } )
    return arg

API documentation for the securityflow global instance is detailed within the Security Flow’s NL-Python Programming Guide.


Output Field

Once the script runs, the function’s return value is inserted into the message within msg.payload at the designated Output Field location.

Learn More

API Documention

API documentation for the securityflow global instance variable is detailed within the Security Flow’s NL-Python Programming Guide.

Responses

Success

The italicized, green text is retrieved by the NL Python node.

{
  "payload": {
    "ioc": true
    "pyscript": true
  }
}

Error

When there is an error with the supplied python script a message will appear on the Incident Timeline.

Nevelex Labs, Main Office

Metro Office Park
2950 Metro Drive, Suite 104
Bloomington, MN 55425
Phone: +1 952-500-8921

©Nevelex Labs, LLC. 2018-2024, All Rights Reserved.

EULA