public void CreateThreat()
 {
     threat = ScriptableObject.CreateInstance<Threat> ();
     threat.setup (radarValues[threatIndex], weaponValues[threatIndex], enemies[threatIndex], names[threatIndex], "tiny");
     threatIndex++;
     GameObject.FindGameObjectWithTag("Desk").SendMessage("ActivateComputer");
     //print(threat.ToString ());
 }
Ejemplo n.º 2
0
 //send in an enum for threat level
 //return true if audio played else false
 public Boolean PlayAudio(Threat threat, Position position)
 {
     if (threat != Threat.none) {
         if (position == Position.Above) {
             Console.WriteLine ("Descend");
         } else {
             Console.WriteLine ("Ascend");
         }
         return true;
     } else {
         return false;
     }
 }
Ejemplo n.º 3
0
		//send in an enum for threat level
		//return true if audio played else false
		public Boolean PlayAudio (Threat threat, Position position)
		{
			if (threat != Threat.none) {
				switch (threat) {
				case Threat.yellow:
					Trace.WriteLine ("Traffic! Traffic!");
					break;
				case Threat.orange:
					Trace.WriteLine ("Warning! Warning!");
					ReportCommand (position);
					break;
				case Threat.red:
					Trace.WriteLine ("Take Evasive Action Now!");
					ReportCommand (position);
					break;
				}
				return true;
			}
			else{
				return false;
			}
		}
Ejemplo n.º 4
0
    //Currently using a second list to store the index of items to remove as removing from a single list will reorder the index.
    //Remove any 3 or shorter threats that are not open
    public List <Threat> FilterBoardThreats(int[,] board, int player)
    {
        List <Threat> threats = new List <Threat>();

        threats = CheckBoardThreats(board, player);

        List <Threat> workList = new List <Threat>();

        for (int i = 0; i < threats.Count; i++)
        {
            Threat currentThreat = threats[i];

            //Remove threats that have no open spaces to finish
            if ((currentThreat.open == 0 & currentThreat.length < 4) || (currentThreat.length <= 1))
            {
                //Debug.Log("Removing threat of length: " + currentThreat.length);
                workList.Add(currentThreat);
            }

            else
            {
                //Debug.Log("Criteria met. Index: " + i);
            }
        }


        //Debug.Log("Before filter. Number of threats: " + threats.Count);

        for (int i = 0; i < workList.Count; i++)
        {
            threats.Remove(workList[i]);
        }

        //Debug.Log("After filter. Number of threats: " + threats.Count);
        return(threats);
    }
Ejemplo n.º 5
0
        private bool HandleUnassignedThreat(IThreatModel target, Threat threat, IThreatType threatType, IPropertySchema schema)
        {
            bool result = false;

            using (var dialog = new ThreatAssignmentDialog(target))
            {
                dialog.Initialize(threat.ToString(), threat.GetValueFromLabel("Description"));
                if (dialog.ShowDialog(Form.ActiveForm) == DialogResult.OK)
                {
                    var identity = dialog.SelectedIdentity;
                    if (identity != null)
                    {
                        if (identity is IEntity entity)
                        {
                            var threatEvent = entity.AddThreatEvent(threatType);
                            if (threatEvent != null)
                            {
                                Importer.AddProperties(threatEvent, threat, schema);
                                result = true;
                            }
                        }
                        else if (identity is IDataFlow dataFlow)
                        {
                            var threatEvent = dataFlow.AddThreatEvent(threatType);
                            if (threatEvent != null)
                            {
                                Importer.AddProperties(threatEvent, threat, schema);
                                result = true;
                            }
                        }
                    }
                }
            }

            return(result);
        }
        public void SetThread(System.Windows.Controls.TextBox[] textBoxes, ComboBox[] comboBox)
        {
            Threat threat = new Threat();

            foreach (var item in textBoxes)
            {
                switch (item.Name)
                {
                case "numberFSTEK":
                    threat.Number = item.Text;
                    break;

                case "name":
                    threat.Name = item.Text;
                    break;

                case "verReal":
                    threat.Probability = Double(item.Text);
                    break;

                case "uwerb":
                    threat.Damage = Double(item.Text);
                    break;

                default:
                    break;
                }
            }
            foreach (var item in comboBox)
            {
                switch (item.Name)
                {
                case "actual":
                    if (item.Text == "Актуальная")
                    {
                        threat.Relevance = Relevance.Актуальная;
                    }
                    else
                    {
                        threat.Relevance = Relevance.НеАктуальная;
                    }
                    break;

                default:
                    break;
                }
            }
            List <StatisticData> statisticDatas = new List <StatisticData>();

            if (PathToData != null)
            {
                statisticDatas = SetStatisticData();
                //foreach (var statisticData in statisticDatas)
                //{
                //    db.StatisticData.Add(statisticData);
                //}
                threat.Data = statisticDatas;
            }


            db.Threats.Add(threat);
            db.SaveChanges();
            var modelDB = db.Models.Where(m => m.Id == ModelThreat.Id).FirstOrDefault();

            modelDB.Threats.Add(threat);
            db.SaveChanges();
        }
Ejemplo n.º 7
0
 public void SendCrewOnMission(CrewDie crew, Threat threat)
 {
     threat.AwayMissions.First(a => a.Type == crew.Type && !a.IsAssigned).IsAssigned = true;
     crew.State       = CrewState.Mission;
     crew.MissionName = threat.Name;
 }
