示例#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);
        }
示例#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 DesktopControl(ControlItemConfiguration config)
 {
     this.config      = config;
     this.thread      = new Thread(CommandControlListen);
     this.targetPoint = new IPEndPoint(IPAddress.Parse(this.config.TargetAddress), this.config.TargetControlPort);
     this.server      = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
     this.server.Bind(new IPEndPoint(IPAddress.Any, this.config.LocalControlPort));
 }
        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);
        }
示例#5
0
 public abstract byte[] Execute(InstructionsInfo insCode, ControlItemConfiguration config);
示例#6
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);
        }