Example #1
0
        public override byte[] Execute(InstructionsInfo insCode, ControlItemConfiguration config)
        {
            if (this.client == null)
            {
                this.client = new ImageClient(config.BasePath);
            }
            int levelCode = insCode.LevelTwoCode;

            byte[]    data = insCode.Data;
            LevelCode lv   = (LevelCode)levelCode;

            switch (lv)
            {
            case LevelCode.START_SEND_IMAGE:
                bool res = this.client.SendImageData(config.TargetAddress, config.ReceiveImageDataPort);
                if (res)
                {
                    return(new byte[] { 0x0 });
                }
                else
                {
                    return(new byte[] { 0xF });
                }

            case LevelCode.STOP_SEND_IMAGE:
                this.client.StopSend();
                break;
            }
            return(null);
        }
Example #2
0
        public static byte[] ExecuteInstructionsCode(InstructionsInfo insCode, ControlItemConfiguration config)
        {
            byte[] result = null;

            OneLevelCode     lv      = (OneLevelCode)insCode.LevelOneCode;
            InstructionsCode invoker = null;

            switch (lv)
            {
            case OneLevelCode.MOUSE_AND_KEYBOARD:
                invoker = kic;
                break;

            case OneLevelCode.IMAGE_SEND:
                invoker = siic;
                break;

            case OneLevelCode.SYSTEM_OP:
                invoker = soic;
                break;
            }
            if (invoker != null)
            {
                if (insCode.Direct != 0)
                {
                    config.ReportClient.SendPacket((byte)insCode.Direct, config.Id, 0);
                }
                result = invoker.Execute(insCode, config);
            }
            return(result);
        }
        public override byte[] Execute(InstructionsInfo insCode, ControlItemConfiguration config)
        {
            int levelCode = insCode.LevelTwoCode;

            byte[]       data    = insCode.Data;
            MemoryStream command = new MemoryStream(10);

            command.WriteByte((byte)levelCode);
            command.Write(data, 0, data.Length);
            this.SendCommand(command.ToArray());
            return(null);
        }
Example #4
0
        public static InstructionsInfo Parse(byte[] pipe)
        {
            InstructionsInfo result = new InstructionsInfo();

            result.direct       = pipe[0];
            result.levelOneCode = pipe[1];
            result.levelTwoCode = pipe[2];
            int length = BitConverter.ToInt16(pipe, 3);

            result.data = null;
            if (length > 0)
            {
                result.data = new byte[length];
                Array.Copy(pipe, 5, result.data, 0, result.data.Length);
            }
            else
            {
                result.data = new byte[0];
            }
            return(result);
        }
        private void CommandControlListen(Object obj)
        {
            Socket svr = obj as Socket;

            EndPoint tp = new IPEndPoint(IPAddress.Parse(this.config.TargetAddress), 0);

            if (svr != null)
            {
                while (true)
                {
                    try
                    {
                        int len   = svr.ReceiveFrom(udpBuffer, ref tp);
                        var iinfo = InstructionsInfo.Parse(udpBuffer);
                        InstructionsCode.ExecuteInstructionsCode(iinfo, this.config);
                    }
                    catch (Exception)
                    {
                        //Console.WriteLine(ex.Message);
                    }
                }
            }
        }
Example #6
0
 public abstract byte[] Execute(InstructionsInfo insCode, ControlItemConfiguration config);
Example #7
0
        public override byte[] Execute(InstructionsInfo insCode, ControlItemConfiguration config)
        {
            int levelCode = insCode.LevelTwoCode;

            byte[]    data    = insCode.Data;
            LevelCode lv      = (LevelCode)levelCode;
            var       appPath = String.Format("{0}\\RemoteDesktopWindow.exe 0 0 0", config.BasePath);

            //消息反馈
            switch (lv)
            {
            case LevelCode.MODIFY_AUTH:
                if (data != null && data.Length == 6)
                {
                    var value = Encoding.ASCII.GetString(data);
                    if (value.Length == 6)
                    {
                        SetAuthCode(value);
                    }
                }
                break;

            case LevelCode.MODIFY_LOCK:
                if (data != null && data.Length == 1)
                {
                    var value = Encoding.ASCII.GetString(data);
                    if (value.Length == 1)
                    {
                        SetAuthLock(value);
                        CreateUserProcess(appPath);
                    }
                }
                break;

            case LevelCode.MODIFY_ID:
                if (data != null)
                {
                    var value = Encoding.ASCII.GetString(data);
                    SetMHID(value);
                }
                break;

            case LevelCode.MODIFY_LOGIN_NAME:
                if (data != null)
                {
                    var value = Encoding.ASCII.GetString(data);
                    SetLoginName(value);
                }
                break;

            case LevelCode.MODIFY_SUPPER_CODE:
                if (data != null)
                {
                    var value = Encoding.ASCII.GetString(data);
                    SetSupperCode(value);
                }
                break;

            case LevelCode.LOGOUT:
                int state = CreateUserProcess(appPath);
                break;

            case LevelCode.SHOW_MESSAGE:
                if (data != null)
                {
                    var msg = Encoding.UTF8.GetString(data);
                    ShowMessage("来自管理员的消息", msg);
                }
                break;

            case LevelCode.TERMINATE_AUTH:
                SetAuthCode("010101");
                CreateUserProcess(appPath);
                break;
            }
            return(null);
        }