Phantasm
A test automation framework built for Splunk Phantom Playbooks. Allows for programatically testing and validating playbooks.
Install / Use
/learn @0x706972686f/PhantasmREADME
Phantasm
Phantasm is a library that has been developed for programmatic testing of Splunk Phantom playbooks. In doing so allowing for test-driven development as users develop playbooks.
It relies on the Django based REST API in Splunk Phantom to create containers, artifacts, upload files, run playbooks, run individual app actions, promote/demote a case to a container, delete a container and more. It returns the JSON response from each action, allowing the fields to be used in pytest.
Refer to demo.py to showcase the basic functionality of the library, or test_example.py file for a basic example that uses pytest to validate.
Configuration
Ensure you provide a valid ph-auth-token and phantom-url in the config.ini file.
Supported Functions
Each function is documented for further information:
# Get information relating to the object, including classes
print('{}').format(phantasm.__doc__)
print(help(phantasm))
# Get information relating to an individual function
print('{}').format(phantasm.create_container.__doc__)
print(help(phantasm.create_container))
Container Functions:
- create_container - Creates a new container
- update_container_status - Updates the container status
- update_container_tags - Adds a tag to the container
- get_container_artifacts - Retrieves the list of artifacts currently in the container
- promote_container_to_case - Promotes the current container to a case
- demote_case_to_container - Demotes the current case to a container
- delete_container - Deletes a container
Artifact Functions:
- add_artifact - Adds an artifact to a container
- upload_file_to_phantom - Uploads a file to a container
Playbook Functions:
- run_playbook - Runs a playbook against a container
- get_playbook_results - Retrieves the status of the playbook
- get_playbook_action_results - Retrieves the status of the last run action in the playbook
- get_application_id - Retrieves an application id
- run_action - Run an individual apps action (i.e: App: SMTP Action:
'test connectivity') - get_action_results - Retrieve the results of an action
- get_action_run_data - Retrieve the data of the action
- get_jira_ticket_data - Runs an action to retrieve all JIRA tickets.
Changelog:
- 2019-09-16: Re-wrote pytest example implementing fixtures, parameters and ordering.
- 2019-09-04: Minor fix to wait() function
- 2019-07-21: Initial Git Commit (untested)
Related Skills
node-connect
345.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
104.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
