Browse code

Rename .crtdb to .crb and add functionality to sigtool for searching the authenticode database

Shawn Webb authored on 2013/03/06 05:13:12
Showing 4 changed files
... ...
@@ -609,7 +609,7 @@ NotBefore;Comment[;minFL[;maxFL]]
609 609
             this variable. Defaults to 0 if left empty
610 610
         \item \verb+Comment:+ comments for this entry
611 611
     \end{itemize}
612
-    The signatures for certs are stored inside \verb+.crtdb+ files.
612
+    The signatures for certs are stored inside \verb+.crb+ files.
613 613
 
614 614
     \subsection{Signatures based on container metadata}
615 615
     ClamAV 0.96 allows creating generic signatures matching files stored
... ...
@@ -2610,7 +2610,7 @@ int cli_load(const char *filename, struct cl_engine *engine, unsigned int *signo
2610 2610
     } else if(cli_strbcasestr(dbname, ".cud")) {
2611 2611
 	ret = cli_cvdload(fs, engine, signo, options, 2, filename, 0);
2612 2612
 
2613
-    } else if (cli_strbcasestr(dbname, ".crtdb")) {
2613
+    } else if (cli_strbcasestr(dbname, ".crb")) {
2614 2614
         ret = cli_loadcrt(fs, engine, dbio);
2615 2615
 
2616 2616
     } else if(cli_strbcasestr(dbname, ".hdb") || cli_strbcasestr(dbname, ".hsb")) {
... ...
@@ -60,7 +60,7 @@
60 60
 	cli_strbcasestr(ext, ".cud")   ||	\
61 61
 	cli_strbcasestr(ext, ".cdb")   ||	\
62 62
 	cli_strbcasestr(ext, ".cat")   ||	\
63
-	cli_strbcasestr(ext, ".crtdb")   ||	\
63
+	cli_strbcasestr(ext, ".crb")   ||	\
64 64
 	cli_strbcasestr(ext, ".idb")		\
65 65
     )
66 66
 
... ...
@@ -110,7 +110,7 @@ static const struct dblist_s {
110 110
     { "gdb",   1 },
111 111
     { "pdb",   1 },
112 112
     { "wdb",   0 },
113
-    { "crtdb", 1 },
113
+    { "crb", 1 },
114 114
 
115 115
     { NULL,	    0 }
116 116
 };
... ...
@@ -1201,7 +1201,8 @@ static int listdir(const char *dirname, const regex_t *regex)
1201 1201
 	     cli_strbcasestr(dent->d_name, ".cdb") ||
1202 1202
 	     cli_strbcasestr(dent->d_name, ".cbc") ||
1203 1203
 	     cli_strbcasestr(dent->d_name, ".cld") ||
1204
-	     cli_strbcasestr(dent->d_name, ".cvd"))) {
1204
+	     cli_strbcasestr(dent->d_name, ".cvd") ||  
1205
+	     cli_strbcasestr(dent->d_name, ".crb"))) {
1205 1206
 
1206 1207
 		dbfile = (char *) malloc(strlen(dent->d_name) + strlen(dirname) + 2);
1207 1208
 		if(!dbfile) {
... ...
@@ -1325,6 +1326,22 @@ static int listdb(const char *filename, const regex_t *regex)
1325 1325
 	    mprintf("%s\n", start);
1326 1326
 	}
1327 1327
 
1328
+    } else if (cli_strbcasestr(filename, ".crb")) {
1329
+        while (fgets(buffer, FILEBUFF, fh)) {
1330
+            cli_chomp(buffer);
1331
+            
1332
+            if (buffer[0] == '#')
1333
+                continue;
1334
+
1335
+            if (regex) {
1336
+                if (!cli_regexec(regex, buffer, 0 , NULL, 0))
1337
+                    mprintf("[%s] %s\n", dbname, buffer);
1338
+
1339
+                continue;
1340
+            }
1341
+            line++;
1342
+            mprintf("%s\n", buffer);
1343
+        }
1328 1344
     } else if(cli_strbcasestr(filename, ".hdb") || cli_strbcasestr(filename, ".hdu") || cli_strbcasestr(filename, ".mdb") || cli_strbcasestr(filename, ".mdu")) { /* hash database */
1329 1345
 
1330 1346
 	while(fgets(buffer, FILEBUFF, fh)) {