summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2023-09-12 20:07:56 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2023-09-12 20:07:56 (GMT)
commitfef46dc1537e3302ac7bab653d24495c570e1d5c (patch)
treeef7c774bc03f6f23945d56980d40cad73bfd3455 /src/analysis
parent4875f28a2d1a44d6ddc860b51a78ad9800a95de7 (diff)
Introduce verbosity levels when displaying scan results as text.
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/scan/options.c2
-rw-r--r--src/analysis/scan/rule.c8
-rw-r--r--src/analysis/scan/rule.h2
-rw-r--r--src/analysis/scan/scanner.c5
-rw-r--r--src/analysis/scan/scanner.h2
5 files changed, 12 insertions, 7 deletions
diff --git a/src/analysis/scan/options.c b/src/analysis/scan/options.c
index cb56c2b..2147bb5 100644
--- a/src/analysis/scan/options.c
+++ b/src/analysis/scan/options.c
@@ -86,6 +86,8 @@ static void g_scan_options_init(GScanOptions *options)
{
options->data_backend = G_TYPE_INVALID;
+ options->print_json = false;
+ options->print_strings = false;
options->print_stats = false;
}
diff --git a/src/analysis/scan/rule.c b/src/analysis/scan/rule.c
index 7719e8a..4ef1e3c 100644
--- a/src/analysis/scan/rule.c
+++ b/src/analysis/scan/rule.c
@@ -525,6 +525,7 @@ void g_scan_rule_check(GScanRule *rule, GEngineBackend *backend, GScanContext *c
* *
* Paramètres : rule = règle de détection à considérer. *
* context = contexte de l'analyse à mener. *
+* full = force un affichage complet des résultats. *
* fd = canal d'écriture. *
* *
* Description : Affiche une règle au format texte. *
@@ -535,12 +536,13 @@ void g_scan_rule_check(GScanRule *rule, GEngineBackend *backend, GScanContext *c
* *
******************************************************************************/
-void g_scan_rule_output_to_text(const GScanRule *rule, GScanContext *context, int fd)
+void g_scan_rule_output_to_text(const GScanRule *rule, GScanContext *context, bool full, int fd)
{
size_t i; /* Boucle de parcours */
- for (i = 0; i < rule->bytes_used; i++)
- g_search_pattern_output_to_text(rule->bytes_locals[i], context, fd);
+ if (full)
+ for (i = 0; i < rule->bytes_used; i++)
+ g_search_pattern_output_to_text(rule->bytes_locals[i], context, fd);
if (g_scan_context_has_match_for_rule(context, rule->name))
{
diff --git a/src/analysis/scan/rule.h b/src/analysis/scan/rule.h
index 20a688c..7ade51b 100644
--- a/src/analysis/scan/rule.h
+++ b/src/analysis/scan/rule.h
@@ -81,7 +81,7 @@ bool g_scan_rule_setup_backend(GScanRule *, GEngineBackend *, GScanContext *);
void g_scan_rule_check(GScanRule *, GEngineBackend *, GScanContext *);
/* Affiche une règle au format texte. */
-void g_scan_rule_output_to_text(const GScanRule *, GScanContext *, int);
+void g_scan_rule_output_to_text(const GScanRule *, GScanContext *, bool, int);
/* Convertit une règle en texte. */
void g_scan_rule_convert_as_text(const GScanRule *, GScanContext *);
diff --git a/src/analysis/scan/scanner.c b/src/analysis/scan/scanner.c
index b550b1f..29f47eb 100644
--- a/src/analysis/scan/scanner.c
+++ b/src/analysis/scan/scanner.c
@@ -526,6 +526,7 @@ GScanContext *g_content_scanner_analyze(GContentScanner *scanner, GScanOptions *
* *
* Paramètres : scanner = gestionnaire de recherche à consulter. *
* context = contexte de l'analyse à mener. *
+* full = force un affichage complet des résultats. *
* fd = canal d'écriture. *
* *
* Description : Affiche un gestionnaire de recherches au format texte. *
@@ -536,14 +537,14 @@ GScanContext *g_content_scanner_analyze(GContentScanner *scanner, GScanOptions *
* *
******************************************************************************/
-void g_content_scanner_output_to_text(const GContentScanner *scanner, GScanContext *context, int fd)
+void g_content_scanner_output_to_text(const GContentScanner *scanner, GScanContext *context, bool full, int fd)
{
size_t i; /* Boucle de parcours */
/* Sous-traitance aux règles */
for (i = 0; i < scanner->rule_count; i++)
- g_scan_rule_output_to_text(scanner->rules[i], context, fd);
+ g_scan_rule_output_to_text(scanner->rules[i], context, full, fd);
}
diff --git a/src/analysis/scan/scanner.h b/src/analysis/scan/scanner.h
index 58dbe19..d2b5dc1 100644
--- a/src/analysis/scan/scanner.h
+++ b/src/analysis/scan/scanner.h
@@ -73,7 +73,7 @@ bool g_content_scanner_add_rule(GContentScanner *, GScanRule *);
GScanContext *g_content_scanner_analyze(GContentScanner *, GScanOptions *, GBinContent *);
/* Affiche un gestionnaire de recherches au format texte. */
-void g_content_scanner_output_to_text(const GContentScanner *, GScanContext *, int);
+void g_content_scanner_output_to_text(const GContentScanner *, GScanContext *, bool, int);
/* Convertit un gestionnaire de recherches en texte. */
void g_content_scanner_convert_as_text(const GContentScanner *, GScanContext *);