public static string GetFlexInfo()
            {
                try
                {
                    StringBuilder output = new StringBuilder();

                    var fileInfo = Helper.GetFileInfo(Path.Combine(ProductDetection.Vugen.InstallLocation, @"jars\ConvertExternalizableObject.jar"));
                    if (fileInfo != null)
                    {
                        output.Append("ConvertExternalizableObject.jar exists, " + fileInfo["Size"].ToString() + " bytes, last modified on: " + fileInfo["ModifiedOn"].ToString() + Html.br);
                    }
                    else
                    {
                        output.Append(Html.Error("ConvertExternalizableObject.jar does not exist in " + ProductDetection.Vugen.InstallLocation + @"\jars folder") + Html.br);
                    }


                    string env = OSCollectorHelper.GetEnvVariable("HP_FLEX_JAVA_LOG_FILE");

                    output.Append("Environment variable HP_FLEX_JAVA_LOG_FILE = " + env);

                    return(output.ToString());
                }
                catch (Exception ex)
                {
                    Logger.Error(ex.ToString());
                    return(Html.Error(ex.Message));
                }
            }
Esempio n. 2
0
        private string GetBBHookVersion()
        {
            try
            {
                StringBuilder output = new StringBuilder();

                if (isVuGen)
                {
                    var fileInfo = Helper.GetFileInfo(Path.Combine(BinFolder, "bbhook.dll"));
                    output.Append("bbhook.dll - version: " + fileInfo["Version"] + ", " + fileInfo["Size"] + " bytes" + Html.br);
                    if (OSCollectorHelper.is64BitOperatingSystem && this.isNew)
                    {
                        fileInfo = Helper.GetFileInfo(Path.Combine(BinFolder, "bbhook_x64.dll"));
                        output.Append("bbhook_x64.dll - version: " + fileInfo["Version"] + ", " + fileInfo["Size"] + " bytes");
                    }
                    return(output.ToString());
                }
                return(null);
            }
            catch (FileNotFoundException fnfe)
            {
                Logger.Error(fnfe.ToString());
                return(Html.Error("bbhook library not found in " + BinFolder));
            }
            catch (Exception ex)
            {
                Logger.Error(ex.ToString());
                return(Html.Error(ex.Message));
            }
        }
            private static string GetFlexAdditionalJarFilesInfo(bool isCheckBoxDisabled)
            {
                StringBuilder output = new StringBuilder();

                try
                {
                    string jars = ini.GetSetting("JAR_FILES", "Items", "");
                    if (jars != "" && jars != null)
                    {
                        char[]   charSeparators = new char[] { ';' };
                        string[] jarItems       = jars.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries);
                        int      indentLevel    = 16;

                        foreach (var jarItem in jarItems)
                        {
                            output.Append(Html.CheckBox(ini.GetBoolSetting(jarItem, "Checked", false), isCheckBoxDisabled, indentLevel) + ini.GetSetting(jarItem, "Item", "") + Html.br);
                        }
                    }
                    else
                    {
                        return(Html.IndentWithSpaces(16) + "No jar files added"); //Indent the text 16 spaces
                    }
                }
                catch (Exception ex)
                {
                    Logger.Error(ex.ToString());
                    return(Html.Error(ex.Message) + Html.br);
                }
                return(output.ToString());
            }
