Esempio n. 1
0
        public static void getLOLinfo()
        {
            Console.WriteLine("Would you like to download the latest LOL data? Key in 'Y' to download. Note that the program will not work if you have not download these files at least once:");
            string option = Console.ReadLine();

            if (option.ToLower() == "y")
            {
                if (!CVEGenerator.checkForInternetConnection())
                {
                    Console.WriteLine("\n#######################################");
                    Console.WriteLine("You do not have internet access to download LOL info. Quit to try again.");
                    Console.WriteLine("#######################################\n");
                    Console.WriteLine("Skipping download........\nPress enter to continue");
                    Console.ReadLine();
                    viewLOLInfo();
                }
                else
                {
                    getURL();      //Downloads LOLBin info
                    viewLOLInfo(); // Main function to display found LOLBins and execute permissions
                }
            }
            else
            {
                viewLOLInfo();
            }
        }
Esempio n. 2
0
        [ComUnregisterFunction] //This executes if registration fails
        public static void UnRegisterClass(string key)
        {
            Console.Clear();    //Clears default ReGasm output on command prompt
            Logo.DisplayLogo(); //VulnBuster logo displayed
            int milliseconds = 2000;

            Thread.Sleep(milliseconds);
            while (true)
            {
                Console.WriteLine("Key in the corresponding number:");
                Console.WriteLine("1. Application CVE Reporting");
                Console.WriteLine("2. LOLBin Detection");
                string input = Console.ReadLine();
                if (input == "1")                    //Key in 1 to proceed to CVE Reporting function
                {
                    CVEGenerator.cveGeneratorMain(); //Function to generate CVE Text Reports
                }

                else if (input == "2") //Key in 2 to proceed to LOLBin detection function
                {
                    LOL.getLOLinfo();
                }
            }
        }
