File tree Expand file tree Collapse file tree 1 file changed +27
-2
lines changed
Expand file tree Collapse file tree 1 file changed +27
-2
lines changed Original file line number Diff line number Diff line change 1+ import pathlib
12import click
23
4+ from sigma .collection import SigmaCollection
5+ from sigma .exceptions import SigmaError
6+
37@click .command ()
4- def check ():
8+ @click .option (
9+ "--file-pattern" , "-P" ,
10+ default = "*.yml" ,
11+ show_default = True ,
12+ help = "Pattern for file names to be included in recursion into directories." ,
13+ )
14+ @click .argument (
15+ "input" ,
16+ nargs = - 1 ,
17+ type = click .Path (exists = True , path_type = pathlib .Path ),
18+ )
19+ def check (input , file_pattern ):
520 """Check Sigma rules for validity and best practices (not yet implemented)."""
6- pass
21+ try :
22+ rule_collection = SigmaCollection .load_ruleset (
23+ input ,
24+ recursion_pattern = "**/" + file_pattern ,
25+ collect_errors = True ,
26+ )
27+ for rule in rule_collection .rules :
28+ for error in rule .errors :
29+ click .echo (error )
30+ except SigmaError as e :
31+ click .echo ("Check error: " + str (e ), err = True )
You can’t perform that action at this time.
0 commit comments