internal static FidoReturnValues HistoricalEvent(FidoReturnValues lFidoReturnValues) { Console.WriteLine(@"Gathering historical information from FIDO DB."); const string historicalQuery = "SELECT * FROM configs_historical_events"; var fidoTemp = AlertHelper.GetPreviousAlerts(historicalQuery); if (fidoTemp.Rows.Count <= 0) { return(lFidoReturnValues); } lFidoReturnValues.HistoricalEvent = FormatHistoricalEvents(fidoTemp); var urlCount = new DataTable(); var hashCount = new DataTable(); try { if (lFidoReturnValues.Url != null) { foreach (var url in lFidoReturnValues.Url) { urlCount = AlertHelper.GetPreviousAlerts(lFidoReturnValues.HistoricalEvent.UrlQuery.Replace("%url%", url)); } } var ipCount = GetPreviousAlerts(lFidoReturnValues.HistoricalEvent.IpQuery.Replace("%ip%", lFidoReturnValues.DstIP)); if (lFidoReturnValues.Hash != null) { foreach (var hash in lFidoReturnValues.Hash) { hashCount = GetPreviousAlerts(lFidoReturnValues.HistoricalEvent.HashQuery.Replace("%hash%", hash)); } } Console.WriteLine(@"Historical data:"); lFidoReturnValues.HistoricalEvent.UrlCount = urlCount.Rows.Count; lFidoReturnValues.HistoricalEvent.IpCount = ipCount.Rows.Count; lFidoReturnValues.HistoricalEvent.HashCount = hashCount.Rows.Count; Console.WriteLine(@"URL Count = " + lFidoReturnValues.HistoricalEvent.UrlCount.ToString(CultureInfo.InvariantCulture)); Console.WriteLine(@"IP Count = " + lFidoReturnValues.HistoricalEvent.IpCount.ToString(CultureInfo.InvariantCulture)); Console.WriteLine(@"Hash Count = " + lFidoReturnValues.HistoricalEvent.HashCount.ToString(CultureInfo.InvariantCulture)); } catch (Exception e) { Fido_EventHandler.SendEmail("Fido Error", "Fido Failed: {0} Unable to gather startup configs." + e); } return(lFidoReturnValues); }