[Forensics-changes] [yara] 263/415: Allow to disable warnings from command line

Hilko Bengen bengen at moszumanska.debian.org
Thu Apr 3 05:43:13 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch debian
in repository yara.

commit d8bbf79644f5c1c03bcc24754df22cfd15c3da11
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Thu Nov 28 19:48:47 2013 +0100

    Allow to disable warnings from command line
---
 yara.c   | 17 ++++++++++++++---
 yara.man | 39 +++++++++++++++++++++------------------
 2 files changed, 35 insertions(+), 21 deletions(-)

diff --git a/yara.c b/yara.c
index 53faf20..1f49e6a 100644
--- a/yara.c
+++ b/yara.c
@@ -53,6 +53,7 @@ limitations under the License.
 "  -a <seconds>             abort scanning after a number of seconds has elapsed.\n"\
 "  -d <identifier>=<value>  define external variable.\n"\
 "  -r                       recursively search directories.\n"\
+"  -w                       disable warnings."\
 "  -v                       show version information.\n"
 
 #define EXTERNAL_TYPE_INTEGER   1
@@ -115,6 +116,7 @@ int show_tags = FALSE;
 int show_specified_tags = FALSE;
 int show_specified_rules = FALSE;
 int show_strings = FALSE;
+int show_warnings = TRUE;
 int show_meta = FALSE;
 int fast_scan = FALSE;
 int negate = FALSE;
@@ -396,9 +398,14 @@ void print_compiler_error(
     const char* message)
 {
   if (error_level == YARA_ERROR_LEVEL_ERROR)
+  {
     fprintf(stderr, "%s(%d): error: %s\n", file_name, line_number, message);
+  }
   else
-    fprintf(stderr, "%s(%d): warning: %s\n", file_name, line_number, message);
+  {
+    if (show_warnings)
+      fprintf(stderr, "%s(%d): warning: %s\n", file_name, line_number, message);
+  }
 }
 
 
@@ -681,7 +688,7 @@ int process_cmd_line(
 
   opterr = 0;
 
-  while ((c = getopt (argc, (char**) argv, "rnsvgma:l:t:i:d:f")) != -1)
+  while ((c = getopt (argc, (char**) argv, "wrnsvgma:l:t:i:d:f")) != -1)
   {
     switch (c)
     {
@@ -705,6 +712,10 @@ int process_cmd_line(
         show_strings = TRUE;
         break;
 
+      case 'w':
+        show_warnings = FALSE;
+        break;
+
       case 'f':
         fast_scan = TRUE;
         break;
@@ -1007,7 +1018,7 @@ int main(
         (void*) argv[argc - 1],
         fast_scan,
         timeout);
- 
+
     if (result != ERROR_SUCCESS)
     {
       fprintf(stderr, "Error scanning %s: ", argv[argc - 1]);
diff --git a/yara.man b/yara.man
index 00964ea..89cffd8 100644
--- a/yara.man
+++ b/yara.man
@@ -2,16 +2,16 @@
 .SH NAME
 yara \- find files matching patterns and rules written in a special-purpose language.
 .SH SYNOPSIS
-.B yara 
+.B yara
 [OPTION]... [RULEFILE]... FILE | PID
 .SH DESCRIPTION
-.I Yara 
-scans the given 
+.I Yara
+scans the given
 .I FILE
 or the process indentified by
 .I PID
-looking if it matches the patterns and rules provided in a special purpose-language. The rules are read from 
-.I RULEFILEs 
+looking if it matches the patterns and rules provided in a special purpose-language. The rules are read from
+.I RULEFILEs
 or standard input.
 .PP
 The options to
@@ -31,16 +31,16 @@ and ignore the rest. This option can be used multiple times.
 .B \-n
 Print rules that doesn't apply (negate)
 .TP
-.B \-g 
+.B \-g
 Print the tags associated to the rule.
 .TP
-.B \-m 
+.B \-m
 Print metadata associated to the rule.
 .TP
 .B \-s
 Print strings found in the file.
 .TP
-.BI \-l " number" 
+.BI \-l " number"
 Abort scanning after a
 .I number
 of rules matched.
@@ -48,13 +48,16 @@ of rules matched.
 .BI \-d " identifier"=value
 Define an external variable. This option can be used multiple times.
 .TP
-.B \-r 
+.B \-r
 Scan files in directories recursively.
 .TP
-.B \-f 
+.B \-f
 Speeds up scanning by searching only for the first occurrence of each pattern.
 .TP
-.B \-v 
+.B \-w
+Disable warnings.
+.TP
+.B \-v
 Show version information.
 .SH EXAMPLES
 $ yara /foo/bar/rules1 /foo/bar/rules2 .
@@ -72,7 +75,7 @@ $ yara -t Packer -t Compiler /foo/bar/rules bazfile
 .PP
 Apply rules on
 .I /foo/bar/rules
-to 
+to
 .I bazfile.
 Only reports rules tagged as
 .I Packer
@@ -80,7 +83,7 @@ or
 .I Compiler.
 .RE
 .PP
-$ cat /foo/bar/rules1 | yara -r /foo 
+$ cat /foo/bar/rules1 | yara -r /foo
 .RS
 .PP
 Scan all files in the
@@ -88,15 +91,15 @@ Scan all files in the
 directory and its subdirectories. Rules are read from standard input.
 .RE
 .PP
-$ yara -d mybool=true -d myint=5 -d mystring="my string" /foo/bar/rules bazfile  
+$ yara -d mybool=true -d myint=5 -d mystring="my string" /foo/bar/rules bazfile
 .RS
 .PP
-Defines three external variables 
+Defines three external variables
 .I mybool
-.I myint 
+.I myint
 and
 .I mystring.
 .RE
 
-.SH AUTHOR 
-Victor M. Alvarez (victor.alvarez at virustotal.com) 
+.SH AUTHOR
+Victor M. Alvarez (victor.alvarez at virustotal.com)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git



More information about the forensics-changes mailing list