Esempio n. 4
0
        /// <summary>
        /// Method to parse the content of the config\IgnoredContent.xml
        /// Anything that is listed here will not be parsed for correlations
        /// </summary>
        /// <returns>A list of content types that are not scanned for correlations</returns>
        private string GetCorrelationIgnoredContent()
        {
            try
            {
                if (isVuGen)
                {
                    XmlDocument xmlDoc = new XmlDocument();
                    xmlDoc.Load(InstallLocation + @"config\IgnoredContent.xml");

                    XmlNodeList   nodes   = xmlDoc.GetElementsByTagName("string");
                    List <String> content = new List <string>();
                    for (int i = 0; i < nodes.Count; i++)
                    {
                        content.Add('"' + nodes[i].InnerText + '"');
                    }

                    string output = String.Join(", ", content.ToArray());
                    return(output);
                }
                return("");
            }
            catch (FileNotFoundException)
            {
                Logger.Error(InstallLocation + @"content\IgnoredContent.xml not found");
                return(Html.Error(InstallLocation + @"\content\IgnoredContent.xml not found"));
            }
            catch (Exception ex)
            {
                Logger.Error(ex.ToString());
                return(Html.Error(ex.Message));
            }
        }
            internal static string GetCitrixRecOptions()
            {
                StringBuilder output = new StringBuilder();

                try
                {
                    output.Append(Html.B("Configuration") + Html.br);
                    output.Append(Html.IndentWithSpaces() + "Encryption Level: " + ini.GetSetting("Citrix", "Enctyption") + Html.br);
                    output.Append(Html.IndentWithSpaces() + "Window size: " + ini.GetSetting("Citrix", "Window") + Html.br);

                    output.Append(Html.B("Recorder") + Html.br);
                    output.Append(Html.IndentWithSpaces() + "Window name: " + VugenProtocolsCollectorHelper.Citrix.GetCitrixWindowNameOption("CommonNames", "NAMES") + Html.br);
                    output.Append(Html.CheckBox(ini.GetBoolSetting("BITMAPS", "SaveBitmaps", true)) + "Save snapshots");

                    output.Append(Html.br + Html.B("Code Generation") + Html.br);
                    output.Append(Html.CheckBox(ini.GetBoolSetting("AGENT", "UseAgent", true)) + "Use Citrix agent input in Code Generation" + Html.br);
                    output.Append(Html.CheckBox(ini.GetBoolSetting("AGENT", "SyncOnText", false)) + "Automatically generate text synchronization calls " + Html.br);
                }
                catch (Exception ex)
                {
                    Logger.Error(ex.ToString());
                    return(Html.Error(ex.ToString()));
                }
                return(output.ToString());
            }
Esempio n. 6
0
        /*public override string ToString()
         * {
         *  try
         *  {
         *
         *      StringBuilder output = new StringBuilder(1024);
         *      if (isAgentProcessRunning && isAgentServiceRunning)
         *      {
         *          output.Append(Html.Error("The agent is running both as a process and a service!")
         + AgentServiceOpenedPorts + AgentProcessOpenedPorts);
         +      }
         +      else
         +      {
         +        if (isAgentProcessRunning || isAgentServiceRunning)
         +          output.Append("Currently running." + AgentServiceOpenedPorts + AgentProcessOpenedPorts);
         +        else
         +          output.Append("Not running!");
         +      }
         +
         +      return output.ToString();
         +  }
         +  catch (Exception ex)
         +  {
         +      Logger.Error(ex.ToString());
         +      return ex.Message;
         +  }
         + }*/
        #endregion

        #region Method to display the agent status information
        internal string GetAgentStatus()
        {
            try
            {
                StringBuilder output = new StringBuilder(1024);
                if (isAgentProcessRunning && isAgentServiceRunning)
                {
                    output.Append(Html.Error("The agent is running both as a process and a service!")
                                  + AgentServiceOpenedPorts + AgentProcessOpenedPorts);
                }
                else
                {
                    if (isAgentProcessRunning || isAgentServiceRunning)
                    {
                        output.Append("Status: " + Html.Notice("Running") + AgentServiceOpenedPorts + AgentProcessOpenedPorts);
                    }
                    else
                    {
                        output.Append("Not running!");
                    }
                }

                return(output.ToString());
            }
            catch (Exception ex)
            {
                Logger.Error(ex.ToString());
                return(ex.Message);
            }
        }
Esempio n. 7
0
 public static string isAnalysisSAInstalled()
 {
     try
     {
         if (isFullLRInstalled().Contains("No"))
         {
             RegistryKey rk = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Mercury Interactive\LoadRunner\CustComponent\Analysis\CurrentVersion");
             if (rk != null)
             {
                 string installPath = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Mercury Interactive\Analysis\CurrentVersion\").GetValue("Analysis").ToString();
                 if (installPath != null && System.IO.File.Exists(installPath + @"\AnalysisUI.exe"))
                 {
                     return("Yes" + rk.GetValue("Major").ToString() + "." + rk.GetValue("Minor").ToString());
                 }
                 ;
             }
             return(Html.Warning("No"));
         }
         return(Html.Warning("Checking skipped, full LoadRunner intallation detected"));
     }
     catch (Exception ex)
     {
         return(Html.Error(ex.ToString()));
     }
 }
