Esempio n. 1
0
        public static void ExportAttackLayer(string[] techniques)
        {
            NavigatorLayer layer = new NavigatorLayer();

            layer.version      = "3.0";
            layer.name         = "PurpleSharp Coverage";
            layer.domain       = "mitre-enterprise";
            layer.description  = "Layer of techniques supported by PurpleSharp";
            layer.hideDisabled = true;

            NavigatorFilters filters = new NavigatorFilters();

            filters.stages    = new string [] { "act" };
            filters.platforms = new string [] { "Windows" };

            layer.filters = filters;

            List <NavigatorTechnique> layertechniques = new List <NavigatorTechnique>();

            foreach (string technique in techniques)
            {
                NavigatorTechnique tech = new NavigatorTechnique();
                tech.techniqueID = technique;
                tech.color       = "#756bb1";
                //tech.comment = "";
                tech.enabled = true;
                tech.score   = 1;

                layertechniques.Add(tech);
            }
            layer.techniques = layertechniques;
            File.WriteAllText("PurpleSharp_navigator.json", JsonConvert.SerializeObject(layer));
        }
Esempio n. 2
0
 public static NavigatorLayer ReadNavigatorLayer(string jsoninput)
 {
     try
     {
         NavigatorLayer navlayer = JsonConvert.DeserializeObject <NavigatorLayer>(jsoninput);
         return(navlayer);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Esempio n. 3
0
        public static SimulationExercise ConvertNavigatorToSimulationExercise(NavigatorLayer layer, string[] supportedtechniques)
        {
            SimulationExercise        engagement = new SimulationExercise();
            List <SimulationPlaybook> playbooks  = new List <SimulationPlaybook>();
            int notsupported = 0;

            foreach (NavigatorTechnique technique in layer.techniques)
            {
                if (Array.IndexOf(supportedtechniques, technique.techniqueID) > -1)
                {
                    SimulationPlaybook playbook = new SimulationPlaybook();
                    playbook.name                    = layer.name;
                    playbook.remote_host             = "random";
                    playbook.scout_full_path         = @"C:\Windows\Psexesvc.exe";
                    playbook.simulator_relative_path = @"\Downloads\Firefox_Installer.exe";
                    List <PlaybookTask> tasks = new List <PlaybookTask>();


                    PlaybookTask task = new PlaybookTask();
                    task.technique_id = technique.techniqueID;
                    tasks.Add(task);
                    playbook.tasks = tasks;
                    playbooks.Add(playbook);
                }
                else
                {
                    Console.WriteLine("[!] {0} not supported by PurpleSharp", technique.techniqueID);
                    notsupported += 1;
                }
            }
            engagement.playbooks = playbooks;
            //playbook.tasks = tasks;
            //engagement.playbooks = new List<SimulationPlaybook>();
            //engagement.playbooks.Add(playbook);
            Console.WriteLine("[!] Found a total of {0} techniques not supported out of {1}", notsupported.ToString(), layer.techniques.Count.ToString());
            Console.WriteLine("[!] Final number of tasks supported: {0}", playbooks.Count.ToString());
            return(engagement);
        }