Beispiel #1
0
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                if (Directory.Exists(args[0]))
                {
                    Console.WriteLine("Threat Modeling Program - MS TMT Files Converter");

                    var loader = new ModelLoader();

                    Analyze(loader, args[0]);
                }
                else
                {
                    throw new FileNotFoundException("Unable to find the specified file.", args[0]);
                }
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                if (Directory.Exists(args[0]))
                {
                    Console.WriteLine("Threats Manager Platform - MS TMT Files Converter");

                    var loader = new ModelLoader();

                    Analyze(loader, args[0]);
                }
                else
                {
                    throw new DirectoryNotFoundException();
                }
            }
        }
Beispiel #3
0
        static IThreatModel ConvertModel(ModelLoader loader, string fileName)
        {
            Console.Write($"--- Converting file {Path.GetFileName(fileName)}");

            var model = loader.ConvertModel(fileName);

            if (model != null)
            {
                var tmSerialized = ThreatModelManager.Serialize(model);
                var dest         = Path.Combine(Path.GetDirectoryName(fileName), $"{Path.GetFileNameWithoutExtension(fileName)}.tm");
                var package      = Package.Create(dest);
                package.Add("threatmodel.json", tmSerialized);
                package.Save();
            }

            Console.WriteLine(" - done.");

            return(model);
        }