private static void PopulateHrTickets(InsiderThreatProfile insiderThreatProfile)
 {
     var selectedTicket = new[] { "Policy Violation", "Disruptive Behavior", "Financial Hardship", "Job Performance Problem" }.RandomElement();
     var newEvent = new RelatedEvent
     {
         Reported    = AnimatorRandom.Date(),
         Description = selectedTicket
     };
 }
Beispiel #2
0
        public static EmploymentProfile GetEmployment()
        {
            var o = new EmploymentProfile();

            var numberOfJobs = AnimatorRandom.Rand.Next(0, 8);

            for (var i = 0; i < numberOfJobs; i++)
            {
                var employmentStatus = EmploymentProfile.EmploymentRecord.EmploymentStatuses.Resigned;

                var      startDate = AnimatorRandom.Date();
                DateTime?endDate   = startDate.AddDays(AnimatorRandom.Rand.Next(180, 2000));
                if (i == 0)
                {
                    endDate          = null;
                    employmentStatus = EmploymentProfile.EmploymentRecord.EmploymentStatuses.FullTime;
                }

                var raw  = File.ReadAllText("config/employment_jobtitles.json");
                var data = JsonConvert.DeserializeObject <DepartmentManager>(raw);

                var    u   = data.Departments.Sum(x => x.Probability);
                var    r   = AnimatorRandom.Rand.NextDouble() * u;
                double sum = 0;
                var    assignedDepartment = data.Departments.FirstOrDefault(x => r <= (sum += x.Probability));

                u   = assignedDepartment.Roles.Sum(x => x.Probability);
                r   = AnimatorRandom.Rand.NextDouble() * u;
                sum = 0;
                var assignedRole = assignedDepartment.Roles.FirstOrDefault(x => r <= (sum += x.Probability));

                var job = new EmploymentProfile.EmploymentRecord();
                job.Company    = CompanyName();
                job.Department = assignedDepartment.Department;
                job.JobTitle   = assignedRole.Title;
                job.Email      = $"{Npc.NpcProfile.Name.ToString().ToAccountSafeString()}@{job.Company.ToAccountSafeString()}.com".Replace("..", ".");
                //job.Manager
                job.Organization     = job.Company;
                job.Phone            = $"{PhoneNumber.GetPhoneNumber()} x####".Numerify();
                job.Salary           = AnimatorRandom.Rand.Next(assignedRole.SalaryLow, assignedRole.SalaryHigh);
                job.StartDate        = AnimatorRandom.Date();
                job.EndDate          = endDate;
                job.EmploymentStatus = employmentStatus;
                job.Level            = assignedRole.Level;

                job.Address      = Address.GetHomeAddress();
                job.Address.Name = job.Company;

                job.Address.AddressType = "Employment";
                o.EmploymentRecords.Add(job);
            }

            return(o);
        }
        public static InsiderThreatProfile GetInsiderThreatProfile()
        {
            var raw = File.ReadAllText("config/insider_threat.json");
            var o   = JsonConvert.DeserializeObject <InsiderThreatManager>(raw);

            var insiderThreatProfile = new InsiderThreatProfile();

            foreach (var profile in o.Profiles)
            {
                if (profile == null || !profile.Items.Any())
                {
                    continue;
                }

                // some random % get a violation get violation from o
                if (AnimatorRandom.Rand.Next(0, 100) > 72)
                {
                    var selectedEvent = profile.Items.RandomElement();

                    var newEvent = new RelatedEvent
                    {
                        Reported    = AnimatorRandom.Date(),
                        Description = selectedEvent.Name,
                        ReportedBy  = Name.GetName().ToString()
                    };
                    if (selectedEvent.Violation)
                    {
                        var c = o.CorrectiveActions.RandomElement();
                        newEvent.CorrectiveAction = c.Name;
                    }

                    switch (profile.Name)
                    {
                    case "AccessProfile":
                        insiderThreatProfile.Access.RelatedEvents.Add(newEvent);
                        break;

                    case "CriminalViolentOrAbusiveConductProfile":
                        insiderThreatProfile.CriminalViolentOrAbusiveConduct.RelatedEvents.Add(newEvent);
                        break;

                    case "FinancialConsiderationsProfile":
                        insiderThreatProfile.FinancialConsiderations.RelatedEvents.Add(newEvent);
                        break;

                    case "ForeignConsiderationsProfile":
                        if (Npc.NpcProfile.ForeignTravel.Trips.Any())    //probably need a trip in order to have event
                        {
                            insiderThreatProfile.ForeignConsiderations.RelatedEvents.Add(newEvent);
                        }
                        break;

                    case "JudgementCharacterAndPsychologicalConditionsProfile":
                        insiderThreatProfile.JudgementCharacterAndPsychologicalConditions.RelatedEvents.Add(newEvent);
                        break;

                    case "ProfessionalLifecycleAndPerformanceProfile":
                        insiderThreatProfile.ProfessionalLifecycleAndPerformance.RelatedEvents.Add(newEvent);
                        break;

                    case "SecurityAndComplianceIncidentsProfile":
                        insiderThreatProfile.SecurityAndComplianceIncidents.RelatedEvents.Add(newEvent);
                        break;

                    case "SubstanceAbuseAndAddictiveBehaviorsProfile":
                        insiderThreatProfile.SubstanceAbuseAndAddictiveBehaviors.RelatedEvents.Add(newEvent);
                        break;

                    case "TechnicalActivityProfile":
                        insiderThreatProfile.TechnicalActivity.RelatedEvents.Add(newEvent);
                        break;
                    }
                }
            }

            PopulateAccess(insiderThreatProfile);
            PopulateHrTickets(insiderThreatProfile);

            return(insiderThreatProfile);
        }