Esempio n. 3
0
        public static void cveGeneratorMain()
        {
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls12;
            List <RegistryKey> appKeys = new List <RegistryKey>();

            var    HKLM32 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32);
            var    HKLM64 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
            string subKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"; //Location in registry that shows all installed applications in sytem
            var    key64  = HKLM64.OpenSubKey(subKey);

            RegistryKey uninstallKey64 = HKLM64.OpenSubKey(subKey);
            RegistryKey uninstallKey32 = HKLM32.OpenSubKey(subKey);

            string[] allApplications64 = uninstallKey64.GetSubKeyNames(); //Array of 64 bit applications installed in system
            string[] allApplications32 = uninstallKey32.GetSubKeyNames(); //Array of 32 bit applications installed in system

            //Prompts user if they wish to download the CVE JSON files online, which will be needed to be downloaded at least once for the function to do anything
            Console.WriteLine(
                "Would you like to download the latest vulnerability databases? Key in 'Y' to download. Note that the program will not work if you have not download these files at least once:");
            string option = Console.ReadLine();

            if (option.ToLower() == "y") // If he wishes to download the CVE JSON files.....
            {
                //Checks if system has internet access. Won't be able to download CVE JSON files otherwise
                if (!CVEGenerator.checkForInternetConnection())
                {
                    Console.WriteLine("\n#######################################");
                    Console.WriteLine("You do not have internet access to download the database. Quit to try again.");
                    Console.WriteLine("#######################################\n");
                    Console.WriteLine("Skipping download........\nPress enter to continue");
                    Console.ReadLine();
                }
                else
                {
                    CVEGenerator.dlCVEDB(); //Downloads the CVE files online
                }
            }
            Console.WriteLine("Detecting all installed applications.....");
            //Short pause
            int milliseconds = 2000;

            Thread.Sleep(milliseconds);
            Console.WriteLine("\n#######################################");
            Console.WriteLine("List of installed applications:");
            Console.WriteLine("#######################################\n");
            String windowsVer = CVEGenerator.checkWindowsVersion(); //Checks your current Windows Version
            String windowsOs  = CVEGenerator.checkWindowsOS();      //Checks your current Windows OS (e.g 10, 8.1, XP)

            //Displays all applications installed and their versions
            if (allApplications64.Length != 0)
            {
                foreach (string applicationSubKeyName in allApplications64)
                {
                    RegistryKey appKey = HKLM64.OpenSubKey(subKey + "\\" + applicationSubKeyName);

                    appKeys.Add(appKey);
                    string appName    = (string)appKey.GetValue("DisplayName");
                    string appVersion = (string)appKey.GetValue("DisplayVersion");

                    if (String.IsNullOrEmpty(appName))
                    {
                        continue;
                    }
                    Console.WriteLine("Application Name: " + appName + "\nVersion: " + appVersion + "\n");
                }

                if (allApplications32.Length != 0)
                {
                    foreach (string applicationSubKeyName in allApplications32)
                    {
                        RegistryKey appKey = HKLM32.OpenSubKey(subKey + "\\" + applicationSubKeyName);

                        appKeys.Add(appKey);
                        string appName    = (string)appKey.GetValue("DisplayName");
                        string appVersion = (string)appKey.GetValue("DisplayVersion");

                        if (String.IsNullOrEmpty(appName))
                        {
                            continue;
                        }
                        Console.WriteLine("Application Name: " + appName + "\nVersion: " + appVersion + "\n");
                    }
                }

                Console.WriteLine("#######################################\n");
                bool isSearching = true;
                while (isSearching == true)
                {
                    Console.WriteLine("Key in the corresponding number:");
                    Console.WriteLine("1. Generate report for all applications installed");
                    Console.WriteLine("2. Manually select applications");
                    Console.WriteLine("3. Quit");
                    string input1 = Console.ReadLine();

                    //Quits to the previous menu
                    if (input1 == "3")
                    {
                        isSearching = false;
                        break;
                    }

                    //Generates report for all applications installed
                    if (input1 == "1")
                    {
                        String dateTimeString = DateTime.Now.ToString("MMddyyyyHHmmss");        // Current datetime as string

                        CVEGenerator.generateTextReport(windowsOs, windowsVer, dateTimeString); //Generates the CVE Text report for Windows 10
                        foreach (var appkey in appKeys)
                        {
                            try
                            {
                                CVEGenerator.generateTextReport((string)appkey.GetValue("DisplayName"), (string)appkey.GetValue("DisplayVersion"), dateTimeString); //Generates the CVE Text report for the rest of the applications
                            }
                            catch (Exception e)
                            {
                            }
                        }
                    }

                    //User has to manually key in all applications that he wishes to generate CVE reports for
                    else if (input1 == "2")
                    {
                        bool          isFound            = false;
                        bool          keepAddingPrograms = true;
                        List <string> programsToCheck    = new List <string>();
                        List <string> programVersions    = new List <string>();
                        while (keepAddingPrograms == true)
                        {
                            Console.WriteLine(
                                "\nEnter application names installed in your system that you would like to see the vulnerabilities for: (Key in 'S' to stop adding applications, 'X' to quit this mode)");
                            string input = Console.ReadLine();

                            // This will commence the CVE generation process
                            if (input.ToLower() == "s")
                            {
                                keepAddingPrograms = false;
                                break;
                            }

                            // This will bring the user to the previous menu
                            else if (input.ToLower() == "x")
                            {
                                isSearching = false;
                                break;
                            }

                            //Loops through each installed application to detect the application you are searching for
                            foreach (var appkey in appKeys)
                            {
                                string appName = (string)appkey.GetValue("DisplayName");
                                if (appName == null)
                                {
                                    continue;
                                }

                                string appVersion = (string)appkey.GetValue("DisplayVersion");
                                //If application that user wants to search for is Windows OS
                                if (input.ToLower().Contains(windowsOs.ToLower()) ||
                                    windowsOs.ToLower().Contains(input.ToLower()))
                                {
                                    //If windows OS is installed
                                    if (windowsVer != "")
                                    {
                                        isFound    = true;
                                        appName    = windowsOs;
                                        appVersion = windowsVer;
                                        Console.WriteLine("\nApplication found.");
                                        Console.WriteLine("Application Name: " + appName);
                                        Console.WriteLine("Version: " + appVersion);
                                        Console.WriteLine("Is this the application? Enter 'Y' to continue:");
                                        string choice = Console.ReadLine();

                                        //If the user does not think that this is the app he/she is searching for
                                        if (choice.ToLower() != "y")
                                        {
                                            Console.WriteLine("Aborted. Searching other apps.....");
                                            continue;
                                        }
                                        else
                                        {
                                            isFound = true;
                                        }
                                    }
                                }

                                //Else if your application is found (not windows)
                                else if (appName.ToLower().Contains(input.ToLower()) ||
                                         input.ToLower().Contains(appName.ToLower()))
                                {
                                    Console.WriteLine("\nApplication match found.");
                                    Console.WriteLine("Application Name: " + appName);
                                    Console.WriteLine("Version: " + appVersion);
                                    Console.WriteLine("Is this the application? Enter 'Y' to continue:");
                                    string choice = Console.ReadLine();
                                    //Searches for other applications installed that matches what the user is searching for
                                    if (choice.ToLower() != "y")
                                    {
                                        Console.WriteLine("Aborted. Searching other apps.....");
                                        continue;
                                    }
                                    else
                                    {
                                        isFound = true;
                                    }
                                }

                                //If user has confirmed the app he/she is searching for, adds it to the list of apps to generate CVE reports for
                                if (isFound == true)
                                {
                                    // appVersion = "0.1.38.1"; //For testing, very old version of chrome, remove later
                                    //appVersion = "1511"; //For testing, very old version of windows 10, remove later
                                    // appVersion = "15.006.30060"; //Old version of acrobat reader DC
                                    // appVersion = "1.7.32"; //Old version of Burp Suite
                                    programsToCheck.Add(appName);
                                    programVersions.Add(appVersion);
                                    break;
                                }
                            }
                            // If a match was not confirmed by the user for any of the applications installed
                            if (isFound == false)
                            {
                                Console.WriteLine("\nApplication not found. Please try again.\n");
                            }

                            isFound = false;
                        }

                        if (isSearching == true)
                        {
                            int    counter        = 0;
                            String dateTimeString = DateTime.Now.ToString("MMddyyyyHHmmss");
                            //Generates CVE reports for all applications the user has confirmed
                            foreach (string appname in programsToCheck)
                            {
                                CVEGenerator.generateTextReport(appname, programVersions[counter], dateTimeString);
                                counter++;
                            }
                        }
                    }
                }
            }
        }