Skip to content

Add Splunk detection query runner#1

Merged
amit-sll merged 7 commits intomasterfrom
amit/splunk-run-detection-queries
Feb 3, 2026
Merged

Add Splunk detection query runner#1
amit-sll merged 7 commits intomasterfrom
amit/splunk-run-detection-queries

Conversation

@amit-sll
Copy link

@amit-sll amit-sll commented Jan 27, 2026

Summary

  • Add run_detections.py for running SPL queries from security content detection YAML files against Splunk
  • Update total_replay.py and utility_helper.py with enhanced functionality
  • Add CLAUDE.md with project documentation
  • Add uv.lock for dependency management
  • Update .gitignore to exclude output directory
  • Update readme.md with documentation for the new detection runner tool

Test plan

  • Verify detection queries run correctly against Splunk
  • Confirm output directory is properly ignored by git
  • Review config changes
  • Test run_detections.py with various filter options

🤖 Generated with Claude Code


Note

Introduces repository guidance and tidies project configuration/ignores.

  • Add total_replay/CLAUDE.md with overview, setup, usage, and architecture notes for TOTAL-REPLAY
  • Add total_replay/.gitignore and extend root .gitignore to exclude total_replay/output/ and JSONL outputs
  • Update configuration/config.yml with real default paths, enable debug_print, and add splunk connection settings placeholders (host, username, password, hec_token) with documentation comments

Written by Cursor Bugbot for commit 86f8c25. This will update automatically on new commits. Configure here.

amit-sll and others added 3 commits January 27, 2026 01:34
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
replayed_yaml_cache_dir_name: replayed_yaml_cache
debug_print: False No newline at end of file
debug_print: True

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug mode accidentally left enabled in config

Low Severity

The debug_print setting was changed from False to True. This appears accidental because the CLAUDE.md documentation added in this same PR explicitly shows debug_print: False as the recommended configuration (line 74). Debug mode being enabled causes verbose output during execution, which is typically not desired for production/release configurations.

Fix in Cursor Fix in Web

amit-sll and others added 3 commits January 27, 2026 14:16
- Remove hardcoded credentials from config.yml
- Add .gitignore with .env and common Python patterns
- Credentials should now be set via environment variables or .env file

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Import and call load_dotenv() in run_detections.py
- Add python-dotenv dependency to pyproject.toml

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Import and call load_dotenv() to load .env file

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@staticmethod
def print_cyan_fg(msg):
print(Fore.CYAN + msg + Style.RESET_ALL)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ColorPrint class duplicated instead of importing existing utility

Medium Severity

The ColorPrint class in run_detections.py duplicates the existing ColorPrint class in utility/color_print.py. Both provide the same methods (print_info_fg, print_error_fg, print_warning_fg, print_success_fg, print_cyan_fg). The existing utility class should be imported with from utility.color_print import ColorPrint instead of redefining it.

Fix in Cursor Fix in Web

with open(file_path, "r") as f:
return yaml.safe_load(f)
except Exception as e:
return None
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DetectionRunner duplicates multiple UtilityHelper methods

Medium Severity

DetectionRunner re-implements several methods that already exist in UtilityHelper: normalized_args_tolist (line 74), load_config (line 78), read_config_settings (line 95), and read_yaml_file (line 142). These are near-identical implementations. The UtilityHelper class should be composed or extended rather than duplicating these utility methods.

Additional Locations (1)

Fix in Cursor Fix in Web

filtered.append(file_path)
break

return filtered
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YAML filtering logic duplicates existing search functionality

Medium Severity

The get_all_yaml_files, filter_by_name, filter_by_technique_id, filter_by_guid, and filter_by_analytic_story methods duplicate similar functionality in UtilityHelper.search_security_content and check_needed_yaml_field. Both traverse the security content directory and filter YAML files by name, technique ID, GUID, or analytic story using nearly identical matching logic.

Additional Locations (1)

Fix in Cursor Fix in Web

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@amit-sll amit-sll merged commit ad1146e into master Feb 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants