]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
list-keyword: detect non built keyword
authorEric Leblond <eric@regit.org>
Thu, 15 Nov 2012 13:12:10 +0000 (14:12 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 19 Nov 2012 15:36:38 +0000 (16:36 +0100)
This patch update the glafs list to be able to indicate that a
flag is not supported. This information is used by list-keyword to
display information to the user.

src/detect-filemd5.c
src/detect-luajit.c
src/detect.c
src/detect.h

index 1030c360a8f3f33045632e6f751f817701228eae..c6bb654566108691bfafea31ce03ae101b21d199 100644 (file)
@@ -66,13 +66,12 @@ static int DetectFileMd5SetupNoSupport (DetectEngineCtx *a, Signature *b, char *
  */
 void DetectFileMd5Register(void) {
     sigmatch_table[DETECT_FILEMD5].name = "filemd5";
-    sigmatch_table[DETECT_FILEMD5].desc = "match file MD5 against list of MD5 checksums";
-    sigmatch_table[DETECT_FILEMD5].url = "https://redmine.openinfosecfoundation.org/projects/suricata/wiki/File-keywords#filemd5";
     sigmatch_table[DETECT_FILEMD5].FileMatch = NULL;
     sigmatch_table[DETECT_FILEMD5].alproto = ALPROTO_HTTP;
     sigmatch_table[DETECT_FILEMD5].Setup = DetectFileMd5SetupNoSupport;
     sigmatch_table[DETECT_FILEMD5].Free  = NULL;
     sigmatch_table[DETECT_FILEMD5].RegisterTests = NULL;
+    sigmatch_table[DETECT_FILEMD5].flags = SIGMATCH_NOT_BUILT;
 
        SCLogDebug("registering filemd5 rule option");
     return;
@@ -91,6 +90,8 @@ static void DetectFileMd5Free(void *);
  */
 void DetectFileMd5Register(void) {
     sigmatch_table[DETECT_FILEMD5].name = "filemd5";
+    sigmatch_table[DETECT_FILEMD5].desc = "match file MD5 against list of MD5 checksums";
+    sigmatch_table[DETECT_FILEMD5].url = "https://redmine.openinfosecfoundation.org/projects/suricata/wiki/File-keywords#filemd5";
     sigmatch_table[DETECT_FILEMD5].FileMatch = DetectFileMd5Match;
     sigmatch_table[DETECT_FILEMD5].alproto = ALPROTO_HTTP;
     sigmatch_table[DETECT_FILEMD5].Setup = DetectFileMd5Setup;
index 9160c2c0b665c7da84a77b02e29640df60f0eac9..fc8d38262062c568151ec94fb128d4fc970b726a 100644 (file)
@@ -71,6 +71,7 @@ void DetectLuajitRegister(void) {
     sigmatch_table[DETECT_LUAJIT].Setup = DetectLuajitSetupNoSupport;
     sigmatch_table[DETECT_LUAJIT].Free  = NULL;
     sigmatch_table[DETECT_LUAJIT].RegisterTests = NULL;
+    sigmatch_table[DETECT_LUAJIT].flags = SIGMATCH_NOT_BUILT;
 
        SCLogDebug("registering luajit rule option");
     return;
index caacce6d75c0b5b9d019f91a2b8e5dd4ef1ed2ac..2bb15a38eb6f8984538adb4c80b93b61a795db65 100644 (file)
@@ -4620,13 +4620,21 @@ void SigTableList(const char *keyword)
     if (keyword == NULL) {
         printf("=====Supported keywords=====\n");
         for (i = 0; i < size; i++) {
-            if (sigmatch_table[i].name != NULL)
-                printf("- %s\n", sigmatch_table[i].name);
+            if (sigmatch_table[i].name != NULL) {
+                if (sigmatch_table[i].flags & SIGMATCH_NOT_BUILT) {
+                    printf("- %s (not built-in)\n", sigmatch_table[i].name);
+                } else {
+                    printf("- %s\n", sigmatch_table[i].name);
+                }
+            }
         }
     } else if (!strcmp("csv", keyword)) {
         printf("name;description;app layer;features;documentation\n");
         for (i = 0; i < size; i++) {
             if (sigmatch_table[i].name != NULL) {
+                if (sigmatch_table[i].flags & SIGMATCH_NOT_BUILT) {
+                    continue;
+                }
                 printf("%s;", sigmatch_table[i].name);
                 if (sigmatch_table[i].desc) {
                     printf("%s", sigmatch_table[i].desc);
@@ -4653,7 +4661,12 @@ void SigTableList(const char *keyword)
             if ((sigmatch_table[i].name != NULL) &&
                 !strcmp(sigmatch_table[i].name, keyword)) {
                 printf("= %s =\n", sigmatch_table[i].name);
+                if (sigmatch_table[i].flags & SIGMATCH_NOT_BUILT) {
+                    printf("Not built-in\n");
+                    return;
+                }
                 SigMultilinePrint(i, "");
+                return;
             }
         }
     }
index c56e149bc255aa6e43436f017ad28c67772aa278..3ebcb8a87d4aafdf360f69ef02c94f071d042ae5 100644 (file)
@@ -974,13 +974,15 @@ typedef struct SigGroupHead_ {
 } SigGroupHead;
 
 /** sigmatch has no options, so the parser shouldn't expect any */
-#define SIGMATCH_NOOPT          0x01
+#define SIGMATCH_NOOPT          (1 << 0)
 /** sigmatch is compatible with a ip only rule */
-#define SIGMATCH_IPONLY_COMPAT  0x02
+#define SIGMATCH_IPONLY_COMPAT  (1 << 1)
 /** sigmatch is compatible with a decode event only rule */
-#define SIGMATCH_DEONLY_COMPAT  0x04
+#define SIGMATCH_DEONLY_COMPAT  (1 << 2)
 /**< Flag to indicate that the signature inspects the packet payload */
-#define SIGMATCH_PAYLOAD        0x08
+#define SIGMATCH_PAYLOAD        (1 << 3)
+/**< Flag to indicate that the signature is not built-in */
+#define SIGMATCH_NOT_BUILT      (1 << 4)
 
 /** Remember to add the options in SignatureIsIPOnly() at detect.c otherwise it wont be part of a signature group */