From f48b9f220b6fddd8a44497c8e4e215d0a0982243 Mon Sep 17 00:00:00 2001 From: Jose Hernandez Date: Thu, 6 Feb 2025 12:25:23 -0500 Subject: [PATCH 1/6] because we care --- contentctl/contentctl.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/contentctl/contentctl.py b/contentctl/contentctl.py index d5864eb7..98ad8ed9 100644 --- a/contentctl/contentctl.py +++ b/contentctl/contentctl.py @@ -1,4 +1,5 @@ import pathlib +import random import sys import traceback import warnings @@ -155,6 +156,24 @@ def test_common_func(config: test_common): """ +def get_random_compliment(): + compliments = [ + "Your code is as elegant as a perfectly balanced binary tree! 🌳", + "You're the human equivalent of well-documented code! ⭐", + "Bug-free code? Must be your work! 🚀", + "You make debugging look like an art form! 🎨", + "Your commits are poetry in motion! 📝", + "You're the exception handler of excellence! 🛡️", + "Your code reviews are legendary! 👑", + "You're the MVP of the repository! 🏆", + ] + return random.choice(compliments) + + +def recognize_func(): + print(get_random_compliment()) + + def main(): print(CONTENTCTL_5_WARNING) try: @@ -210,6 +229,7 @@ def main(): "test_servers": test_servers.model_construct(**t.__dict__), "release_notes": release_notes.model_construct(**config_obj), "deploy_acs": deploy_acs.model_construct(**t.__dict__), + "recognize": tyro.conf.Subcommand(), } ) @@ -240,6 +260,8 @@ def main(): deploy_acs_func(updated_config) elif type(config) is test or type(config) is test_servers: test_common_func(config) + elif type(config) is tyro.conf.Subcommand: + recognize_func() else: raise Exception(f"Unknown command line type '{type(config).__name__}'") except FileNotFoundError as e: From f81e40ae3221d27efe068cc71804997428561ad5 Mon Sep 17 00:00:00 2001 From: Jose Hernandez Date: Thu, 6 Feb 2025 12:26:04 -0500 Subject: [PATCH 2/6] because we care --- contentctl/contentctl.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/contentctl/contentctl.py b/contentctl/contentctl.py index 98ad8ed9..1a7822f9 100644 --- a/contentctl/contentctl.py +++ b/contentctl/contentctl.py @@ -158,14 +158,18 @@ def test_common_func(config: test_common): def get_random_compliment(): compliments = [ - "Your code is as elegant as a perfectly balanced binary tree! 🌳", - "You're the human equivalent of well-documented code! ⭐", - "Bug-free code? Must be your work! 🚀", - "You make debugging look like an art form! 🎨", - "Your commits are poetry in motion! 📝", - "You're the exception handler of excellence! 🛡️", - "Your code reviews are legendary! 👑", - "You're the MVP of the repository! 🏆", + "Your detection rules are like a zero-day shield! 🛡️", + "You catch threats like it's child's play! 🎯", + "Your correlation rules are pure genius! 🧠", + "Threat actors fear your detection engineering! ⚔️", + "You're the SOC's secret weapon! 🦾", + "Your false positive rate is impressively low! 📊", + "Malware trembles at your detection logic! 🦠", + "You're the threat hunter extraordinaire! 🔍", + "Your MITRE mappings are a work of art! 🎨", + "APTs have nightmares about your detections! 👻", + "Your content testing is bulletproof! 🎯", + "You're the detection engineering MVP! 🏆", ] return random.choice(compliments) From fc02ad3c5fae4c93f7c6834b688b218e00c511d9 Mon Sep 17 00:00:00 2001 From: Nasreddine Bencherchali Date: Thu, 6 Feb 2025 18:33:35 +0100 Subject: [PATCH 3/6] Update contentctl.py --- contentctl/contentctl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contentctl/contentctl.py b/contentctl/contentctl.py index 1a7822f9..12fe5465 100644 --- a/contentctl/contentctl.py +++ b/contentctl/contentctl.py @@ -233,7 +233,7 @@ def main(): "test_servers": test_servers.model_construct(**t.__dict__), "release_notes": release_notes.model_construct(**config_obj), "deploy_acs": deploy_acs.model_construct(**t.__dict__), - "recognize": tyro.conf.Subcommand(), + "recognize": tyro.conf.subcommand(), } ) @@ -264,7 +264,7 @@ def main(): deploy_acs_func(updated_config) elif type(config) is test or type(config) is test_servers: test_common_func(config) - elif type(config) is tyro.conf.Subcommand: + elif type(config) is tyro.conf.subcommand: recognize_func() else: raise Exception(f"Unknown command line type '{type(config).__name__}'") From 1daa8bc68a9efba2f71dc0d93255bad1f2f5f7f5 Mon Sep 17 00:00:00 2001 From: Jose Hernandez Date: Thu, 6 Feb 2025 12:34:51 -0500 Subject: [PATCH 4/6] fixing errors --- contentctl/contentctl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contentctl/contentctl.py b/contentctl/contentctl.py index 1a7822f9..13e2e1c6 100644 --- a/contentctl/contentctl.py +++ b/contentctl/contentctl.py @@ -233,7 +233,7 @@ def main(): "test_servers": test_servers.model_construct(**t.__dict__), "release_notes": release_notes.model_construct(**config_obj), "deploy_acs": deploy_acs.model_construct(**t.__dict__), - "recognize": tyro.conf.Subcommand(), + "recognize": tyro.conf.subcommand(), # type: ignore } ) From 9ff5e2d4b7f18aaf5f3dc9cb6b88cfbd27ebf680 Mon Sep 17 00:00:00 2001 From: Jose Hernandez Date: Thu, 6 Feb 2025 12:37:22 -0500 Subject: [PATCH 5/6] fixing more errors --- contentctl/contentctl.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/contentctl/contentctl.py b/contentctl/contentctl.py index 13e2e1c6..ff1e0628 100644 --- a/contentctl/contentctl.py +++ b/contentctl/contentctl.py @@ -3,6 +3,7 @@ import sys import traceback import warnings +from dataclasses import dataclass import tyro @@ -178,6 +179,13 @@ def recognize_func(): print(get_random_compliment()) +@dataclass +class RecognizeCommand: + """Dummy subcommand for 'recognize' that requires no parameters.""" + + pass + + def main(): print(CONTENTCTL_5_WARNING) try: @@ -233,7 +241,7 @@ def main(): "test_servers": test_servers.model_construct(**t.__dict__), "release_notes": release_notes.model_construct(**config_obj), "deploy_acs": deploy_acs.model_construct(**t.__dict__), - "recognize": tyro.conf.subcommand(), # type: ignore + "recognize": RecognizeCommand(), # Use the dummy subcommand } ) @@ -264,7 +272,7 @@ def main(): deploy_acs_func(updated_config) elif type(config) is test or type(config) is test_servers: test_common_func(config) - elif type(config) is tyro.conf.Subcommand: + elif isinstance(config, RecognizeCommand): recognize_func() else: raise Exception(f"Unknown command line type '{type(config).__name__}'") From 40e07bf3627b514891e008a4d8ecae92e7f4ad23 Mon Sep 17 00:00:00 2001 From: Jose Hernandez Date: Thu, 6 Feb 2025 12:41:53 -0500 Subject: [PATCH 6/6] tyro shake fist --- contentctl/contentctl.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contentctl/contentctl.py b/contentctl/contentctl.py index d4a8bcbf..2541dd5d 100644 --- a/contentctl/contentctl.py +++ b/contentctl/contentctl.py @@ -181,7 +181,7 @@ def recognize_func(): @dataclass class RecognizeCommand: - """Dummy subcommand for 'recognize' that requires no parameters.""" + """Dummy subcommand for 'recognize' with no parameters.""" pass @@ -241,7 +241,7 @@ def main(): "test_servers": test_servers.model_construct(**t.__dict__), "release_notes": release_notes.model_construct(**config_obj), "deploy_acs": deploy_acs.model_construct(**t.__dict__), - "recognize": tyro.conf.subcommand(), + "recognize": RecognizeCommand(), } ) @@ -272,7 +272,7 @@ def main(): deploy_acs_func(updated_config) elif type(config) is test or type(config) is test_servers: test_common_func(config) - elif type(config) is tyro.conf.subcommand: + elif type(config) is RecognizeCommand: recognize_func() else: raise Exception(f"Unknown command line type '{type(config).__name__}'")