fix: skip dud files on signature import

This commit is contained in:
Michael Green
2023-07-05 22:41:22 +10:00
parent 97e8ffa386
commit 6f954f8d4a

View File

@@ -36,6 +36,14 @@ namespace gaseous_server.SignatureIngestors.TOSEC
{
string tosecXMLFile = tosecPathContents[i];
string[] SkippableFiles = {
".DS_STORE",
"desktop.ini"
};
if (!SkippableFiles.Contains<string>(Path.GetFileName(tosecXMLFile), StringComparer.OrdinalIgnoreCase))
{
// check tosec file md5
Common.hashObject hashObject = new Common.hashObject(tosecXMLFile);
sql = "SELECT * FROM Signatures_Sources WHERE SourceMD5=@sourcemd5";
@@ -44,6 +52,8 @@ namespace gaseous_server.SignatureIngestors.TOSEC
sigDB = db.ExecuteCMD(sql, dbDict);
if (sigDB.Rows.Count == 0)
{
try
{
Logging.Log(Logging.LogType.Information, "Signature Ingestor - TOSEC", "Importing file: " + tosecXMLFile);
@@ -327,6 +337,11 @@ namespace gaseous_server.SignatureIngestors.TOSEC
}
}
}
catch (Exception ex)
{
Logging.Log(Logging.LogType.Warning, "Signature Ingestor - TOSEC", "Failed to import file " + tosecXMLFile, ex);
}
}
else
{
Logging.Log(Logging.LogType.Debug, "Signature Ingestor - TOSEC", "Rejecting already imported file: " + tosecXMLFile);
@@ -336,3 +351,4 @@ namespace gaseous_server.SignatureIngestors.TOSEC
}
}
}
}