using System.Collections.Generic;
using System.Linq;

namespace winPEAS._3rdParty.Watson.Msrc
{
    internal static class CVE_2020_1013
    {
        private const string name = "CVE-2020-1013";

        public static void Check(VulnerabilityCollection vulnerabilities, int buildNumber, List<int> installedKBs)
        {
            var supersedence = new List<int>();

            switch (buildNumber)
            {
                case 10240:

                    supersedence.AddRange(new int[] {
                        4577049
                    });

                    break;

                case 14393:

                    supersedence.AddRange(new int[] {
                        4577015
                    });

                    break;

                case 16299:

                    supersedence.AddRange(new int[] {
                        4577041
                    });

                    break;

                case 17134:

                    supersedence.AddRange(new int[] {
                        4577032
                    });

                    break;

                case 17763:

                    supersedence.AddRange(new int[] {
                        4570333, 4577069
                    });

                    break;

                case 18362:

                    supersedence.AddRange(new int[] {
                        4574727, 4577062
                    });

                    break;

                case 18363:

                    supersedence.AddRange(new int[] {
                        4574727, 4577062
                    });

                    break;

                case 19041:

                    supersedence.AddRange(new int[] {
                        4571756, 4577063
                    });

                    break;

                default:
                    return;
            }

            if (!supersedence.Intersect(installedKBs).Any())
            {
                vulnerabilities.SetAsVulnerable(name);
            }
        }
    }
}