summaryrefslogtreecommitdiff
path: root/src/rost.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2023-09-25 23:50:02 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2023-09-25 23:50:02 (GMT)
commit2f740fc8aa705df046a6d32fc98e2787df0e47e1 (patch)
tree5c348351ca39312cb5a54a5c88e95859fe0b7579 /src/rost.c
parent4c13ca820e4fa01ca62ad66c0665ebbee150f87c (diff)
Handle tags linked to ROST rules.
Diffstat (limited to 'src/rost.c')
-rw-r--r--src/rost.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/rost.c b/src/rost.c
index efe18e5..8a7e806 100644
--- a/src/rost.c
+++ b/src/rost.c
@@ -91,11 +91,12 @@ static void show_rost_help(const char *name)
printf("\n");
- printf("\t-A --algorithm=name\tSelect one of the available algorithms for data: bitmap, acism (default: acsim).\n");
+ printf("\t-A --algorithm=NAME\tSelect one of the available algorithms for data: bitmap, acism (default: acsim).\n");
printf("\t-C --check-only\t\tValidate the rule syntax without performing a scan (discard the file/dir argument).\n");
- printf("\t-j --print-json\t\tPrint matching strings in JSON format.\n");
- printf("\t-s --print-strings\tPrint matching strings.\n");
+ printf("\t-j --print-json\t\tPrint matching strings in JSON format instead of simple text.\n");
+ printf("\t-s --print-strings\tPrint matching strings (default text format only).\n");
printf("\t-S --print-stats\tPrint rules' statistics.\n");
+ printf("\t-t --tag=TAG\t\tprint only matching rules tagged as TAG (default text format only).\n");
printf("\t-V --verbosity=level\tSet the log level (0 for all messages, %u for none).\n", LMT_COUNT);
printf("\n");
@@ -240,6 +241,7 @@ int main(int argc, char **argv)
{ "print-json", no_argument, NULL, 'j' },
{ "print-strings", no_argument, NULL, 's' },
{ "print-stats", no_argument, NULL, 'S' },
+ { "tag", required_argument, NULL, 't' },
{ "verbosity", required_argument, NULL, 'V' },
{ NULL, 0, NULL, 0 }
};
@@ -260,7 +262,7 @@ int main(int argc, char **argv)
while (true)
{
- ret = getopt_long(argc, argv, "hvA:CjsSV:", long_options, &index);
+ ret = getopt_long(argc, argv, "hvA:CjsSt:V:", long_options, &index);
if (ret == -1) break;
switch (ret)
@@ -299,6 +301,10 @@ int main(int argc, char **argv)
g_scan_options_set_print_stats(options, true);
break;
+ case 't':
+ g_scan_options_select_tag(options, optarg);
+ break;
+
case 'V':
verbosity = strtoul(optarg, NULL, 10);
break;
@@ -310,7 +316,6 @@ int main(int argc, char **argv)
if ((check_only && (optind + 0) != argc && (optind + 1) != argc)
|| (!check_only && (optind + 1) != argc && (optind + 2) != argc))
{
- printf("failed: check=%d optind=%d argc=%d\n", check_only, optind, argc);
show_rost_help(argv[0]);
goto done;
}