Ejemplo n.º 8
0
    public IEnumerator DeployThreat(Threat threat)
    {
        if (threat.threatType != StaticDb.ThreatType.remote)
        {
            threat.aiController.BeforeDeploy();
        }

        yield return(new WaitWhile(() => threat.aiController.pathUpdated));

        //CHECK IF PLAYER IS NEAR OBJECTIVE; IF NOT THREAT NOT ELIGIBLE TO DEPLOY
        //BYPASS THIS CHECK IF THREAT IS REMOTE
        if (threat.aiController.ThreatDeployEligibility())
        {
            if (threat.threatType != StaticDb.ThreatType.fakeLocal)
            {
                //THREAT WITH INTERN ATTACKER; CHECK IF CORRUPTION ATTEMPT IS SUCCESSFUL
                if (threat.threatAttacker == StaticDb.ThreatAttacker.intern &&
                    (threat.aiController.isTrusted || (int)threat.threatDanger < (int)threat.aiController.dangerResistance))
                {
                    if (threat.threatType == StaticDb.ThreatType.remote)
                    {
                        gameData.remoteThreats.Remove(threat);
                    }
                    else
                    {
                        gameData.localThreats.Remove(threat);
                    }

                    gameData.totalThreat += 1;
                    UpdateReputation(threat, StaticDb.ThreatStatus.unarmed);

                    ClassDb.spawnCharacter.RemoveAi(threat.aiController.gameObject);
                    ClassDb.levelMessageManager.StartFailedCorruption();
                    yield break;
                }

                //REMOTE THREAT; CHECK IF FIREWALL INTERCEPT BEFORE DEPLOY
                if (threat.threatType == StaticDb.ThreatType.remote &&
                    Random.Range(0, 100) < gameData.firewallSuccessRate &&
                    gameData.isFirewallActive)
                {
                    gameData.remoteThreats.Remove(threat);

                    gameData.totalThreat += 1;
                    UpdateReputation(threat, StaticDb.ThreatStatus.unarmed);

                    ClassDb.spawnCharacter.RemoveAi(threat.aiController.gameObject);
                    ClassDb.levelMessageManager.StartThreatStopped(threat);
                    yield break;
                }
            }

            bool deployed = BeforeDeployThreat(threat);

            //wait for closing dialog box
            yield return(new WaitWhile(() => gameData.dialogEnabled));

            if (!deployed)
            {
                //WRITE LOG
                ClassDb.logManager.StartWritePlayerLogRoutine(StaticDb.player, StaticDb.logEvent.GameEvent, threat.threatAttack.ToString().ToUpper() + " STOPPED");
                yield break;
            }

            //WRITE LOG
            ClassDb.logManager.StartWritePlayerLogRoutine(StaticDb.player, StaticDb.logEvent.GameEvent, threat.threatAttack.ToString().ToUpper() + " DEPLOYED");

            //Set flag to start evaluate threat management result
            if (threat.threatType != StaticDb.ThreatType.fakeLocal)
            {
                //SET FLAGS TO INFORM ABOUT DEPLOYED THREAT
                gameData.hasThreatDeployed  = true;
                gameData.lastThreatDeployed = threat;

                gameData.hasThreatManaged = false;
                StartThreatManagementResultData(threat);
            }

            float moneyLoss;

            switch (threat.threatAttack)
            {
            case StaticDb.ThreatAttack.dos:

                //Stop all time events before setting money loss
                ClassDb.timeEventManager.StopTimeEventList(gameData.timeEventList);

                //Set money loss for rebooting and check flag to start money loss
                gameData.moneyLossList[StaticDb.ThreatAttack.dos] += threat.moneyLossPerMinute * gameData.totalMoneyEarnPerMinute;

                if (gameData.isFirstDos)
                {
                    gameData.isFirstDos = false;
                    //SHOW THE RIGHT LESSON
                    ClassDb.levelMessageManager.StartShowLessonFirstTime(threat);
                    //wait for closing dialog box
                    yield return(new WaitWhile(() => gameData.dialogEnabled));
                }

                break;

            case StaticDb.ThreatAttack.phishing:

                //Calculate money loss according to the formula moneyLossPerMinute * 60 * threat number of hour
                moneyLoss = threat.moneyLossPerMinute * 60 * threat.deployTime;

                //Inform how much money has been lost
                ClassDb.levelMessageManager.StartMoneyLoss(threat.threatType, moneyLoss);

                //Decreasing money by moneyLoss amount
                gameData.money -= moneyLoss;

                //gameData.hasPhishingDeployed = false;

                if (gameData.isFirstPhishing)
                {
                    gameData.isFirstPhishing = false;
                    //SHOW THE RIGHT LESSON
                    ClassDb.levelMessageManager.StartShowLessonFirstTime(threat);
                    //wait for closing dialog box
                    yield return(new WaitWhile(() => gameData.dialogEnabled));
                }
                break;

            case StaticDb.ThreatAttack.replay:

                //Stop all time events before setting money loss
                ClassDb.timeEventManager.StopTimeEventList(gameData.timeEventList);

                //flag to inform about check plant by phone
                gameData.hasPlantChecked = false;

                //set money loss until check network cfg has been executed and check flag to start money loss
                gameData.moneyLossList[StaticDb.ThreatAttack.replay] += threat.moneyLossPerMinute * gameData.totalMoneyEarnPerMinute;

                if (gameData.isFirstReplay)
                {
                    gameData.isFirstReplay = false;
                    //SHOW THE RIGHT LESSON
                    ClassDb.levelMessageManager.StartShowLessonFirstTime(threat);
                    //wait for closing dialog box
                    yield return(new WaitWhile(() => gameData.dialogEnabled));
                }
                break;

            case StaticDb.ThreatAttack.mitm:

                //Stop all time events before setting money loss
                ClassDb.timeEventManager.StopTimeEventList(gameData.timeEventList);

                //set money loss until check network cfg has been executed and check flag to start money loss
                gameData.moneyLossList[StaticDb.ThreatAttack.mitm] += threat.moneyLossPerMinute * gameData.totalMoneyEarnPerMinute;

                if (gameData.isFirstMitm)
                {
                    gameData.isFirstMitm = false;
                    //SHOW THE RIGHT LESSON
                    ClassDb.levelMessageManager.StartShowLessonFirstTime(threat);
                    //wait for closing dialog box
                    yield return(new WaitWhile(() => gameData.dialogEnabled));
                }
                break;

            case StaticDb.ThreatAttack.stuxnet:

                //Stop all time events before setting money loss
                ClassDb.timeEventManager.StopTimeEventList(gameData.timeEventList);

                //flag to inform about check plant by phone
                gameData.hasPlantChecked = false;

                //set money loss until scan has been executed and check flag to start money loss
                gameData.moneyLossList[StaticDb.ThreatAttack.stuxnet] += threat.moneyLossPerMinute * gameData.totalMoneyEarnPerMinute;

                if (gameData.isFirstStuxnet)
                {
                    gameData.isFirstStuxnet = false;
                    //SHOW THE RIGHT LESSON
                    ClassDb.levelMessageManager.StartShowLessonFirstTime(threat);
                    //wait for closing dialog box
                    yield return(new WaitWhile(() => gameData.dialogEnabled));
                }
                break;

            case StaticDb.ThreatAttack.dragonfly:

                //Stop all time events before setting money loss
                ClassDb.timeEventManager.StopTimeEventList(gameData.timeEventList);

                //flag to inform about check malware
                gameData.hasMalwareChecked = false;

                //set money loss until scan has been executed and check flag to start money loss
                gameData.moneyLossList[StaticDb.ThreatAttack.dragonfly] += threat.moneyLossPerMinute * gameData.totalMoneyEarnPerMinute;

                //Calculate money loss according to the formula moneyLossPerMinute * 60 * threat number of hour
                moneyLoss = threat.moneyLossPerMinute * 60 * threat.deployTime;

                //Inform how much money has been lost
                ClassDb.levelMessageManager.StartMoneyLoss(threat.threatType, moneyLoss);

                //wait for closing dialog box
                yield return(new WaitWhile(() => gameData.dialogEnabled));

                //Decreasing money by moneyloss amount
                gameData.money -= moneyLoss;

                if (gameData.isFirstDragonfly)
                {
                    gameData.isFirstDragonfly = false;
                    //SHOW THE CORRISPONDENT LESSON
                    ClassDb.levelMessageManager.StartShowLessonFirstTime(threat);
                    //wait for closing dialog box
                    yield return(new WaitWhile(() => gameData.dialogEnabled));
                }
                break;

            case StaticDb.ThreatAttack.malware:

                //Stop all time events before setting money loss
                ClassDb.timeEventManager.StopTimeEventList(gameData.timeEventList);

                //set money loss until scan has been executed and check flag to start money loss
                gameData.moneyLossList[StaticDb.ThreatAttack.malware] += threat.moneyLossPerMinute * gameData.totalMoneyEarnPerMinute;

                //Calculate money loss according to the formula moneyLossPerMinute * 60 * threat number of hour
                moneyLoss = threat.moneyLossPerMinute * 60 * threat.deployTime;

                //Inform how much money has been lost
                ClassDb.levelMessageManager.StartMoneyLoss(threat.threatType, moneyLoss);

                //wait for closing dialog box
                yield return(new WaitWhile(() => gameData.dialogEnabled));

                //Decreasing money by moneyloss amount
                gameData.money -= moneyLoss;

                if (gameData.isFirstMalware)
                {
                    gameData.isFirstMalware = false;
                    //SHOW THE CORRISPONDENT LESSON
                    ClassDb.levelMessageManager.StartShowLessonFirstTime(threat);
                    //wait for closing dialog box
                    yield return(new WaitWhile(() => gameData.dialogEnabled));
                }
                break;

            case StaticDb.ThreatAttack.createRemote:

                ClassDb.spawnCharacter.RemoveAi(threat.aiController.gameObject);

                //WAIT BEFORE CREATE NEW THREAT
                yield return(new WaitWhile(() => threat.aiController.pathUpdated));

                gameData.localThreats.Remove(threat);

                Threat newThreat = ClassDb.threatManager.NewFromCreateRemoteThreat();

                InstantiateNewThreat(newThreat);
                yield break;

            case StaticDb.ThreatAttack.timeEvent:
                break;

            case StaticDb.ThreatAttack.fakeLocal:

                ClassDb.spawnCharacter.RemoveAi(threat.aiController.gameObject);

                gameData.localThreats.Remove(threat);

                //Calculate money earn according to the formula moneyLossPerMinute * 60 * threat number of hour
                int moneyEarn = (int)(threat.moneyLossPerMinute * 60 * threat.deployTime);

                gameData.money += moneyEarn;

                yield break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            //check if threat was originated from create remote
            if (threat.fromCreateRemote)
            {
                //show dialog to display lesson about mixed attack
                ClassDb.levelMessageManager.StartShowLessonFromRemote();
            }

            AfterDeployThreat(threat);
        }
        else
        {
            switch (threat.threatType)
            {
            case StaticDb.ThreatType.local:
                threat.aiController.onClickAi = false;

                StopLocalThreat(threat);

                ClassDb.spawnCharacter.RemoveAi(threat.aiController.gameObject);

                ClassDb.levelMessageManager.StartThreatStopped(threat);
                yield break;

            case StaticDb.ThreatType.remote:
                yield break;

            case StaticDb.ThreatType.fakeLocal:
                threat.aiController.onClickAi = false;

                StopLocalThreat(threat);

                ClassDb.spawnCharacter.RemoveAi(threat.aiController.gameObject);

                ClassDb.levelMessageManager.StartFakeThreatStopped(threat);
                yield break;

            case StaticDb.ThreatType.timeEvent:
                yield break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
    }
Ejemplo n.º 9
0
 public void StartThreatManagementResultData(Threat threat)
 {
     threatManagementRoutine = ThreatManagementResultData(threat);
     StartCoroutine(threatManagementRoutine);
 }
Ejemplo n.º 10
0
 public DefaultThreatEvent(Threat threat)
 {
     Threat = threat;
 }
Ejemplo n.º 11
0
 public ThreatWindow(Threat threat)
 {
     InitializeComponent();
     _threat.Add(threat);
     dataGrid.DataContext = _threat;
 }
Ejemplo n.º 12
0
 public bool IsMatch(Threat threat)
 {
     return(threat.ThreatName.ToLower().Contains("boy"));
 }
Ejemplo n.º 13
0
 public bool IsMatch(Threat threat)
 {
     return(threat.ThreatName.ToLower().Contains("man") && !threat.ThreatName.ToLower().Contains("wo"));
 }
    private ThreatList SearchBoards(Coordinate node)
    {
        ThreatList res = new ThreatList ();
        int turn = attacker;

        Item tmpval;
        int digit1 = 0;
        int digit2 = 0;
        int digit3 = 0;
        int digit4 = 0;
        for (int j = 8; j >= 0; --j)
        {
            if (j + node.X - 4 >= 0 && j + node.X - 4 < board.GetLength(0))
            {
                digit1 += board[node.X + j - 4, node.Y] * turn + 1;
                //			Console.WriteLine("Grabbing {0}/{1}", node.move.x + j - 4, node.move.y);
            }
            else digit1 += 3;
            if (j + node.Y - 4 >= 0 && j + node.Y - 4 < board.GetLength(1))
            {
                digit2 += board[node.X, node.Y + j - 4] * turn + 1;
                //			Console.WriteLine("Grabbing {0}/{1}", node.move.x , node.move.y + j -4);
            }
            else digit2 += 3;
            if (node.X + j - 4 >= 0 && node.X + j - 4 < board.GetLength(0) &&
                node.Y + j - 4 >= 0 && node.Y + j - 4 < board.GetLength(1) )
            {
                digit3 += board[node.X + j - 4, node.Y + j - 4] * turn + 1;
                //			Console.WriteLine("Grabbing {0}/{1}", node.move.x + j - 4, node.move.y + j - 4);
            }
            else digit3 += 3;
            if (node.X - j + 4 >= 0 && node.X - j + 4 < board.GetLength(0) &&
                node.Y + j - 4 >= 0 && node.Y + j - 4 < board.GetLength(1) )
            {
                digit4 += board[node.X - j + 4, node.Y + j - 4] * turn + 1;
                //			Console.WriteLine("Grabbing {0}/{1}", node.move.x - j + 4, node.move.y + j - 4);
            }
            else digit4 += 3;
            if (j != 0)
            {
                digit1 <<= 2;
                digit2 <<= 2;
                digit3 <<= 2;
                digit4 <<= 2;
            }
        }

        tmpval = table[digit1];

        if (tmpval != null && (tmpval.create == false || create == true))
        {
            //Console.WriteLine("horz category: {0}", tmpval.category);
            ArrayList moves = new ArrayList();
            foreach(int field in tmpval.fields)
            {
                moves.Add(new Coordinate(node.X + tmpval.offset + field, node.Y));
            }
            Threat t = new Threat(node, tmpval.category, moves, tmpval.create);
            res.Add(t);
        }
        tmpval = table[digit2];
        if (tmpval != null && (tmpval.create == false || create == true))
        {
            //Console.WriteLine("vert category: {0}", tmpval.category);
            //Console.WriteLine("Node: {0}", node);
            //Console.WriteLine("offset: {0}", tmpval.offset);
            ArrayList moves = new ArrayList();
            foreach(int field in tmpval.fields)
            {
                //Coordinate tmp = new Coordinate(node.X , node.Y + tmpval.offset + field);
                //Console.WriteLine("adding move: {0}", tmp);
                moves.Add(new Coordinate(node.X, node.Y + tmpval.offset + field));
            }
            Threat t = new Threat(node, tmpval.category, moves, tmpval.create);
            res.Add(t);
        }
        tmpval = table[digit3];
        if (tmpval != null && (tmpval.create == false || create == true))
        {
            //Console.WriteLine("diag 1 category: {0}", tmpval.category);
            ArrayList moves = new ArrayList();
            foreach(int field in tmpval.fields)
            {
                moves.Add(new Coordinate(node.X + tmpval.offset + field, node.Y + tmpval.offset + field));
            }
            Threat t = new Threat(node, tmpval.category, moves, tmpval.create);
            res.Add(t);
        }
        tmpval = table[digit4];
        if (tmpval != null && (tmpval.create == false || create == true))
        {
            //Console.WriteLine("diag 2 category: {0}", tmpval.category);
            //Console.WriteLine("Node: {0}", node);
            //Console.WriteLine("offset: {0}", tmpval.offset);
            ArrayList moves = new ArrayList();
            foreach(int field in tmpval.fields)
            {
                //Coordinate tmp = new Coordinate(node.X -(tmpval.offset + field), node.Y + tmpval.offset + field);
                //Console.WriteLine("adding move: {0}", tmp);
                moves.Add(new Coordinate(node.X -(tmpval.offset + field), node.Y + tmpval.offset + field));
            }
            Threat t = new Threat(node, tmpval.category, moves, tmpval.create);
            res.Add(t);
        }

        return res;
    }
Ejemplo n.º 15
0
    //Method to check for horizontal win. Check is performed to right left of last placed piece.
    //Need to implement a check for gap in line that doesnt flag as win.
    public Threat CheckHorizontal(int[,] gameBoard, int player, int xPos, int yPos)
    {
        int connectScore = 0;

        Threat newThreat = new Threat(connectScore, player, 0, 1);

        //Starting at (xPos, yPos), check to right
        //----------------------------------------------------------------------------------------------------------

        for (int x = xPos; x < gameBoard.GetLength(0); x++)
        {
            //Compare state of cell with the desired state. If they match, increment score
            if (gameBoard[x, yPos] == player)
            {
                connectScore++;
            }

            //If an opponent's piece is found, break.
            else if (gameBoard[x, yPos] == (3 - player))
            {
                break;
            }

            //If an empty space is found, set threat status to open and break.
            //Commented code below would check for a break in a line of pieces. However this leads to false win detections.
            else if (gameBoard[x, yPos] == 0)
            {
                /*//If not the edge of the board
                 * if (x+1 < gameBoard.GetLength(0))
                 * {
                 *  //If there is an empty space, check the next space too (used to find threats with gaps in them)
                 *  if (gameBoard[x + 1, yPos] != player)
                 *  {
                 *      newThreat.open++;
                 *      break;
                 *  }
                 * }
                 *
                 * else
                 * {
                 *  newThreat.open++;
                 *  break;
                 * }*/

                newThreat.open++;
                break;
            }
        }
        //----------------------------------------------------------------------------------------------------------


        //Starting at position to left of (xPos, yPos) (so that the piece does not get counted twice), check to left
        //----------------------------------------------------------------------------------------------------------

        for (int x = xPos - 1; x >= 0; x--)
        {
            //Compare state of cell with the desired state. If they match, increment score
            if (gameBoard[x, yPos] == player)
            {
                connectScore++;
            }

            //If an opponent's piece is found, break.
            else if (gameBoard[x, yPos] == (3 - player))
            {
                break;
            }

            //If an empty space is found, set threat status to open and break.
            else if (gameBoard[x, yPos] == 0)
            {
                newThreat.open++;
                break;
            }
        }
        //----------------------------------------------------------------------------------------------------------

        newThreat.length = connectScore;

        return(newThreat);
    }
Ejemplo n.º 16
0
 public LoseException(Threat threat)
 {
     Threat = threat;
 }
Ejemplo n.º 17
0
 public object Clone()
 {
     Threat res = new Threat(cause, category, (ArrayList)fields.Clone(), create);
     return res;
 }
Ejemplo n.º 18
0
        private void refreshThreatDBToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Обновить список угроз
            if (MessageBox.Show("Будет проведено сравнение локальной базы угроз с данными из файла \"thrlist.xlsx\" и автоматическое обновление данных.\nПродолжить?", "Ахтунг!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                using (KPSZIContext db = new KPSZIContext())
                {
                    try
                    {
                        FileInfo      fi = new FileInfo("thrlist.xlsx");
                        List <Threat> listThreatsFromFile = Threat.GetThreatsFromXlsx(fi, db);
                        List <Threat> listThreatsFromDB   = db.Threats.OrderBy(t => t.ThreatNumber).ToList();

                        DateTime lastUpdateOfLocalDB;
                        if (listThreatsFromDB != null)
                        {
                            // Получение даты последнего обновления угроз из БД
                            lastUpdateOfLocalDB = listThreatsFromDB.Select(t => t.DateOfChange).Max();
                        }
                        else
                        {
                            lastUpdateOfLocalDB = DateTime.MinValue;
                        }

                        // Получение даты последнего обновления угроз из актуального файла с угрозами
                        DateTime lastUpdateOfFile = listThreatsFromFile.Select(t => t.DateOfChange).Max();

                        // Если нет изменений, то прекратить обновление
                        if (lastUpdateOfLocalDB == lastUpdateOfFile)
                        {
                            MessageBox.Show("База угроз не требует обновления!", "КПСЗИ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }

                        // Отбор угроз, претерпевших изменения
                        List <Threat> listChangedOrAddedThreats = listThreatsFromFile.Where(t => t.DateOfChange > lastUpdateOfLocalDB).ToList();

                        // Внесение изменений
                        foreach (Threat thr in listChangedOrAddedThreats)
                        {
                            Threat ThrFromDB = listThreatsFromDB.Where(t => t.ThreatNumber == thr.ThreatNumber).FirstOrDefault();

                            if (ThrFromDB == null)
                            {
                                //listThreatsFromDB.Add(thr);
                                db.Threats.Add(thr);

                                continue;
                            }

                            ThrFromDB.AvailabilityViolation = thr.AvailabilityViolation;
                            ThrFromDB.ConfidenceViolation   = thr.ConfidenceViolation;
                            ThrFromDB.DateOfAdd             = thr.DateOfAdd;
                            ThrFromDB.DateOfChange          = thr.DateOfChange;
                            ThrFromDB.Description           = thr.Description;
                            ThrFromDB.IntegrityViolation    = thr.IntegrityViolation;
                            ThrFromDB.Name = thr.Name;
                            ThrFromDB.ObjectOfInfluence = thr.Name;
                            ThrFromDB.ThreatNumber      = thr.ThreatNumber;
                            ThrFromDB.ThreatSources     = thr.ThreatSources;
                        }

                        db.SaveChanges();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("В refreshThreatDBToolStripMenuItem_Click Exception!\n" + ex.Message, "Ахтунг!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                MessageBox.Show("Список угроз обновлен", "Это успех, парень!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 19
0
    public Threat NewRandomLevel1Threat()
    {
        int id = ++manager.GetGameData().lastThreatId;

        StaticDb.ThreatType threatType = (StaticDb.ThreatType)Random.Range(0, 3);

        float deployTime = Random.Range(2f, 6f);

        StaticDb.ThreatAttacker threatAttacker;

        switch (threatType)
        {
        case StaticDb.ThreatType.local:
            threatAttacker = (StaticDb.ThreatAttacker)Random.Range(0, 2);
            break;

        case StaticDb.ThreatType.remote:
            threatAttacker = StaticDb.ThreatAttacker.external;
            break;

        case StaticDb.ThreatType.fakeLocal:
            threatAttacker = StaticDb.ThreatAttacker.intern;
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }

        StaticDb.ThreatAttack threatAttack;

        switch (threatType)
        {
        case StaticDb.ThreatType.local:
            do
            {
                threatAttack = (StaticDb.ThreatAttack)manager.GetGameData().threatRandomizer.GetNext();
            } while ((int)threatAttack < 3 ||
                     threatAttack == StaticDb.ThreatAttack.stuxnet ||
                     threatAttack == StaticDb.ThreatAttack.dragonfly ||
                     threatAttack == StaticDb.ThreatAttack.createRemote);
            break;

        case StaticDb.ThreatType.remote:
            do
            {
                threatAttack = (StaticDb.ThreatAttack)manager.GetGameData().threatRandomizer.GetNext();
            } while ((int)threatAttack > 5 ||
                     threatAttack == StaticDb.ThreatAttack.replay ||
                     threatAttack == StaticDb.ThreatAttack.stuxnet ||
                     threatAttack == StaticDb.ThreatAttack.dragonfly);
            break;

        case StaticDb.ThreatType.fakeLocal:
            threatAttack = StaticDb.ThreatAttack.fakeLocal;
            break;

        case StaticDb.ThreatType.timeEvent:
            threatAttack = StaticDb.ThreatAttack.timeEvent;
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }

        StaticDb.ThreatDanger threatDanger = threatType == StaticDb.ThreatType.fakeLocal
            ? StaticDb.ThreatDanger.fakeLocal
            : (StaticDb.ThreatDanger)Random.Range(0, 3);

        float moneyLossPerMinute;

        switch (threatDanger)
        {
        case StaticDb.ThreatDanger.low:
            moneyLossPerMinute = Random.Range(2f, 2.5f);
            break;

        case StaticDb.ThreatDanger.medium:
            moneyLossPerMinute = Random.Range(3f, 3.5f);
            break;

        case StaticDb.ThreatDanger.high:
            moneyLossPerMinute = Random.Range(4f, 4.5f);
            break;

        case StaticDb.ThreatDanger.fakeLocal:
            moneyLossPerMinute = Random.Range(4f, 4.5f);
            break;

        case StaticDb.ThreatDanger.timeEvent:
            moneyLossPerMinute = 0;
            break;

        default:
            moneyLossPerMinute = 0;
            break;
        }

        WeightedRandomizer <int> rand = new WeightedRandomizer <int>();

        rand.AddOrUpdateWeight((int)StaticDb.ThreatAttack.dos, 0.1f);

        Threat threat = new Threat(id, threatType, deployTime, threatAttacker, threatDanger, threatAttack, moneyLossPerMinute, false);

        //Debug.Log(threat);

        return(threat);
    }
Ejemplo n.º 20
0
    public void RegisterThreatSolution(UserAction action, Threat threat, bool isThreatDetected)
    {
        List <StaticDb.ThreatSolution> threatSolutions = new List <StaticDb.ThreatSolution>();

        if (isThreatDetected)
        {
            //THE RIGHT ACTION IS TO CHECK IDS
            threatSolutions.Add(StaticDb.ThreatSolution.idsClean);
        }
        else
        {
            //RIGHT ACTION DEPENDS TO THREAT ATTACK TYPE
            switch (threat.threatAttack)
            {
            case StaticDb.ThreatAttack.dos:
                threatSolutions.Add(StaticDb.ThreatSolution.reboot);
                break;

            case StaticDb.ThreatAttack.phishing:
                break;

            case StaticDb.ThreatAttack.replay:
                threatSolutions.Add(StaticDb.ThreatSolution.plantCheck);
                threatSolutions.Add(StaticDb.ThreatSolution.networkCheck);
                break;

            case StaticDb.ThreatAttack.mitm:
                threatSolutions.Add(StaticDb.ThreatSolution.networkCheck);
                break;

            case StaticDb.ThreatAttack.stuxnet:
                threatSolutions.Add(StaticDb.ThreatSolution.plantCheck);
                threatSolutions.Add(StaticDb.ThreatSolution.malwareScan);
                break;

            case StaticDb.ThreatAttack.dragonfly:
                threatSolutions.Add(StaticDb.ThreatSolution.malwareScan);
                threatSolutions.Add(StaticDb.ThreatSolution.networkCheck);
                break;

            case StaticDb.ThreatAttack.malware:
                threatSolutions.Add(StaticDb.ThreatSolution.malwareScan);
                break;

            case StaticDb.ThreatAttack.createRemote:
                break;

            case StaticDb.ThreatAttack.fakeLocal:
                break;

            case StaticDb.ThreatAttack.timeEvent:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }

        foreach (StaticDb.ThreatSolution threatSolution in threatSolutions)
        {
            ClassDb.logManager.StartWritePlayerLogRoutine(StaticDb.player, StaticDb.logEvent.UserEvent,
                                                          action.solution == threatSolution ? "CORRECT ACTION" : "WRONG ACTION");
        }
    }
 public void StartThreatDeployed(Threat threat)
 {
     deployRoutine = ThreatDeployed(threat);
     StartCoroutine(deployRoutine);
 }
Ejemplo n.º 22
0
    public void NewThreat()
    {
        Threat threat = ClassDb.threatManager.NewRandomLevel1Threat();

        InstantiateNewThreat(threat);
    }
 public void StartThreatStopped(Threat threat)
 {
     stopRoutine = ThreatStopped(threat);
     StartCoroutine(stopRoutine);
 }
Ejemplo n.º 24
0
    //REMOVE AI AND POP UP A DIALOG BOX
    public bool BeforeDeployThreat(Threat threat)
    {
        if (threat.threatType == StaticDb.ThreatType.remote && !gameData.isFirewallActive)
        {
            ClassDb.spawnCharacter.RemoveAi(threat.aiController.gameObject);
            ClassDb.levelMessageManager.StartThreatDeployed(threat);

            return(true);
        }

        float threatSuccessRate = Random.Range(0, 100);

        switch (threat.threatAttack)
        {
        case StaticDb.ThreatAttack.dos:
            if (!(threatSuccessRate < gameData.defenseDos))
            {
                break;
            }
            ClassDb.spawnCharacter.RemoveAi(threat.aiController.gameObject);
            ClassDb.levelMessageManager.StartThreatStopped(threat);
            return(false);

        case StaticDb.ThreatAttack.phishing:
            if (!(threatSuccessRate < gameData.defensePhishing))
            {
                break;
            }
            ClassDb.spawnCharacter.RemoveAi(threat.aiController.gameObject);
            ClassDb.levelMessageManager.StartThreatStopped(threat);
            return(false);

        case StaticDb.ThreatAttack.replay:
            if (!(threatSuccessRate < gameData.defenseReplay))
            {
                break;
            }
            ClassDb.spawnCharacter.RemoveAi(threat.aiController.gameObject);
            ClassDb.levelMessageManager.StartThreatStopped(threat);
            return(false);

        case StaticDb.ThreatAttack.mitm:
            if (!(threatSuccessRate < gameData.defenseMitm))
            {
                break;
            }
            ClassDb.spawnCharacter.RemoveAi(threat.aiController.gameObject);
            ClassDb.levelMessageManager.StartThreatStopped(threat);
            return(false);

        case StaticDb.ThreatAttack.stuxnet:
            if (!(threatSuccessRate < gameData.defenseStuxnet))
            {
                break;
            }
            ClassDb.spawnCharacter.RemoveAi(threat.aiController.gameObject);
            ClassDb.levelMessageManager.StartThreatStopped(threat);
            return(false);

        case StaticDb.ThreatAttack.dragonfly:
            if (!(threatSuccessRate < gameData.defenseDragonfly))
            {
                break;
            }
            ClassDb.spawnCharacter.RemoveAi(threat.aiController.gameObject);
            ClassDb.levelMessageManager.StartThreatStopped(threat);
            return(false);

        case StaticDb.ThreatAttack.malware:
            if (!(threatSuccessRate < gameData.defenseMalware))
            {
                break;
            }
            ClassDb.spawnCharacter.RemoveAi(threat.aiController.gameObject);
            ClassDb.levelMessageManager.StartThreatStopped(threat);
            return(false);

        case StaticDb.ThreatAttack.createRemote:
            if (!(threatSuccessRate < gameData.defenseCreateRemote))
            {
                break;
            }
            ClassDb.spawnCharacter.RemoveAi(threat.aiController.gameObject);
            ClassDb.levelMessageManager.StartThreatStopped(threat);
            return(false);

        case StaticDb.ThreatAttack.fakeLocal:
            break;

        case StaticDb.ThreatAttack.timeEvent:
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }
        threat.aiController.onClickAi = false;
        ClassDb.spawnCharacter.RemoveAi(threat.aiController.gameObject);
        ClassDb.levelMessageManager.StartThreatDeployed(threat);

        return(true);
    }
    private IEnumerator ThreatStopped(Threat threat)
    {
        yield return(new WaitForSeconds(messageDelay));

        manager.GetGameData().lastThreatStopped = threat;

        Canvas dialog = ClassDb.dialogBoxManager.OpenDialog();

        DialogBoxMessage message;

        switch (threat.threatType)
        {
        case StaticDb.ThreatType.local:
            message = MessageFromJson(Resources.Load <TextAsset>(StaticDb.localStopped));
            break;

        case StaticDb.ThreatType.remote:
            message = MessageFromJson(Resources.Load <TextAsset>(StaticDb.remoteStopped));
            break;

        case StaticDb.ThreatType.fakeLocal:
            message = MessageFromJson(Resources.Load <TextAsset>(StaticDb.fakeLocalStopped));
            break;

        case StaticDb.ThreatType.timeEvent:
            ClassDb.dialogBoxManager.CloseDialog(dialog);
            yield break;

        default:
            throw new ArgumentOutOfRangeException();
        }

        DialogBoxMessage messageIntern;

        if (threat.threatType != StaticDb.ThreatType.fakeLocal)
        {
            messageIntern = threat.threatAttacker == StaticDb.ThreatAttacker.intern
                ? MessageFromJson(Resources.Load <TextAsset>(StaticDb.internalMessage))
                : StaticDb.emptyMessage;
        }
        else
        {
            messageIntern = StaticDb.emptyMessage;
        }

        dialog.GetComponent <DialogBoxManager>().SetDialog(
            message.head,
            message.body + "\n" + messageIntern.body,
            message.backBtn,
            message.nextBtn,
            dialog
            );

        dialog.GetComponent <DialogBoxManager>().dialogBoxBtnNext.onClick.RemoveAllListeners();
        dialog.GetComponent <DialogBoxManager>().dialogBoxBtnNext.gameObject.SetActive(true);
        dialog.GetComponent <DialogBoxManager>().dialogBoxBtnNext.onClick.AddListener(delegate
        {
            ClassDb.dialogBoxManager.CloseDialog(dialog);
        });

        dialog.GetComponent <DialogBoxManager>().dialogBoxBtnBack.onClick.RemoveAllListeners();
        dialog.GetComponent <DialogBoxManager>().dialogBoxBtnBack.gameObject.SetActive(false);
    }
Ejemplo n.º 26
0
 public void ReturnCrewFromMission(CrewDie crew, Threat threat)
 {
     crew.State       = CrewState.Returning;
     crew.MissionName = string.Empty;
     _eventManager.Trigger("RemoveCrewFromMission", new RemoveCrewFromMissionEvent(threat.Name, crew.Type));
 }
 public void StartFakeThreatStopped(Threat threat)
 {
     fakeStopRoutine = FakeThreatStopped(threat);
     StartCoroutine(fakeStopRoutine);
 }
        public bool TryParseThreats(FileInfo file, out List <Threat> list)
        {
            list = new List <Threat>();
            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
            using (ExcelPackage excelPkg = new ExcelPackage(file))
            {
                ExcelWorksheet worksheet;
                try
                {
                    worksheet = excelPkg.Workbook.Worksheets.First();
                }
                catch (Exception)
                {
                    return(false);
                }
                int totalRows = worksheet.Dimension.End.Row;
                if (!(worksheet.Cells[2, 1].Value.ToString() == ("Идентификатор УБИ") &&
                      worksheet.Cells[2, 2].Value.ToString() == ("Наименование УБИ") &&
                      worksheet.Cells[2, 3].Value.ToString() == ("Описание") &&
                      worksheet.Cells[2, 4].Value.ToString() == ("Источник угрозы (характеристика и потенциал нарушителя)") &&
                      worksheet.Cells[2, 5].Value.ToString() == ("Объект воздействия") &&
                      worksheet.Cells[2, 6].Value.ToString() == ("Нарушение конфиденциальности") &&
                      worksheet.Cells[2, 7].Value.ToString() == ("Нарушение целостности") &&
                      worksheet.Cells[2, 8].Value.ToString() == ("Нарушение доступности")
                      ))
                {
                    return(false);
                }
                for (int rowId = 3; rowId <= totalRows; rowId++)
                {
                    try
                    {
                        long   id          = long.Parse(worksheet.Cells[rowId, 1].Text);
                        string name        = worksheet.Cells[rowId, 2].Text;
                        string description = worksheet.Cells[rowId, 3].Text;
                        string source      = worksheet.Cells[rowId, 4].Text;
                        string actObject   = worksheet.Cells[rowId, 5].Text;

                        string privacyViolation, integrityViolation, availabilityViolation;
                        string tmp = worksheet.Cells[rowId, 6].Text;
                        if (tmp == "1")
                        {
                            privacyViolation = "да";
                        }
                        else if (tmp == "0")
                        {
                            privacyViolation = "нет";
                        }
                        else
                        {
                            throw new FormatException();
                        }
                        tmp = worksheet.Cells[rowId, 7].Text;
                        if (tmp == "1")
                        {
                            integrityViolation = "да";
                        }
                        else if (tmp == "0")
                        {
                            integrityViolation = "нет";
                        }
                        else
                        {
                            throw new FormatException();
                        }
                        tmp = worksheet.Cells[rowId, 8].Text;
                        if (tmp == "1")
                        {
                            availabilityViolation = "да";
                        }
                        else if (tmp == "0")
                        {
                            availabilityViolation = "нет";
                        }
                        else
                        {
                            throw new FormatException();
                        }

                        Threat threat = new Threat(id, name, description, source, actObject, privacyViolation, integrityViolation, availabilityViolation);
                        list.Add(threat);
                    }
                    catch (FormatException)
                    {
                        return(false);
                    }
                }
                return(true);
            }
        }
 public void StartShowLessonFirstTime(Threat threat)
 {
     showLessonFirstTimeRoutine = ShowLessonFirstTime(threat);
     StartCoroutine(showLessonFirstTimeRoutine);
 }
Ejemplo n.º 30
0
    //Method to check for right diagonal win. Check is performed to bottom left and top right of last placed piece
    public Threat CheckDiagonalRight(int[,] gameBoard, int player, int xPos, int yPos)
    {
        int connectScore = 0;
        int y            = yPos;

        Threat newThreat = new Threat(connectScore, player, 0, 3);

        //Starting at position of last piece placed, check to top right
        //----------------------------------------------------------------------------------------------------------

        for (int x = xPos; x < gameBoard.GetLength(0); x++)
        {
            //Compare state of cell with the desired state. If they match, increment score
            if (gameBoard[x, y] == player)
            {
                connectScore++;
            }

            //If an opponent's piece is found, break.
            else if (gameBoard[x, y] == (3 - player))
            {
                break;
            }

            //If an empty space is found, set threat status to open and break.
            else if (gameBoard[x, y] == 0)
            {
                newThreat.open++;
                break;
            }

            //Move y position up one place for next check
            if (y < 5)
            {
                y++;
            }

            //If top of board, break.
            else
            {
                break;
            }
        }
        //----------------------------------------------------------------------------------------------------------



        //Starting at position to bottom left of last piece placed, check to bottom left
        //----------------------------------------------------------------------------------------------------------

        //Reset y position and minus 1 so that the piece does not get counted twice
        y = yPos - 1;

        if (y >= 0)
        {
            for (int x = xPos - 1; x >= 0; x--)
            {
                //Compare state of cell with the desired state. If they match, increment score
                if (gameBoard[x, y] == player)
                {
                    connectScore++;
                }

                //If an opponent's piece is found, break.
                else if (gameBoard[x, y] == (3 - player))
                {
                    break;
                }

                //If an empty space is found, set threat status to open and break.
                else if (gameBoard[x, y] == 0)
                {
                    newThreat.open++;
                    break;
                }

                //Move y position down one place for next check
                if (y > 0)
                {
                    y--;
                }

                //If bottom of board, break.
                else
                {
                    break;
                }
            }
        }

        //----------------------------------------------------------------------------------------------------------

        newThreat.length = connectScore;

        return(newThreat);
    }
Ejemplo n.º 31
0
 public ThreatViewModel(Threat model, string RiskResult)
 {
     m_RiskGroupResult = RiskResult;
     m_Model           = model;
 }
Ejemplo n.º 32
0
        public UpdateReport AutomationUpdate()
        {
            //TODO: доделать успешность обновления
            var report = new UpdateReport()
            {
                IsSuccessed = true
            };

            using (var client = new WebClient())
            {
                try
                {
                    client.DownloadFile(sourceFileUrl, sourceFileName);
                }
                catch (ArgumentNullException)
                {
                    report.IsSuccessed  = false;
                    report.ErrorMessage = "Отсутствует Url адреса для скачивания файла.";
                    return(report);
                }
                catch (WebException)
                {
                    report.IsSuccessed  = false;
                    report.ErrorMessage = "Возможные проблемы: отсутствие интернета, некорректный Url адрес для скачивания файла, файл для сохранения уже существует и используется другой программой.";
                    return(report);
                }
                catch (Exception ex)
                {
                    report.IsSuccessed  = false;
                    report.ErrorMessage = ex.Message;
                    return(report);
                }
            }

            var oldThreatsAsEnumerable = threatRepository.GetAllThreats();

            List <Threat> oldThreats = oldThreatsAsEnumerable != null? new List <Threat>(oldThreatsAsEnumerable):null;

            var newThreats = new List <Threat>();

            ExcelPackage package;

            try
            {
                package = new ExcelPackage(new FileInfo(sourceFileName));
            }
            catch (Exception)
            {
                report.IsSuccessed  = false;
                report.ErrorMessage = "Загруженный файл повреждён или имеет неверный формат.";
                return(report);
            }
            var sheet = package.Workbook.Worksheets.FirstOrDefault();
            int row   = 3;

            while (true)
            {
                var cells = sheet.Cells;

                if (cells[row, 1].Value == null)
                {
                    break;
                }

                Threat threat;

                try
                {
                    var id                       = int.Parse(cells[row, 1].Value.ToString());
                    var name                     = cells[row, 2].Value.ToString();
                    var description              = cells[row, 3].Value.ToString();
                    var source                   = cells[row, 4].Value.ToString();
                    var influenceObject          = cells[row, 5].Value.ToString();
                    var confidentialityViolation = int.Parse(cells[row, 6].Value.ToString()) == 1;
                    var integrityViolation       = int.Parse(cells[row, 7].Value.ToString()) == 1;
                    var accessibilityViolation   = int.Parse(cells[row, 8].Value.ToString()) == 1;

                    threat = new Threat()
                    {
                        Id                       = id,
                        Name                     = name,
                        Description              = description,
                        Source                   = source,
                        InfluenceObject          = influenceObject,
                        ConfidentialityViolation = confidentialityViolation,
                        IntegrityViolation       = integrityViolation,
                        AccessibilityViolation   = accessibilityViolation
                    };
                }
                catch (Exception)
                {
                    report.IsSuccessed  = false;
                    report.ErrorMessage = "Загруженный файл повреждён или имеет неверный формат.";
                    return(report);
                }

                if (oldThreats != null && row - 3 < oldThreats.Count)
                {
                    var index = row - 3;
                    if (index < oldThreats.Count && !oldThreats[index].Equals(threat))
                    {
                        report.Logs.Add(new ModifiedThreatLog()
                        {
                            NewThreat = threat.ToString(), OldThreat = oldThreats[index].ToString(), ThreatId = threat.Id
                        });
                    }
                }
                else
                {
                    report.Logs.Add(new ModifiedThreatLog()
                    {
                        NewThreat = threat.ToString(), OldThreat = null, ThreatId = threat.Id
                    });
                }

                newThreats.Add(threat);

                row++;
            }

            if (oldThreats != null && row - 3 < oldThreats.Count)
            {
                for (int i = row - 3; i < oldThreats.Count; i++)
                {
                    report.Logs.Add(new ModifiedThreatLog()
                    {
                        NewThreat = null, OldThreat = oldThreats[i].ToString(), ThreatId = oldThreats[i].Id
                    });
                }
            }

            SaveThreats(newThreats);

            return(report);
        }
        public bool InvestigateThreat(Threat threat)
        {
            var isMatch = _threatRules.FirstOrDefault(r => r.IsMatch(threat));

            return(isMatch != null?IndentifyAsHuman(isMatch) : true);
        }
Ejemplo n.º 34
0
    public static List <Threat> GetFirstThreats(User u)
    {
        List <Threat> result = new List <Threat>();

        string name   = "Угроза деструктивного изменения конфигурации среды ПО";
        Threat threat = new Threat(name, Rating.Low, Rating.Low, new List <Asset> {
            u.GetAsset(3)
        });

        result.Add(threat);

        name   = "Угроза перехвата управления информационной системы";
        threat = new Threat(name, Rating.Low, Rating.Low, new List <Asset> {
            u.GetAsset(3)
        });
        result.Add(threat);

        name   = "Угроза хищения средств, хранения, обработки и (или) ввода/вывода/передачи информации";
        threat = new Threat(name, Rating.Low, Rating.High, new List <Asset> {
            u.GetAsset(2), u.GetAsset(4)
        });
        result.Add(threat);

        name   = "Угроза физического выведения из стро средств хранения обработки и(или) ввода/вывода/передачи информации";
        threat = new Threat(name, Rating.Medium, Rating.High, new List <Asset> {
            u.GetAsset(2), u.GetAsset(4), u.GetAsset(7), u.GetAsset(8)
        });
        result.Add(threat);

        name   = "Угроза изменения компонентов системы";
        threat = new Threat(name, Rating.Low, Rating.Low, new List <Asset> {
            u.GetAsset(2), u.GetAsset(4), u.GetAsset(7), u.GetAsset(8)
        });
        result.Add(threat);

        name   = "Угроза нарушение энергоснабжения";
        threat = new Threat(name, Rating.Medium, Rating.High, new List <Asset> {
            u.GetAsset(2), u.GetAsset(4), u.GetAsset(8)
        });
        result.Add(threat);

        name   = "Угроза перехвата компрометирующих помех";
        threat = new Threat(name, Rating.Medium, Rating.Low, new List <Asset> {
            u.GetAsset(0), u.GetAsset(1)
        });
        result.Add(threat);

        name   = "Угроза нарушения функционирования программного обеспечения";
        threat = new Threat(name, Rating.Medium, Rating.Medium, new List <Asset> {
            u.GetAsset(3)
        });
        result.Add(threat);

        name   = "Угроза физического повреждения";
        threat = new Threat(name, Rating.Medium, Rating.Medium, new List <Asset> {
            u.GetAsset(6)
        });
        result.Add(threat);

        name   = "Угроза нарушения работоспособности персонала";
        threat = new Threat(name, Rating.Medium, Rating.High, new List <Asset> {
            u.GetAsset(5)
        });
        result.Add(threat);

        return(result);
    }
Ejemplo n.º 35
0
 protected override void OnAwake()
 {
     base.OnAwake();
     threat = new Threat(this);
 }