Esempio n. 1
0
        static void Main(string[] args)
        {
            Task invoker = Task.Factory.StartNew(Checker);

            while (true)
            {
                Console.WriteLine("-------MENU-------\n 1.Check blacklist configuration.\n 2.Change blacklist configuration.\n 3.Save current blacklist configuration.\n 4.Exit application.\n");
                Console.Write("Option: ");
                var izbor = Console.ReadLine();
                switch (izbor)
                {
                case "1":
                    ConfigurationCheck();
                    break;

                case "2":
                    ProcessModel pm = ProcessModelCreation();
                    ConvertJson.WriteToFile(pm, $"..\\..\\BlacklistConfig.json");
                    configCheck.CreateOrUpdateConfigHash();
                    break;

                case "3":
                    configCheck.CreateOrUpdateConfigHash();
                    break;

                case "4":
                    Environment.Exit(0);
                    break;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Adds intrusion in json fromat in file.
        /// </summary>
        /// <param name="process"></param>
        public void AddIntrusion(List <ProcessModel> process)
        {
            Logger.Info($"Adding intrusions to file.");

            try
            {
                process.ForEach(x => ConvertJson.WriteToFile(x, _path));
                LogCriticalIntrusions();
            }
            catch (Exception e)
            {
                Logger.Error($"Adding intrusions to file failed with error:{e}");
            }
        }