public void HostEntryAttribute_Negative() { HostEntryAttribute hea = new HostEntryAttribute(HostEntryAttribute.Type.IP, null); Assert.AreEqual("?", hea.ToString()); }
/// <summary> /// Formulates the difference of two HostEntryAttributes. /// </summary> private string getSummary(HostEntryAttribute before, HostEntryAttribute now) { if ((before == null || before.ToString().Length <= 1) && now.ToString().Length >= 1) return string.Format("Discovered as {0}", now); else if (before.ToString().Length >= 1 && now.ToString().Length >= 1 && !before.Equals(now)) return string.Format("Detection from {0} to {1}", before, now); else if (before.Equals(now)) return string.Format("Unchanged: {0}", now); return "Assessment failed"; }
public void HostEntryAttribute_Positive() { string ip = "1.1.1.1"; HostEntryAttribute hea = new HostEntryAttribute(HostEntryAttribute.Type.IP, ip); Assert.AreEqual(ip, hea.ToString()); }
/// <summary> /// Will determine the coloring of the cell based on the content it holds /// for its type. /// </summary> private coloring detemineCellColoring(HostEntryAttribute s, HostEntry he = null) { if (s.Attribute == HostEntryAttribute.Type.Protocol) { if (s.ToString().ToLower().Equals("http")) return coloring.negative; return coloring.positive; } else if (s.Attribute == HostEntryAttribute.Type.Ranking) { if (s.ToString().ToLower().StartsWith("a")) return coloring.positive; else if (s.ToString().ToLower().StartsWith("b")) return coloring.neutral; else return coloring.negative; } else if (s.Attribute == HostEntryAttribute.Type.Fingerprint) { if (s.ToString().Contains("256")) return coloring.positive; else return coloring.neutral; } else if (s.Attribute == HostEntryAttribute.Type.Expiration) { DateTime dt = DateTime.Parse(s.ToString()); if (dt > DateTime.Today.AddDays(10)) return coloring.positive; else if (dt < DateTime.Today) return coloring.negative; } else if (s.Attribute == HostEntryAttribute.Type.WarningExpiration) { if (he.WarningExpired) return coloring.negative; else return coloring.positive; } else if (s.Attribute == HostEntryAttribute.Type.RC4) { if (s.ToString().Contains("True")) return coloring.negative; else if (s.ToString().Contains("False")) return coloring.positive; } else if (s.Attribute == HostEntryAttribute.Type.MD5) { if (s.ToString().Contains("Yes")) return coloring.negative; else if (s.ToString().Contains("No")) return coloring.positive; } else if (s.Attribute == HostEntryAttribute.Type.BeastVulnerability) { if (s.ToString().Contains("Yes")) return coloring.negative; else if (s.ToString().Contains("No")) return coloring.positive; } else if (s.Attribute == HostEntryAttribute.Type.ForwardSecrecy) { if (s.ToString().Contains("Yes")) return coloring.positive; else if (s.ToString().Contains("No")) return coloring.negative; } else if (s.Attribute == HostEntryAttribute.Type.Heartbleed) { if (s.ToString().Contains("Yes")) return coloring.negative; else if (s.ToString().Contains("No")) return coloring.positive; } else if (s.Attribute == HostEntryAttribute.Type.OpenSSLCCSVulnerable) { if (s.ToString().Contains("Not")) return coloring.positive; else return coloring.negative; } else if (s.Attribute == HostEntryAttribute.Type.OpenSSLCCSVulnerable) { if (s.ToString().Contains("Not")) return coloring.positive; else return coloring.neutral; } else if (s.Attribute == HostEntryAttribute.Type._3DES) { if (s.ToString().Contains("True")) return coloring.negative; else return coloring.positive; } return coloring.none; }