Пример #1
0
        public override string Execute(int consoleWidth)
        {
            JobSnmp _job;

            if (OParUsed("i"))
            {
                _job = new JobSnmp((uint)pars.GetPar("i").argValues[0]);
            }
            else
            {
                _job = new JobSnmp();
            }

            try
            {
                ParseParameters();
            }
            catch (Exception ex)
            {
                return(ex.Data.ToString());
            }

            _job.secModel = secModel;
            _job.version  = version;

            _job.name = (string)pars.GetPar("n").argValues[0];
            _job.time = JobAddCommand.ParseJobTime(this);

            int _nodeID = (int)pars.GetPar("id").argValues[0];

            _js.AddJobToNode(_nodeID, _job);
            return("<color><green>Job (ID " + _job.id + ") added to node (ID " + _nodeID + ").");
        }
Пример #2
0
        public override string Execute(int consoleWidth)
        {
            JobHostDetect _job = new JobHostDetect();

            _job.name = (string)pars.GetPar("n").argValues[0];
            _job.time = ParseJobTime(this);

            _job.Subnetmask = (IPAddress)pars.GetPar("m").argValues[0];

            int _nodeID = (int)pars.GetPar("id").argValues[0];

            _js.AddJobToNode(_nodeID, _job);
            return("<color><green>Job (ID " + _job.id + ") added to node (ID " + _nodeID + ").");
        }
Пример #3
0
        public override string Execute(int consoleWidth)
        {
            JobCheckFtp _job = new JobCheckFtp();

            _job.name = (string)pars.GetPar("n").argValues[0];
            _job.time = ParseJobTime(this);

            _job.username = (string)pars.GetPar("u").argValues[0];
            _job.password = (string)pars.GetPar("p").argValues[0];

            int _nodeID = (int)pars.GetPar("id").argValues[0];

            _js.AddJobToNode(_nodeID, _job);
            return("<color><green>Job (ID " + _job.id + ") added to node (ID " + _nodeID + ").");
        }
Пример #4
0
        public override string Execute(int consoleWidth)
        {
            JobPort _job = new JobPort();

            _job.name = (string)pars.GetPar("n").argValues[0];
            _job.time = ParseJobTime(this);

            _job.port = (int)pars.GetPar("p").argValues[0];

            if (OParUsed("tout"))
            {
                _job.timeout = (int)pars.GetPar("tout").argValues[0];
            }

            int _nodeID = (int)pars.GetPar("id").argValues[0];

            _js.AddJobToNode(_nodeID, _job);
            return("<color><green>Job (ID " + _job.id + ") added to node (ID " + _nodeID + ").");
        }
Пример #5
0
        public override string Execute(int consoleWidth)
        {
            JobCheckDns _job;

            if (OParUsed("m"))
            {
                _job = new JobCheckDns(pars.GetPar("m").argValues[0].ToString());
            }
            else
            {
                _job = new JobCheckDns();
            }

            _job.name = (string)pars.GetPar("n").argValues[0];
            _job.time = ParseJobTime(this);

            int _nodeID = (int)pars.GetPar("id").argValues[0];

            _js.AddJobToNode(_nodeID, _job);
            return("<color><green>Job (ID " + _job.id + ") added to node (ID " + _nodeID + ").");
        }
Пример #6
0
        public override string Execute(int consoleWidth)
        {
            JobPing _job = new JobPing();

            _job.name = (string)pars.GetPar("n").argValues[0];
            _job.time = ParseJobTime(this);

            if (OParUsed("ttl"))
            {
                _job.ttl = (int)pars.GetPar("ttl").argValues[0];
            }

            if (OParUsed("tout"))
            {
                _job.timeout = (int)pars.GetPar("tout").argValues[0];
            }

            // So now the JobPing is finished and set properly.

            int _nodeID = (int)pars.GetPar("id").argValues[0];

            _js.AddJobToNode(_nodeID, _job);
            return("<color><green>Job (ID " + _job.id + ") added to node (ID " + _nodeID + ").");
        }
Пример #7
0
        public override string Execute(int consoleWidth)
        {
            JobCheckSnmp _job = new JobCheckSnmp();

            _job.name = (string)pars.GetPar("n").argValues[0];
            _job.time = ParseJobTime(this);

            _job.version = (uint)pars.GetPar("ver").argValues[0];

            if (_job.version == 3)
            {
                string _buffer = (string)pars.GetPar("s").argValues[0];
                switch (_buffer)
                {
                case "authNoPriv":
                    _job.secModel.securityLevel = NetworkHelper.securityLvl.authNoPriv;
                    if (!(OParUsed("a") && !OParUsed("p")))
                    {
                        return("<color><red>ERROR: Wrong Parameters Used");
                    }
                    break;

                case "authPriv":
                    _job.secModel.securityLevel = NetworkHelper.securityLvl.authPriv;
                    if (!(OParUsed("a") && OParUsed("p")))
                    {
                        return("<color><red>ERROR: Wrong Parameters Used");
                    }
                    break;

                case "noAuthNoPriv":
                    _job.secModel.securityLevel = NetworkHelper.securityLvl.noAuthNoPriv;
                    if (!(!OParUsed("a") && !OParUsed("p")))
                    {
                        return("<color><red>ERROR: Wrong Parameters Used");
                    }
                    break;

                default:
                    return("<color><red>ERROR: Wrong Security Level! choose between authNoPriv, authPriv and noAuthNoPriv");
                }

                _buffer = (string)pars.GetPar("a").argValues[0];
                switch (_buffer)
                {
                case "md5":
                    _job.secModel.authentificationProtocol = NetworkHelper.snmpProtocols.MD5;
                    break;

                case "sha":
                    _job.secModel.authentificationProtocol = NetworkHelper.snmpProtocols.SHA;
                    break;

                default:
                    return("<color><red>ERROR: Wrong authentification Protocol! choose between md5, sha");
                }

                _buffer = (string)pars.GetPar("p").argValues[0];
                switch (_buffer)
                {
                case "aes":
                    _job.secModel.privacyProtocol = NetworkHelper.snmpProtocols.AES;
                    break;

                case "des":
                    _job.secModel.privacyProtocol = NetworkHelper.snmpProtocols.DES;
                    break;

                default:
                    return("<color><red>ERROR: Wrong privacy Protocol! choose between aes, des");
                }
            }

            int _nodeID = (int)pars.GetPar("id").argValues[0];

            _js.AddJobToNode(_nodeID, _job);
            return("<color><green>Job (ID " + _job.id + ") added to node (ID " + _nodeID + ").");
        }