private static JArray ProcessGpXml(string path) { if (!Directory.Exists(path)) { return(null); } // Group Policy Preferences are all XML so those are handled here. string[] xmlFiles = Directory.GetFiles(path, "*.xml", SearchOption.AllDirectories); // create a dict for the stuff we find JArray processedGpXml = new JArray(); // if we find any xml files if (xmlFiles.Length >= 1) { foreach (string xmlFile in xmlFiles) { // send each one to get mangled into json JObject parsedGppXmlToJson = Parsers.ParseGppXmlToJson(xmlFile); if (parsedGppXmlToJson == null) { continue; } // then send each one to get assessed for fun things JObject assessedGpp = AssessHandlers.AssessGppJson(parsedGppXmlToJson); if (assessedGpp.HasValues) { processedGpXml.Add(assessedGpp); } } } return(processedGpXml); }
private static JObject ProcessGpXml(string Path) { if (!Directory.Exists(Path)) { return(null); } // Group Policy Preferences are all XML so those are handled here. string[] xmlFiles = Directory.GetFiles(Path, "*.xml", SearchOption.AllDirectories); // create a dict for the stuff we find Dictionary <string, JObject> processedGpXml = new Dictionary <string, JObject>(); // if we find any xml files if (xmlFiles.Length >= 1) { foreach (var xmlFile in xmlFiles) { // send each one to get mangled into json JObject parsedGppXmlToJson = Parsers.ParseGppXmlToJson(xmlFile); // then send each one to get assessed for fun things JObject assessedGpp = AssessHandlers.AssessGppJson(parsedGppXmlToJson); if (assessedGpp != null) { processedGpXml.Add(xmlFile, assessedGpp); } } } return((JObject)JToken.FromObject(processedGpXml)); }
private static JObject ProcessInf(string Path) { // find all the GptTmpl.inf files List <string> gpttmplInfFiles = new List <string>(); try { gpttmplInfFiles = Directory.GetFiles(Path, "GptTmpl.inf", SearchOption.AllDirectories).ToList(); } catch (System.IO.DirectoryNotFoundException) { return(null); } // make a dict for our results Dictionary <string, JObject> processedInfsDict = new Dictionary <string, JObject>(); // iterate over the list of inf files we found foreach (string infFile in gpttmplInfFiles) { //parse the inf file into a manageable format JObject parsedInfFile = Parsers.ParseInf(infFile); //send the inf file to be assessed JObject assessedGpTmpl = AssessHandlers.AssessGptmpl(parsedInfFile); //add the result to our results processedInfsDict.Add(infFile, assessedGpTmpl); } return((JObject)JToken.FromObject(processedInfsDict)); }
static JObject ProcessGPXml(string Path) { // Group Policy Preferences are all XML so those are handled here. string[] XmlFiles = Directory.GetFiles(Path, "*.xml", SearchOption.AllDirectories); // create a dict for the stuff we find Dictionary <string, JObject> ProcessedGPXml = new Dictionary <string, JObject>(); // if we find any xml files if (XmlFiles.Length >= 1) { // iterate over our list of xml files foreach (string XmlFile in XmlFiles) { // send each one to get mangled into json JObject ParsedGPPXmlToJson = Parsers.ParseGPPXmlToJson(XmlFile); // then send each one to get assessed for fun things JObject AssessedGPP = AssessHandlers.AssessGPPJson(ParsedGPPXmlToJson); if (AssessedGPP.HasValues) { ProcessedGPXml.Add(XmlFile, AssessedGPP); } } } JObject ProcessedGPXmlJson = (JObject)JToken.FromObject(ProcessedGPXml); return(ProcessedGPXmlJson); }
private static JArray ProcessInf(string Path) { // find all the GptTmpl.inf files List <string> gpttmplInfFiles = new List <string>(); try { gpttmplInfFiles = Directory.GetFiles(Path, "GptTmpl.inf", SearchOption.AllDirectories).ToList(); } catch (System.IO.DirectoryNotFoundException) { return(null); } // make a JArray for our results JArray processedInfs = new JArray(); // iterate over the list of inf files we found foreach (string infFile in gpttmplInfFiles) { //parse the inf file into a manageable format JObject parsedInfFile = Parsers.ParseInf(infFile); //send the inf file to be assessed JObject assessedGpTmpl = AssessHandlers.AssessGptmpl(parsedInfFile); //add the result to our results if (assessedGpTmpl.HasValues) { processedInfs.Add(assessedGpTmpl); } } return(processedInfs); }
private static JArray ProcessInf(string path) { // find all the GptTmpl.inf files List <string> gpttmplInfFiles = new List <string>(); try { gpttmplInfFiles = Directory.GetFiles(path, "GptTmpl.inf", SearchOption.AllDirectories).ToList(); } catch (DirectoryNotFoundException e) { if (GlobalVar.DebugMode) { Utility.DebugWrite(e.ToString()); } return(null); } catch (UnauthorizedAccessException e) { if (GlobalVar.DebugMode) { Utility.DebugWrite(e.ToString()); } return(null); } // make a JArray for our results JArray processedInfs = new JArray(); // iterate over the list of inf files we found foreach (string infFile in gpttmplInfFiles) { //parse the inf file into a manageable format JObject parsedInfFile = new JObject(); try { parsedInfFile = Parsers.ParseInf(infFile); } catch (UnauthorizedAccessException e) { if (GlobalVar.DebugMode) { Utility.DebugWrite(e.ToString()); } } //send the inf file to be assessed JObject assessedGpTmpl = AssessHandlers.AssessGptmpl(parsedInfFile); //add the result to our results if (assessedGpTmpl.HasValues) { processedInfs.Add(assessedGpTmpl); } } return(processedInfs); }
private static JArray ProcessRegistryPol(string path) { // find all the registry.pol files in subfolders. List <string> registryPolFiles = new List <string>(); try { registryPolFiles = Directory.GetFiles(path, "registry.pol", SearchOption.AllDirectories).ToList(); } catch (DirectoryNotFoundException e) { Utility.Output.DebugWrite(e.ToString()); return(null); } catch (UnauthorizedAccessException e) { Utility.Output.DebugWrite(e.ToString()); return(null); } // JArray for the results JArray processedRegistryPols = new JArray(); // We be iterating, fool foreach (string registryPolFile in registryPolFiles) { JObject parsedRegistryPolFile = new JObject(); try { parsedRegistryPolFile = Parsers.ParseRegistryPol(registryPolFile); } catch (UnauthorizedAccessException e) { Utility.Output.DebugWrite(e.ToString()); } catch (NotSupportedException e) { Utility.Output.DebugWrite(e.ToString()); } JObject assessedRegistryPol = AssessHandlers.AssessRegistryPol(parsedRegistryPolFile); if (assessedRegistryPol.HasValues) { processedRegistryPols.Add(assessedRegistryPol); } } return(processedRegistryPols); }
static JObject ProcessInf(string Path) { // find all the GptTmpl.inf files string[] GptTmplInfFiles = Directory.GetFiles(Path, "GptTmpl.inf", SearchOption.AllDirectories); // make a dict for our results Dictionary <string, JObject> ProcessedInfsDict = new Dictionary <string, JObject>(); // iterate over the list of inf files we found foreach (string infFile in GptTmplInfFiles) { //parse the inf file into a manageable format JObject ParsedInfFile = Parsers.ParseInf(infFile); //send the inf file to be assessed JObject AssessedGPTmpl = AssessHandlers.AssessGPTmpl(ParsedInfFile); //add the result to our results ProcessedInfsDict.Add(infFile, AssessedGPTmpl); } JObject ProcessedInfsJson = (JObject)JToken.FromObject(ProcessedInfsDict); return(ProcessedInfsJson); }