コード例 #1
0
        public IEnumerable <ComponentGroup> Retrieve()
        {
            var cgs = new ComponentGroup[] { new ComponentGroup("Machine") };

            var properties = new HashSet <PayloadProperty>();

            Dictionary <string, string> col = RetrieverProxy.GetInxiInfo("-S")["System"];

            properties.Add(new PayloadProperty("Hostname", (col.GetValueOrDefault("Host") + "." + RetrieverProxy.GetDnsDomainName()).ToLowerInvariant(), true));
            properties.Add(new PayloadProperty("OS", col.GetValueOrDefault("Distro") + " Kernel " + col.GetValueOrDefault("Kernel")));

            col = RetrieverProxy.GetInxiInfo("-xi")["Network"];

            var ips = new List <string>();

            foreach (string key in col.Keys)
            {
                if (key.Contains("ip-v"))
                {
                    ips.Add(col[key]);
                }
            }

            properties.Add(new PayloadProperty("IPs", ips));

            cgs[0].Properties = properties.ToArray();

            return(cgs);
        }
コード例 #2
0
        public IEnumerable <ComponentGroup> Retrieve()
        {
            var cgs = new HashSet <ComponentGroup>();

            Dictionary <string, string> col = RetrieverProxy.GetInxiInfo("-D -xx")["Drives"];
            HashSet <PayloadProperty>   currentProperties = null;

            foreach (string key in col.Keys)
            {
                if (key.StartsWith("ID"))
                {
                    if (key.EndsWith(" model"))
                    {
                        currentProperties = new HashSet <PayloadProperty>();
                        currentProperties.Add(new PayloadProperty("Model", col.GetValueOrDefault(key)));
                    }
                    else if (key.EndsWith(" serial"))
                    {
                        currentProperties.Add(new PayloadProperty("SerialNumber", col.GetValueOrDefault(key), true));

                        cgs.Add(new ComponentGroup("Disk", currentProperties.ToArray()));
                    }
                }
            }

            return(cgs);
        }
コード例 #3
0
        public IEnumerable <ComponentGroup> Retrieve()
        {
            var cgs = new HashSet <ComponentGroup>();

            Dictionary <string, string> col = RetrieverProxy.GetInxiInfo("-mxx")["Memory"];
            HashSet <PayloadProperty>   currentProperties = null;

            foreach (string key in col.Keys)
            {
                if (key.StartsWith("Device"))
                {
                    string value = col.GetValueOrDefault(key);
                    if (value == null || value.StartsWith("No Module") || value == "N/A")
                    {
                        continue;
                    }

                    if (key.EndsWith(" size"))
                    {
                        currentProperties = new HashSet <PayloadProperty>();

                        string[] split = value.Split(' ');
                        currentProperties.Add(new PayloadProperty("Size", split[0], false, "GB"));
                    }
                    else if (key.EndsWith(" speed"))
                    {
                        string[] split = value.Split(' ');
                        currentProperties.Add(new PayloadProperty("Speed", split[0], false, "Mhz"));
                    }
                    else if (key.EndsWith(" type"))
                    {
                        currentProperties.Add(new PayloadProperty("Type", value));
                    }
                    else if (key.EndsWith(" manufacturer"))
                    {
                        currentProperties.Add(new PayloadProperty("Manufacturer", value));
                    }
                    else if (key.EndsWith(" part"))
                    {
                        currentProperties.Add(new PayloadProperty("PartNumber", value));
                    }
                    else if (key.EndsWith(" serial"))
                    {
                        currentProperties.Add(new PayloadProperty("SerialNumber", value, true));
                    }
                }
            }

            return(cgs);
        }
コード例 #4
0
        public IEnumerable <ComponentGroup> Retrieve()
        {
            var cgs = new HashSet <ComponentGroup>();

            RetrieverProxy.CpuInfo cpuInfo = RetrieverProxy.GetCpuInfo();

            var properties = new PayloadProperty[cpuInfo.Count];

            for (int i = 0; i != cpuInfo.Count; i++)
            {
                properties[i] = new PayloadProperty("Name", cpuInfo.Name);
            }

            cgs.Add(new ComponentGroup("CPU", properties));

            return(cgs);
        }
コード例 #5
0
        public IEnumerable <ComponentGroup> Retrieve()
        {
            var cgs = new ComponentGroup[] { new ComponentGroup("BaseBoard") };

            var properties = new HashSet <PayloadProperty>();

            Dictionary <string, string> col = RetrieverProxy.GetInxiInfo("-M")["Machine"];

            properties.Add(new PayloadProperty("Manufacturer", col.GetValueOrDefault("Mobo")));
            properties.Add(new PayloadProperty("Model", col.GetValueOrDefault("Mobo model")));
            properties.Add(new PayloadProperty("SerialNumber", col.GetValueOrDefault("Mobo serial"), true));
            properties.Add(new PayloadProperty("BIOS", col.GetValueOrDefault("Bios v")));

            cgs[0].Properties = properties.ToArray();

            return(cgs);
        }
コード例 #6
0
        public IEnumerable <ComponentGroup> Retrieve()
        {
            var cgs = new HashSet <ComponentGroup>();

            Dictionary <string, string> col = RetrieverProxy.GetInxiInfo("-n")["Network"];
            HashSet <PayloadProperty>   currentProperties = null;

            foreach (string key in col.Keys)
            {
                if (key.StartsWith("Card") && !key.EndsWith(" driver"))
                {
                    currentProperties = new HashSet <PayloadProperty>();
                    currentProperties.Add(new PayloadProperty("Name", col.GetValueOrDefault(key)));
                }
                else if (key.StartsWith("IF") && key.EndsWith(" mac"))
                {
                    currentProperties.Add(new PayloadProperty("MAC address", ("" + col.GetValueOrDefault(key)).ToUpperInvariant()));
                    cgs.Add(new ComponentGroup("NIC", currentProperties.ToArray())); //Can be spoofed, do not run in a VM!
                }
            }

            return(cgs);
        }
コード例 #7
0
        static void Main(string[] args)
        {
            if (!_namedMutex.WaitOne())
            {
                return;
            }

            Console.WriteLine("SIZING SERVERS LAB LINUX BEHOLDER AGENT");
            Console.WriteLine("  Reporting every " + Config.GetInstance().reportEvery + " to " + Config.GetInstance().endpoint);
            Console.WriteLine();

            Console.ReadLine();

            if (RetrieverProxy.IsVM())
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Beholder does not work for VMs!");
            }
            else
            {
                PayloadReporter.RegisterRetrieverAndStartReporting(PayloadRetriever.GetInstance());
            }
            Console.ReadLine();
        }