Example #1
0
 public static SimulationExercise ReadSimulationPlaybook(string jsoninput)
 {
     try
     {
         SimulationExercise engagement = JsonConvert.DeserializeObject <SimulationExercise>(jsoninput);
         return(engagement);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Example #2
0
 public static SimulationExercise ReadSimulationPlaybook(string jsoninput)
 {
     try
     {
         SimulationExercise engagement = JsonConvert.DeserializeObject <SimulationExercise>(jsoninput);
         return(engagement);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message.ToString());
         return(null);
     }
 }
Example #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);
        }
Example #4
0
 public static void CreateSimulationExercise(SimulationExercise engagement)
 {
     File.WriteAllText("simulation.json", JsonConvert.SerializeObject(engagement));
 }