override protected string GetCsvData(string computer) { StringBuilder sb = new StringBuilder(); string header = null; NullSessionTester session = new NullSessionTester(Server, (NTAccount server) => { if (sb.Length != 0) { sb.AppendLine(); } sb.Append(header); sb.Append(server.Value); }); bool enabled = false; DisplayAdvancement(computer, "Testing MS-SAMR"); header = computer + " \tMS-SAMR\t"; if (session.EnumerateAccount(TypeOfEnumeration.Samr, (ScanningMode == 0 ? 1 : NullSessionEnumerationLimit))) { DisplayAdvancement(computer, "Null session is enabled (at least MS-SAMR)"); enabled = true; } else { DisplayAdvancement(computer, "MS-SAMR disabled"); } if (!enabled) { DisplayAdvancement(computer, "Testing MS-LSAT"); header = computer + "\tMS-LSAT\t"; if (session.EnumerateAccount(TypeOfEnumeration.Lsa, (ScanningMode == 0 ? 1 : NullSessionEnumerationLimit))) { DisplayAdvancement(computer, "Null session is enabled (only MS-LSAT)"); enabled = true; } else { DisplayAdvancement(computer, "MS-LSAT disabled"); } } if (!enabled) { DisplayAdvancement(computer, "Null session is disabled"); sb.Append(computer); sb.Append("\tNone\t"); } return(sb.ToString()); }
/* * public bool ExportHCRuleTask() * { * return StartTask("Export Healthcheck rules", * () => * { * HealthcheckRules rules = new HealthcheckRules(); * rules.GenerateRuleDescriptionFile("rules-V" + Assembly.GetExecutingAssembly().GetName().Version + ".xlsx"); * } * ); * } */ public bool NullSessionTask() { return(StartTask("Null Session", () => { NullSessionTester session = new NullSessionTester(Server, (NTAccount server) => { Console.WriteLine(server.Value); }); bool enabled = false; Console.WriteLine("Testing MS-SAMR"); if (session.EnumerateAccount(TypeOfEnumeration.Samr, NullSessionEnumerationLimit)) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Null session is enabled (at least MS-SAMR)"); Console.ResetColor(); enabled = true; } else { Console.WriteLine("MS-SAMR disabled"); } if (!enabled) { Console.WriteLine("Testing MS-LSAT"); if (session.EnumerateAccount(TypeOfEnumeration.Lsa, NullSessionEnumerationLimit)) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Null session is enabled (only MS-LSAT)"); Console.ResetColor(); enabled = true; } else { Console.WriteLine("MS-LSAT disabled"); } } if (!enabled) { Console.WriteLine("Null session is disabled"); } } )); }