Esempio n. 8
0
        public static string getCustomComponentsInstalled()
        {
            string intalledComponents = null;

            try
            {
                RegistryKey rk = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Mercury Interactive\LoadRunner\CustComponent\");
                if (rk != null)
                {
                    foreach (string subKeyName in rk.GetSubKeyNames())
                    {
                        RegistryKey subKey = rk.OpenSubKey(subKeyName + @"\CurrentVersion");
                        if (subKey != null)
                        {
                            intalledComponents += Html.B(subKeyName) + " " + subKey.GetValue("Major").ToString() + "." + subKey.GetValue("Minor").ToString() + Html.br;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Html.Error(ex.ToString());
            }
            return(intalledComponents);
        }
            public static string GetFlexRoInfo()
            {
                try
                {
                    StringBuilder output = new StringBuilder();

                    output.Append(Html.B("Flex > RTMP") + Html.br);
                    output.Append(Html.CheckBox(ini.GetBoolSetting("RTMP_RO", "GenerateReceiveStream", true)) + "Generate single step for RTMP/T stream handling" + Html.br);

                    output.Append(Html.B("Flex > Configuration") + Html.br);
                    bool useExternalVm = ini.GetBoolSetting("FLEX_RO", "UseExternalVm", false);
                    output.Append(Html.CheckBox(useExternalVm) + "Use external JVM" + Html.br);
                    int indentLevel = 8;
                    if (useExternalVm)
                    {
                        output.Append(Html.IndentWithSpaces(indentLevel) + "External JVM path: " + ini.GetSetting("FLEX_RO", "ExternalVmPath", "") + Html.br);
                    }

                    output.Append(Html.CheckBox(ini.GetBoolSetting("FLEX_RO", "ExternalDsParser", false)) + "Use GraniteDS configuration" + Html.br);
                    output.Append(Html.IndentWithSpaces(indentLevel) + "Maximum formatted Request/Response size to print (in characters): " + ini.GetSetting("FLEX_RO", "MaxReqResSizeToWriteForLog") + Html.br);

                    output.Append(Html.B("Flex > Externalizable objects") + Html.br);

                    bool EncodeExternalizableObject = ini.GetBoolSetting("FLEX_RO", "EncodeExternalizableObject", false);
                    output.Append(Html.CheckBox(!EncodeExternalizableObject) + "Do not serialize externalizable objects" + Html.br);
                    if (EncodeExternalizableObject == true)
                    {
                        output.Append(Html.CheckBox(true) + "Serialize objects using:" + Html.br);
                        bool UseServerParserToParseAmf3 = ini.GetBoolSetting("FLEX_RO", "UseServerParserToParseAmf3", false);

                        bool isCheckBoxDisabled = false;
                        output.Append(Html.CheckBox(!UseServerParserToParseAmf3, isCheckBoxDisabled, indentLevel) + "LoadRunner AMF serializer" + Html.br);

                        isCheckBoxDisabled = UseServerParserToParseAmf3 ? false : true;
                        output.Append(Html.CheckBox(UseServerParserToParseAmf3, isCheckBoxDisabled, indentLevel) + "Custom Java classes" + Html.br);

                        indentLevel = 12;
                        output.Append(Html.CheckBox(ini.GetBoolSetting("FLEX_RO", "UseFlexGlobalJars", false), isCheckBoxDisabled, indentLevel) + "Use Flex LCDS/BlazeDS jars" + Html.br);
                        bool UseAdditionalJars = ini.GetBoolSetting("FLEX_RO", "UseAdditionalJars", false);

                        string additionalJarsList = "";
                        if (UseAdditionalJars)
                        {
                            additionalJarsList = Html.AddLinkToHiddenContent(GetFlexAdditionalJarFilesInfo(isCheckBoxDisabled));
                        }

                        output.Append(Html.CheckBox(UseAdditionalJars, isCheckBoxDisabled, indentLevel) + "Use additional jars " + additionalJarsList + Html.br);
                    }

                    output.Append(Html.br + ini.GetSetting("FLEX_RO", "FlexJvmParams") + Html.br);

                    return(output.ToString());
                }
                catch (Exception ex)
                {
                    Logger.Error(ex.ToString());
                    return(Html.Error(ex.Message) + Html.br);
                }
            }
Esempio n. 10
0
        public static string GetServiceInfo(string serviceName, string processName = "")
        {
            try
            {
                if (processName == "")
                {
                    processName = serviceName;
                }

                int    agentProcessId     = 0;
                string agentProcessOwnder = string.Empty;
                string agentProcessPath   = string.Empty;


                ServiceController sc = new ServiceController(serviceName);

                Logger.Info("status " + serviceName + sc.Status);
                switch (sc.Status)
                {
                case ServiceControllerStatus.Running:
                case ServiceControllerStatus.StartPending:
                case ServiceControllerStatus.StopPending:
                    string processId = Helper.QueryWMI("ProcessId", "root\\CIMV2", "Win32_Service", "WHERE Name='" + serviceName + "'");
                    Logger.Info("ProcessId for  " + processName + " is " + processId);
                    if (!processId.Contains("Error") && !processId.Contains("Not detected"))
                    {
                        agentProcessId     = Convert.ToInt32(processId);
                        agentProcessOwnder = Helper.GetProcessOwner(agentProcessId);
                    }
                    agentProcessPath = Helper.QueryWMI("PathName", "root\\CIMV2", "Win32_Service", "WHERE Name='" + serviceName + "'");
                    Logger.Info("agentProcessPath for  " + processName + " is " + agentProcessPath);
                    break;

                case ServiceControllerStatus.Stopped:
                case ServiceControllerStatus.Paused:
                    break;
                }


                var status = sc.Status.ToString().Contains("Running") ? Html.Notice(sc.Status.ToString()) : sc.Status.ToString();
                status = status.Contains("Stopped") || status.Contains("Paused") ? Html.Error(status) : status;

                var openedPorts = agentProcessId != 0 ? Helper.GetOpenedPortsForProcessId(agentProcessId) : "";

                return("Status: " + status + Html.br
                       + Html.B("Details: ") + Html.br
                       + Html.U("PID: " + agentProcessId + " " + agentProcessOwnder) + Html.br
                       + "Path: " + agentProcessPath + openedPorts);
            }
            catch (InvalidOperationException)
            {
                return(Html.Warning("Service not installed on this computer!"));
            }
            catch (Exception ex)
            {
                Logger.Error(ex.ToString());
                return(ex.ToString());
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Returns the value for the given section, key pair.
        /// </summary>
        /// <param name="sectionName">Section name.</param>
        /// <param name="settingName">Key name.</param>
        public String GetSetting(String sectionName, String settingName, string defaultValue = null)
        {
            try
            {
                SectionPair sectionPair;
                sectionPair.Section = sectionName;
                sectionPair.Key     = settingName;

                //check if the option exists under the correct section
                string setting = (String)this.keyPairs[sectionPair];

                //if no key is found check if it is under the correct section but it is disabled
                if (setting == null)
                {
                    sectionPair.Key = ';' + sectionPair.Key;
                    setting         = (String)this.keyPairs[sectionPair];

                    // if the option is really missing from this section check other sections
                    if (setting == null)
                    {
                        foreach (DictionaryEntry keyPair in this.keyPairs)
                        {
                            //reset the section key to remove the ';' in front
                            sectionPair.Key = settingName;

                            sectionPair = (SectionPair)keyPair.Key;
                            if (sectionPair.Key == settingName)
                            {
                                return(Html.Error(settingName + "=" + keyPair.Value + " found under the wrong section [" + sectionPair.Section.ToString() + ']'));
                            }
                            if (sectionPair.Key == ';' + settingName)
                            {
                                return(Html.Error(settingName + "=" + keyPair.Value + " found under the wrong section [" + sectionPair.Section.ToString() + "]. The option is disabled!"));
                            }
                        }
                    }

                    // if the option is missing from the file at all
                    if (setting == null)
                    {
                        return(defaultValue != null ? defaultValue : settingName + " option not set. Using the default value.");
                    }
                    return(Html.Error(settingName + "=" + setting + " the option exists but it is disabled!"));
                }
                return(setting);
            }
            catch (Exception ex)
            {
                Logger.Error(ex.ToString());
                return(ex.Message);
            }
        }
Esempio n. 12
0
 public static string isFileLargeAddressAware(string fileName)
 {
     try
     {
         string path   = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Mercury Interactive\LoadRunner\CurrentVersion\").GetValue("Vuser Generator").ToString() + @"\bin\" + fileName;
         Stream stream = File.OpenRead(path);
         return(isFileLargeAddressAware(stream) ? "the file is LARGEADDERSSAWARE" : "the file is not LARGEADDERSSAWARE");
     }
     catch (Exception ex)
     {
         return(Html.Error(ex.ToString()));
     }
 }
Esempio n. 13
0
 /// <summary>
 /// Method to check the number of installed Layared Service Providers
 /// </summary>
 public static int GetNumberOfInstalledLSPs()
 {
     try
     {
         RegistryKey rk = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\WinSock2\Parameters\Protocol_Catalog9\Catalog_Entries");
         return(rk.SubKeyCount);
     }
     catch (Exception ex)
     {
         Logger.Error(Html.Error(ex.ToString()));
         return(0);
     }
 }
Esempio n. 14
0
 public static string GetProcessorNameString()
 {
     try
     {
         RegistryKey rk = Registry.LocalMachine.OpenSubKey(@"HARDWARE\DESCRIPTION\System\CentralProcessor\0");
         return(rk.GetValue("ProcessorNameString").ToString());
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(Html.Error(ex.ToString()));
     }
 }
Esempio n. 15
0
 private static int GetTotalMemory(string type = "Physical")
 {
     try
     {
         double totalMemory = (type == "Physical") ? ci.TotalPhysicalMemory : ci.TotalVirtualMemory;
         double inMb        = totalMemory / (1024 * 1024);
         return((int)Math.Ceiling(inMb));
     }
     catch (Exception ex)
     {
         Html.Error(ex.ToString());
         return(0);
     }
 }
Esempio n. 16
0
        public static string UACInfo()
        {
            switch (UACLevel)
            {
            case 0:
                return("Disabled");

            case 1:
                return(Html.Error(Html.B("Enabled")));

            default:
                return("UAC is not supported for this OS");
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Method to get the product version
        /// </summary>
        /// <returns>Product version<returns>
        private string GetProductVersion()
        {
            try
            {
                //example HKLM\SOFTWARE\Mercury Interactive\LoadRunner\CurrentVersion
                string path = this.ProductRegistryPath + "CurrentVersion";
                Logger.Info("Starting product version detection");
                Logger.Info("Registry path to search: " + path);
                string major = RegistryWrapper.GetValue(RegHive.LocalMachine, path, "Major");
                Logger.Info(path + @"\Major: " + major);
                string minor = RegistryWrapper.GetValue(RegHive.LocalMachine, path, "Minor", "00");
                Logger.Info(path + @"\Minor: " + minor);

                //if the version is not found in \Mercury Interactive\LoadRunner\CurrentVersion
                //get it from the Add Remove Programs
                if (major == null || major == "")
                {
                    string versionFromInstaller = GetProductVersionFromInstaller();
                    if (versionFromInstaller != null && versionFromInstaller != "")
                    {
                        // major would be something like 11.04.000 || 11.50.123
                        if (versionFromInstaller.Contains('.'))
                        {
                            string[] parts = versionFromInstaller.Split('.');
                            major = parts[0];
                            minor = parts[1];
                        }
                        else
                        {
                            major = versionFromInstaller;
                        }
                    }
                    else
                    {
                        Logger.Error("Major version not detected!");
                        version = null;
                        return(Html.Error("Version NOT detected"));
                    }
                }
                // Set the version
                version = new Version(Convert.ToInt32(major), Convert.ToInt32(minor));
                // Return the version key
                return(major + "." + minor);
            }
            catch (Exception ex)
            {
                Logger.Warn(ex.ToString());
                return(null);
            }
        }
Esempio n. 18
0
        /// <summary>
        /// Gets the value of some registry keys
        /// </summary>
        /// <exception cref=""></exception>
        /// <returns></returns>

        /*private string GetImportantRegKeyValues()
         * {
         *  try
         *  {
         *      StringBuilder importantKeys = new StringBuilder(1024);
         *      //check if we have important registry keys for this product
         *      if (this.importantRegistryKeys != null)
         *      {
         *          for (int i = this.importantRegistryKeys.GetLowerBound(0); i <= this.importantRegistryKeys.GetUpperBound(0); i++)
         *          {
         *              string inHive = this.importantRegistryKeys[i, 0];
         *              string keyPath = this.importantRegistryKeys[i, 1];
         *              string keyName = this.importantRegistryKeys[i, 2];
         *              string keyValue = null;
         *
         *              try
         *              {
         *                  RegistryKey rk = (inHive == "RegHive.HKEY_CURRENT_USER") ? Registry.CurrentUser.OpenSubKey(keyPath) : Registry.LocalMachine.OpenSubKey(keyPath);
         *                  keyValue = rk.GetValue(keyName).ToString();
         *                  importantKeys.Append(keyName + " = " + keyValue + Html.br);
         *                  //keyValue = RegistryWOW6432.GetRegKey64(RegHive.HKEY_LOCAL_MACHINE, keyPath, keyName);
         *              }
         *              catch (NullReferenceException)
         *              {
         *                  importantKeys.Append(keyName + " = " + Html.Error("Not found!") + Html.br);
         *              }
         *          }
         *      }
         *      return importantKeys.ToString();
         *  }
         *  catch (Exception ex)
         *  {
         *      Logger.Warn(ex.ToString());
         *      return ex.Message;
         *  }
         * }*/

        #endregion

        #region Correlation settings
        /// Settings
        /// Recording engine check
        private string GetCorrelationRulesSupport()
        {
            try
            {
                StringBuilder output = new StringBuilder();
                IniParser     ini    = new IniParser(this.InstallLocation + @"\dat\protocols\QTWeb.lrp");
                output.Append(ini.GetSetting("Vugen", "CorrelationRulesSupport"));
                return(output.ToString());
            }
            catch (Exception ex)
            {
                Logger.Error(ex.ToString());
                return(Html.Error(ex.Message));
            }
        }
Esempio n. 19
0
 public static string StringToYesNo(string value)
 {
     if (value == "1")
     {
         return(BoolToYesNo(true));
     }
     else if (value == "0")
     {
         return(BoolToYesNo(false));
     }
     else
     {
         return(Html.Error("Unknown"));
     }
 }
Esempio n. 20
0
        internal string IsTerminalServicesEnabledInfo()
        {
            string path = Path.Combine(ProductDetection.Loadgen.InstallLocation, @"launch_service\dat\br_lnch_server.cfg");

            try
            {
                var  ini = new IniParser(path);
                bool res = ini.GetBoolSetting("FireWall", "FireWallServiceActive", false);
                return(Html.BoolToYesNo(res));
            }
            catch (Exception ex)
            {
                Logger.Error(ex.ToString());
                return(Html.Error("Configuration file not found!"));
            }
        }
Esempio n. 21
0
        public static string getPatchesInstalled(string productCode)
        {
            //Helper.log("for product code " + productCode);
            try
            {
                string[] patchesCodes     = LoadRunner.getPatchesCodes(productCode);
                string   patchesInstalled = null;

                if (patchesCodes != null)
                {
                    //Helper.log("Patches codes" + patchesCodes.ToString());

                    foreach (string patchCode in patchesCodes)
                    {
                        if (patchCode != "Patches")
                        {
                            string keyPath = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\" + productCode + @"\Patches\" + patchCode;
                            Helper.Log("KeyPath to patch: " + keyPath);

                            if (OSInfo.getOperatingSystemArchitecture().StartsWith("x86"))
                            {
                                RegistryKey rk = Registry.LocalMachine.OpenSubKey(keyPath);
                                patchesInstalled += rk.GetValue("DisplayName").ToString() + " "
                                                    + Helper.convertInstallDate(rk.GetValue("Installed").ToString());
                            }
                            else
                            {
                                patchesInstalled += RegistryWOW6432.GetRegKey64(RegHive.HKEY_LOCAL_MACHINE, keyPath, "DisplayName") + " "
                                                    + Helper.convertInstallDate(RegistryWOW6432.GetRegKey64(RegHive.HKEY_LOCAL_MACHINE, keyPath, "Installed"));
                            }

                            patchesInstalled += Html.br;
                        }
                    }
                    return(patchesInstalled);
                }
                return("No patches were detected");
            }
            catch (Exception ex)
            {
                return(Html.Error(ex.ToString()));
            }
        }
Esempio n. 22
0
        public static string DepInfo()
        {
            switch (DepLevel)
            {
            case 0:
                return("DEP is disabled for all processes.\n(AlwaysOff)");

            case 1:
                return("DEP is " + Html.B(Html.Error("enabled")) + " for all processes.\n(AlwaysOn)");

            case 2:
                return("DEP is " + Html.B(Html.Error("enabled")) + " for only Windows system components and services. Default setting.\n(OptIn)");

            case 3:
                return("DEP is " + Html.B(Html.Error("enabled")) + " for all processes. Administrators can manually create a list of specific applications which do not have DEP applied.\n(OptOut)");

            default:
                return(Html.Warning("DEP status unknown\n"));
            }
        }
Esempio n. 23
0
        void GetDllsInfo(List <string> dlls, bool prependBinDir = false)
        {
            foreach (var dll in dlls)
            {
                var tableRow = new string[3];
                tableRow[0] = Path.GetFileName(dll);
                string filePath = prependBinDir ? Path.Combine(binFolder, dll) : dll;

                if (File.Exists(filePath))
                {
                    FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(filePath);
                    tableRow[1] = fvi.FileVersion;
                    tableRow[2] = File.GetLastWriteTime(filePath).ToLocalTime().ToString();
                }
                else
                {
                    tableRow[1] = Html.Error("Dll not Found!");
                }
                AddStringsToDataCells(tableRow);
            }
        }
Esempio n. 24
0
        public static string GetInfoForService(string serviceName)
        {
            string message = null;

            try
            {
                ServiceController sc = new ServiceController(serviceName);
                var status           = sc.Status.ToString();
                message = status == "Running" ? Html.Notice(status) : status;
            }
            catch (System.InvalidOperationException sioex)
            {
                Logger.Error(sioex.ToString());
                message = Html.Error("Not found on this computer");
            }
            catch (Exception ex)
            {
                Logger.Error(ex.ToString());
                message = Html.ErrorMsg();
            }
            return(String.Format("{0}{1}{2} Status: {3}", Html.br, Html.tab, serviceName, message));
        }
Esempio n. 25
0
        internal string IsAgentInstalledInfo()
        {
            StringBuilder info = new StringBuilder(1024);

            // check if agent is installed as service/process
            if (isAgentInstalledAsProcess && isAgentInstalledAsService)
            {
                info.Append(Html.Error("The agent is installed both as a process and a service!" + Html.br));
            }
            else
            {
                if (isInstalled)
                {
                    info.Append("Yes, " + Html.B(installedAgentName) + " is installed. ");
                }
                else
                {
                    info.Append("The agent is not installed! ");
                }
            }
            return(info.ToString());
        }
 internal static string GetFirefoxVersion()
 {
     try
     {
         var filePath = Path.Combine(ProductDetection.Vugen.BinFolder, @"firefox\firefox.exe");
         if (File.Exists(filePath))
         {
             var fileInfo    = Helper.GetFileInfo(filePath);
             var versionInfo = fileInfo["Version"].ToString();
             return(versionInfo);
         }
         else
         {
             return(Html.Error(ProductDetection.Vugen.BinFolder + @"\firefox\firefox.exe not found!"));
         }
     }
     catch (Exception ex)
     {
         Logger.Error(ex.ToString());
         return(Html.ErrorMsg());
     }
 }
Esempio n. 27
0
        public static string getFileVersion(string fileName)
        {
            try
            {
                string             path = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Mercury Interactive\LoadRunner\CurrentVersion\").GetValue("Vuser Generator").ToString() + @"\bin\" + fileName;
                FileVersionInfo    fvi  = FileVersionInfo.GetVersionInfo(path);
                System.IO.FileInfo fi   = new System.IO.FileInfo(path);

                if (fileName.StartsWith("firefox"))
                {
                    return(fvi.ProductVersion.ToString());
                }
                return(fvi.FileVersion.ToString() + " last modified on: " + fi.LastWriteTime.ToString() + " (d.m.y H:m:s)");
            }
            catch (System.IO.FileNotFoundException)
            {
                return(Html.Error("File not found"));
            }
            catch (Exception ex)
            {
                return(ex.ToString());
            }
        }
Esempio n. 28
0
        public static string isVugenSAInstalled()
        {
            try
            {
                string installDate     = null;
                string installLocation = null;
                string registryPath    = null;

                if (isFullLRInstalled().Contains("No"))
                {
                    string productCodeVugenSA = Helper.getProductCode(VugenSAUpdateCode);
                    //Helper.log("ProductCodeVugenSA: " + ProductCodeVugenSA);
                    if (productCodeVugenSA != null)
                    {
                        //Helper.log("ProductCodeVugenSA found in Installer");
                        installLocation = Helper.getProductInstallLocation(productCodeVugenSA);
                        registryPath    = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\" + productCodeVugenSA + @"\InstallProperties";
                        //InstallLocation = RegistryWOW6432.GetRegKey64(RegHive.HKEY_LOCAL_MACHINE, registryPath, "InstallLocation");
                        installDate = RegistryWOW6432.GetRegKey64(RegHive.HKEY_LOCAL_MACHINE, registryPath, "InstallDate");

                        string Major = RegistryWOW6432.GetRegKey64(RegHive.HKEY_LOCAL_MACHINE, @"SOFTWARE\Mercury Interactive\LoadRunner\CustComponent\Vuser Generator\CurrentVersion", "Major");
                        string Minor = RegistryWOW6432.GetRegKey64(RegHive.HKEY_LOCAL_MACHINE, @"SOFTWARE\Mercury Interactive\LoadRunner\CustComponent\Vuser Generator\CurrentVersion", "Minor");
                        if (installLocation != null && System.IO.File.Exists(installLocation + @"\bin\vugen.exe"))
                        {
                            return("Yes - Virtual user generator " + Major + "." + Minor + installDate);
                        }
                    }
                    return(Html.Warning("No"));
                }
                return(Html.Warning("Checking skipped, full LoadRunner intallation detected"));
            }
            catch (Exception ex)
            {
                return(Html.Error(ex.ToString()));
            }
        }
Esempio n. 29
0
        public string GetExecutableFilesInfo(string ver = "")
        {
            try
            {
                StringBuilder output      = new StringBuilder();
                List <string> currentExes = null;

                ver = "12.0x";
                if (ProductVersion != null || ProductVersion != "")
                {
                    ver = ProductVersion;
                }
                else
                {
                    ver = "12.0x";
                }

                // if we can't find the version match, we will use the latest one
                if (!Executables.TryGetValue(ver, out currentExes))
                {
                    //if no exact version is found, replace the last digit with an x
                    ver = ver.Remove(ver.Length - 1, 1) + "x";
                    // try to find something like 11.5x. If not found return the latest version
                    if (!Executables.TryGetValue(ver, out currentExes))
                    {
                        currentExes = Executables[Executables.Keys.First()];
                    }
                }

                string filePath = String.Empty;
                foreach (string currentExe in currentExes)
                {
                    var dir = BinFolder;
                    if (currentExe.Contains(@"\"))
                    {
                        dir = InstallLocation;
                    }
                    filePath = Path.Combine(dir, currentExe);
                    if (File.Exists(filePath))
                    {
                        var    fileInfo    = Helper.GetFileInfo(filePath);
                        string versionInfo = Html.Small(String.Format("Version: {0} last modified on: {1} {2} {3} {4}", fileInfo["Version"].ToString(), fileInfo["ModifiedOn"], IsFileLargeAddressAware(filePath), Html.br, Html.hr));
                        output.Append(filePath + Html.br + versionInfo);
                    }
                    else
                    {
                        //if file is not found check if we are searching for firefox.exe which is not available in earlier versions
                        //CopareTo will return -1 if vugen is ealier than 11 so anything greated than -1 means it's the a version
                        if (filePath.Contains("firefox") /*&& version.CompareTo(new Version("11.0")) > -1*/)
                        {
                            output.Append(Html.Error(String.Format("File not found: {0} {1}", Html.br, filePath)) + Html.br + Html.hr);
                        }
                    }
                }

                return(output.ToString());
            }
            catch (Exception ex)
            {
                return(ex.ToString());
            }
        }
Esempio n. 30
0
 // TODO check if this is useless
 public static string ErrorMsg(int errorNumber = 0)
 {
     string[] errors = new String[] { "Unable to detect!", "Unknown error!", "Could not find settings for user: " + Html.B(Environment.UserName) };
     return(Html.Error(errors[errorNumber]));
 }