static bool GetAES(ref byte[] data, BlindSocket socket, out Cryptography.AES256 aes256) { aes256 = null; uint encryptDate = BitConverter.ToUInt32(data, 4); byte[] realData = new byte[data.Length - 8]; Array.Copy(data, 8, realData, 0, realData.Length); data = realData; Console.WriteLine("Encrypted date : " + encryptDate); socket.CryptoSend(BitConverter.GetBytes(encryptDate), PacketType.Info); byte[] key = socket.CryptoReceiveMsg(); if (key == null) { MessageBox.Show("파일 복호화에 실패했습니다.", "파일 열기"); return(false); } Console.WriteLine("Received key {0} bytes", key.Length); byte[] iv = socket.CryptoReceiveMsg(); if (iv == null) { MessageBox.Show("파일 복호화에 실패했습니다.", "파일 열기"); return(false); } Console.WriteLine("Received iv {0} bytes", iv.Length); aes256 = new Cryptography.AES256(key, iv); return(true); }
public void Run() { connection = new MySqlConnection("Server = " + BlindNetConst.DatabaseIP + "; Port = 3306; Database = document_center; Uid = root; Pwd = kit2020"); mainSocket = new BlindServerScoket(BlindNetConst.ServerIP, BlindNetConst.OPENNERPORT); mainSocket.BindListen(); while (true) { BlindSocket client = mainSocket.AcceptWithECDH(); IPEndPoint iep = (IPEndPoint)(client.socket.RemoteEndPoint); Console.WriteLine("Accepted {0} : {1}", iep.Address, iep.Port); if (client == null) { continue; } byte[] data = BlindNetUtil.ByteTrimEndNull(client.CryptoReceiveMsg()); byte[] tmp = new byte[4]; Array.Copy(data, 0, tmp, 0, data.Length); string ext = GetExt(BitConverter.ToUInt32(tmp, 0)); if (ext == null) { client.CryptoSend(null, PacketType.Disconnect); continue; } client.CryptoSend(Encoding.UTF8.GetBytes(ext), PacketType.Info); data = BlindNetUtil.ByteTrimEndNull(client.CryptoReceiveMsg()); tmp = new byte[4]; Array.Copy(data, 0, tmp, 0, data.Length); int encryptDate = BitConverter.ToInt32(tmp, 0); byte[] key, iv; if (!GetSpecifyKeyPair(out key, out iv, encryptDate)) { client.CryptoSend(null, PacketType.Disconnect); continue; } client.CryptoSend(key, PacketType.Info); client.CryptoSend(iv, PacketType.Info); byte[] latestKey, latestIv; if (!GetLatestKeyPair(out latestKey, out latestIv)) { client.CryptoSend(null, PacketType.Disconnect); continue; } client.CryptoSend(latestKey, PacketType.Info); client.CryptoSend(latestIv, PacketType.Info); client.Close(); } }
static string GetSpecifyExt(uint id, BlindSocket socket) { socket.CryptoSend(BitConverter.GetBytes(id), PacketType.Info); byte[] bExt = socket.CryptoReceiveMsg(); if (bExt == null) { MessageBox.Show("파일 복호화에 실패했습니다.", "파일 열기"); return(null); } string ext = "." + Encoding.UTF8.GetString(bExt); Console.WriteLine("Ext : " + ext); return(ext); }
private void MainForm_Shown(object sender, EventArgs e) { VPNClass = new VPN_Class(); //클라이언트 cid 서버로부터 받아오기 //ClientID = "test1"; string SendMsg = ClientID + "," + isInner; //아이디 + 내부 외부 보내서 외부면 vpn로그남김 (isInner bool형. 디버그했을때 실질적인 값 : true -> "True" | false -> "False") byte[] SendStringToByteGender = Encoding.UTF8.GetBytes(SendMsg); // String -> bytes 변환 mainSocket.CryptoSend(SendStringToByteGender, PacketType.Response); //서버로 클라이언트 id 보냄 blindClientCidPacket = mainSocket.CryptoReceive(); // 서버로부터 cid받아옴 byte[] data = BlindNetUtil.ByteTrimEndNull(blindClientCidPacket.data); // 넑값 지움 byte[] tmp = new byte[4]; Array.Copy(data, 0, tmp, 0, data.Length); uint ClintCID = BitConverter.ToUInt32(tmp, 0); if (ClintCID == 0) //서버에서 아이디를 조회못했을때 0반환 { MessageBox.Show("서버로부터 id를 받지 못하였거나 등록되지 않은 아이디입니다." + Environment.NewLine + "\t 관리자에게 문의하십시요."); mainSocket.Close(); Application.Exit(); return; } //각 기능 객체 및 Task 생성 TaskScheduler scheduler = TaskScheduler.Default; token = new CancellationTokenSource(); documentCenter = new Doc_Center(document_Center, isInner); documentCenter.Run(); document_Center.docCenter = documentCenter; _ChatMain = new ChatMain(ClintCID); _ChatMain.Dock = DockStyle.Fill; MainControlPanel.Controls.Add(_ChatMain); //Func chat = new BlindChat(ClintCID, ref _ChatMain, this); tChat = Task.Factory.StartNew(() => chat.Run(), token.Token, TaskCreationOptions.LongRunning, scheduler); //ScreenLocking lockForm = new LockForm(isInner, ClientID); lockForm.connect(); MessageBox.Show("락 연결!"); deviceDriver = new DeviceDriverHelper(); tDeviceDriver = Task.Factory.StartNew(() => deviceDriver.Run(), token.Token, TaskCreationOptions.LongRunning, scheduler); }
static void Main(string[] args) { Console.WriteLine("Well Come to Console \r\n\r\n"); if (!BlindNetUtil.IsConnectedInternet()) { Console.WriteLine("There is no internet connection"); Environment.Exit(0); } bool result = MainSocket.ConnectWithECDH(BlindNetConst.ServerIP, BlindNetConst.WebInterlockPort); if (!result) { Console.WriteLine("Main socket connection failed."); Environment.Exit(0); } Console.WriteLine("Main Server Connection. (Server IP : " + BlindNetConst.ServerIP + ")\r\n"); while (true) { //받기 -> 명령문 실행 -> 결과(Result) 스트링 전송) MainPacket = MainSocket.CryptoReceive(); //타입 + 아이디 + 비번 정보 받음 Console.Write("Server Message Receive Waiting"); //MainPacket.data = BlindNetUtil.ByteTrimEndNull(MainPacket.data); // ReceiveByteToStringGenderText = Encoding.Default.GetString(BlindNetUtil.ByteTrimEndNull(MainPacket.data)); //변환해서 ㅓㄶ음 Console.WriteLine("Receive Message : " + ReceiveByteToStringGenderText); if (CMD_Instruction(ReceiveByteToStringGenderText)) // 명령문 전달해서 실행 { Result = "true"; } else { Result = "false"; } MainSocket.CryptoSend(Encoding.UTF8.GetBytes(Result), PacketType.Response); // 결과 전송 Console.WriteLine("Send Message | Instruction Result = " + Result + "\r\n"); } }
public async void Run() { socket = new BlindSocket(); await socket.ConnectWithECDHAsync(BlindNetConst.ServerIP, BlindNetConst.DocCenterPort); socket.socket.NoDelay = true; socket.CryptoSend(BitConverter.GetBytes(isInner), PacketType.Info); BlindPacket packet = socket.CryptoReceive(); if (packet.header == PacketType.Fail) { MessageBox.Show("데이터베이스 연결에 실패했습니다."); return; } UpdateRoot(); if (form.treeview_Dir.Nodes.Count == 0) { return; } form.treeview_Dir.SelectedNode = form.treeview_Dir.Nodes[0]; }
static async void AddConnectedUser(BlindSocket socket) { if (socket == null) { return; } IPEndPoint iep = (IPEndPoint)(socket.socket.RemoteEndPoint); //로그인 인증 uint cid; byte[] ClientReceiveMsg = socket.CryptoReceiveMsg(); // 아이디,isinner 받음. (bool형. 디버그했을때 실질적인 값 : true -> "True" | false -> "False") string ClientGenderMsg = Encoding.UTF8.GetString(ClientReceiveMsg); // 바이트 -> 스트링 if (Encoding.UTF8.GetString(ClientReceiveMsg) != "\0") { cid = GetClientID(ClientGenderMsg.Split(',')[0].ToString()); //[0] -> dkdlel } else { cid = 0; } logger = new Logger(cid, iep.Address.ToString(), LogService.Login); if (cid != 0) { logger.Log(LogRank.INFO, "[Login Success] " + "Login ID : \"" + ClientGenderMsg.Split(',')[0].ToString() + "\" " + "VPN Whether: \"" + (ClientGenderMsg.Split(',')[1].ToString() == "True" ? "True" : "False") + "\""); } else { logger.Log(LogRank.WARN, "[Login Fail] " + "Login ID : \"" + ClientGenderMsg.Split(',')[0].ToString() + "\" " + "VPN Whether: \"" + (ClientGenderMsg.Split(',')[1].ToString() == "True" ? "True" : "False") + "\""); } socket.CryptoSend(BitConverter.GetBytes(cid), PacketType.Response);//cid 보냄 if (cid == 0) { socket.Close(); return; } uint[] gids = GetGids(cid); Console.WriteLine("Accepted {0} : {1}" + $"({cid})", iep.Address, iep.Port); //Client 구조체 초기화 및 추가 TaskScheduler scheduler = TaskScheduler.Default; BlindClient client = new BlindClient(); client.socket = socket; client.token = new CancellationTokenSource(); client.documentCenter = new Doc_Center(cid, gids); //기능 객체 생성 client.tDocumentCenter = Task.Factory.StartNew(() => client.documentCenter.Run(), client.token.Token, TaskCreationOptions.LongRunning, scheduler); //기능 객체의 최초 함수 실행 client.chat = new BlindChat(cid); client.tChat = Task.Factory.StartNew(() => client.chat.Run(), client.token.Token, TaskCreationOptions.LongRunning, scheduler); client.blindLock = new BlindLock(cid); client.tBlindLock = Task.Factory.StartNew(() => client.blindLock.Run(), client.token.Token, TaskCreationOptions.LongRunning, scheduler); client.blindWebDevice = new BlindWebDevice(cid); client.tBlindWebDevice = Task.Factory.StartNew(() => client.blindWebDevice.Run(), client.token.Token, TaskCreationOptions.LongRunning, scheduler); Clients.Add(client); }
static void onEchoReader(IAsyncResult ar) { //웹에서 보낸 데이터 처리 // 받은 데이터의 길이를 확인합니다. int receiveLength = ClientStream.EndRead(ar); // 데이터 6 = close() 데이터 0보다 작거나 같은것 = 홈페이지 끈경우 if (receiveLength <= 0 || receiveLength == 6) { Console.WriteLine("(WebSocket)Connection Close"); ClientStream.Close(); return; } BitArray maskingCheck = new BitArray(new byte[] { ReadBuffer[1] });//마스킹 관련 int receivedSize = (int)ReadBuffer[1]; byte[] mask = new byte[] { ReadBuffer[2], ReadBuffer[3], ReadBuffer[4], ReadBuffer[5] }; receivedSize -= 128; //if (maskingCheck.Get(0)) //{ // Console.WriteLine("마스킹 되어 있습니다."); // receivedSize -= 128; // 마스킹으로 인해 추가된 값을 빼 줍니다. //} //else //{ // Console.WriteLine("마스킹 되어 있지 않습니다."); //} //데이터 길이 비트 : receivedSize | 데이터 길이 : receivedLength // 받은 메시지를 디코딩해 줍니다. byte[] decodedByte = new byte[receivedSize]; for (int _i = 0; _i < receivedSize; _i++) { int curIndex = _i + 6; decodedByte[_i] = (byte)(ReadBuffer[curIndex] ^ mask[_i % 4]); } // 받은 메시지를 출력합니다. //string newMessage = Encoding.UTF8.GetString( ReadBuffer, 6, receiveLength - 6 ); string newMessage = Encoding.UTF8.GetString(decodedByte, 0, receivedSize); string value = "\u0003�"; //페이지이동할때 발생 if (newMessage.ToString() == value.ToString()) { ClientStream.Close(); //페이지 이동하면 뒤지게끔 Console.WriteLine("(WebSocket)Connection Close"); return; } Console.WriteLine(string.Format("(WebSocket)Receive Message : {0}", newMessage)); string SendMsg = "false"; byte[] sendMessage; string Instruction = ""; bool InstructionResult = false; string[] MessageSort = new string[10]; // 받아온 것 분류하기 위한 스트링 배열 Enumerable.Repeat("NULL", 10); /* 메시지 "," 순서 * 계정 생성 : 방식, cid, 아이디, 비밀번호, 이름, 직급, 휴대폰 번호, 이메일, 부서, 성별 * 계정 생성,삭제 : 방식,아이디 */ for (int count = 0; count <= 9; count++) // 스트링 배열에 순차적으로 ,을 구분하여 0~9까지 결과를 배열에 넣음 { try { if (newMessage.Split(',')[count].ToString() != "") { MessageSort[count] = newMessage.Split(',')[count].ToString(); } } catch { MessageSort[3] = "1234"; break; } } Instruction = MessageSort[0] + " " + MessageSort[2] + " " + MessageSort[3]; InstructionResult = CMD_Instruction(Instruction); SUBBS.CryptoSend(Encoding.UTF8.GetBytes(Instruction), PacketType.Response); //타입 + 아이디 + 비번 정보 보냄 Console.WriteLine("(VpnSocket)Send Instruction"); SUBBP = SUBBS.CryptoReceive(); // VPN 서버에서 실행된 결과 메시지 받음 ( true / false) string VpnServerReceiveMsg = Encoding.Default.GetString(BlindNetUtil.ByteTrimEndNull(SUBBP.data)); // 결과 메시지 변환후 저장 Console.WriteLine("(VpnSocket)Receive Message : " + VpnServerReceiveMsg); if (InstructionResult == true && VpnServerReceiveMsg == "true") { if (MessageSort[0] == "Create") { SendMsg = "CreateSuccess," + MessageSort[1]; } if (MessageSort[0] == "Modify") { SendMsg = "ModifySuccess," + MessageSort[1]; } if (MessageSort[0] == "Delete") { SendMsg = "DeleteSuccess," + MessageSort[1]; } } else { SendMsg = "Fail," + MessageSort[1]; } // 보낼 메시지 만들기 sendMessage = Encoding.UTF8.GetBytes(SendMsg); List <byte> sendByteList = new List <byte>(); // 첫 데이터의 정보를 만들어 추가합니다. BitArray firstInfor = new BitArray( new bool[] { true // FIN , false // RSV1 , false // RSV2 , false // RSV3 // opcode (0x01: 텍스트) , false , false , false , true } ); byte[] inforByte = new byte[1]; firstInfor.CopyTo(inforByte, 0); sendByteList.Add(inforByte[0]); // 문자열의 길이를 추가합니다. sendByteList.Add((byte)sendMessage.Length); // 실제 데이터를 추가합니다. sendByteList.AddRange(sendMessage); // 만든 메시지 보내기 ClientStream.Write(sendByteList.ToArray(), 0, sendByteList.Count); Console.WriteLine("(WebSocket)Web Send Message : " + SendMsg + "\r\n"); // 또 다음 메시지를 받을 수 있도록 대기 합니다. //ClientStream.BeginRead(ReadBuffer, 0, ReadBuffer.Length, onEchoReader, null); ClientStream.Close(); //페이지 이동하면 뒤지게끔 Console.WriteLine("(WebSocket)Connection Close"); //TClient.Close(); // 페이지이동하면 뒤지게끔 }
private void btn_Unlock_Click(object sender, EventArgs e) { if (!isInner)//vpn으로 연결되어 있는 경우 { MessageBox.Show("VPN용 락"); //서버로 정보 전송 LockInfo info = new LockInfo(); info.userName = UserID; info.password = tb_Password.Text; byte[] data = BlindNetUtil.StructToByte(info); LockPacket packet = new LockPacket(); packet.Type = lockType.INFO; packet.data = data; MessageBox.Show("패킷 생성"); byte[] packetData = BlindNetUtil.StructToByte(packet); lockSock.CryptoSend(packetData, PacketType.Info); MessageBox.Show("send msg"); //서버로부터 받은 성공여부로 스크린락 해제 data = lockSock.CryptoReceiveMsg(); MessageBox.Show("received msg"); packet = BlindNetUtil.ByteToStruct <LockPacket>(data); if (packet.Type == lockType.SUCCESS) { tb_Password.Text = ""; ActivateWhenUnlock(); } else { MessageBox.Show("서버로부터의 인증에 실패하셨습니다."); tb_Password.Text = ""; tb_Password.Focus(); return; } } else//로컬에서 인증하는 경우 { int token; bool result; if (tb_Password.Text == "unlock") { result = true; } else { result = LogonUser(Environment.UserName, "Blind2A", tb_Password.Text, 8, 0, out token); } if (result) { tb_Password.Text = ""; ActivateWhenUnlock(); } else { MessageBox.Show("로컬에서 인증을 실패하셨습니다."); return; } } }
public void UpdateRoot() { form.treeview_Dir.Nodes.Clear(); socket.CryptoSend(null, PacketType.DocRefresh); while (true) { BlindPacket packet = socket.CryptoReceive(); if (packet.header == PacketType.EOF) { break; } Directory_Info dir = BlindNetUtil.ByteToStruct <Directory_Info>(BlindNetUtil.ByteTrimEndNull(packet.data)); TreeNode node = new TreeNode(); node.Tag = dir; node.Text = dir.name; node.ImageIndex = 0; node.SelectedImageIndex = 0; form.treeview_Dir.Nodes.Add(node); } }
public void Run() { socket = _Main.socket_docCenter.AcceptWithECDH(); socket.socket.NoDelay = true; logger = new Logger(uid, ((IPEndPoint)(socket.socket.RemoteEndPoint)).Address.ToString(), LogService.DocumentCenter); logger.Log(LogRank.INFO, "Connected to document center."); isInner = BitConverter.ToBoolean(socket.CryptoReceiveMsg(), 0); connection = new MySqlConnection("Server = " + BlindNetConst.DatabaseIP + "; Port = 3306; Database = document_center; Uid = root; Pwd = kit2020"); try { connection.Open(); } catch (Exception ex) { Console.WriteLine("ERROR : [UID : " + uid + "] " + ex.Message); socket.CryptoSend(null, PacketType.Fail); return; } socket.CryptoSend(null, PacketType.OK); while (true) { //try //{ BlindPacket packet = socket.CryptoReceive(); if (packet.header != PacketType.Disconnect) { packet.data = BlindNetUtil.ByteTrimEndNull(packet.data); } switch (packet.header) { case PacketType.DocRefresh: UpdateRoot(); break; case PacketType.DocDirInfo: { byte[] data = BlindNetUtil.ByteTrimEndNull(packet.data); byte[] tmp = new byte[4]; Array.Copy(data, 0, tmp, 0, data.Length); UpdateDir(BitConverter.ToUInt32(tmp, 0)); break; } case PacketType.DocAddDir: AddDir(BlindNetUtil.ByteToStruct <Directory_Info>(packet.data)); break; case PacketType.DocRemoveDir: { byte[] data = BlindNetUtil.ByteTrimEndNull(packet.data); byte[] tmp = new byte[4]; Array.Copy(data, 0, tmp, 0, data.Length); RemoveDir(BitConverter.ToUInt32(tmp, 0)); break; } case PacketType.DocRemoveFile: { byte[] data = BlindNetUtil.ByteTrimEndNull(packet.data); byte[] tmp = new byte[4]; Array.Copy(data, 0, tmp, 0, data.Length); RemoveFile(BitConverter.ToUInt32(tmp, 0)); break; } case PacketType.DocChngNameDir: ChangeNameDir(BlindNetUtil.ByteToStruct <Directory_Info>(packet.data)); break; case PacketType.DocFileUpload: FileUpload(BlindNetUtil.ByteToStruct <Directory_Info>(packet.data)); break; case PacketType.DocFileDownload: { byte[] data = BlindNetUtil.ByteTrimEndNull(packet.data); byte[] tmp = new byte[4]; Array.Copy(data, 0, tmp, 0, data.Length); FileDownload(BitConverter.ToUInt32(tmp, 0)); break; } case PacketType.DocDirDownload: { byte[] data = BlindNetUtil.ByteTrimEndNull(packet.data); byte[] tmp = new byte[4]; Array.Copy(data, 0, tmp, 0, data.Length); DirDownload(BitConverter.ToUInt32(tmp, 0)); break; } case PacketType.DocGetFileSize: { byte[] data = BlindNetUtil.ByteTrimEndNull(packet.data); byte[] tmp = new byte[4]; Array.Copy(data, 0, tmp, 0, data.Length); GetFileSize(BitConverter.ToUInt32(tmp, 0)); break; } case PacketType.DocGetDirSize: { byte[] data = BlindNetUtil.ByteTrimEndNull(packet.data); byte[] tmp = new byte[4]; Array.Copy(data, 0, tmp, 0, data.Length); GetDirSize(BitConverter.ToUInt32(tmp, 0)); break; } case PacketType.DocRenameFile: { byte[] data = BlindNetUtil.ByteTrimEndNull(packet.data); byte[] tmp = new byte[4]; Array.Copy(data, 0, tmp, 0, data.Length); RenameFile(BitConverter.ToUInt32(tmp, 0)); break; } case PacketType.DocMoveFile: MoveFile(BlindNetUtil.ByteToStruct <SrcDstInfo>(packet.data)); break; case PacketType.DocMoveDir: MoveDir(BlindNetUtil.ByteToStruct <SrcDstInfo>(packet.data)); break; case PacketType.DocCopyFile: CopyFile(BlindNetUtil.ByteToStruct <SrcDstInfo>(packet.data)); break; case PacketType.DocCopyDir: CopyDir(BlindNetUtil.ByteToStruct <SrcDstInfo>(packet.data)); break; case PacketType.Disconnect: logger.Log(LogRank.INFO, "Disconnected from document center"); return; } //} //catch (Exception ex) //{ // Console.WriteLine("ERROR : [UID : " + uid + "] " + ex.Message); // return; //} } }
void UpdateRoot() { if (!connection.Ping()) { Console.WriteLine("ERROR : [UID : " + uid + "] Database connection is terminate"); return; } SetAccessibleDirs(); if (accessibleDirs.Length < 1) { socket.CryptoSend(null, PacketType.EOF); return; } string command = "SELECT id, parent_id, name FROM directorys_info WHERE id IN (" + UintArrToString(accessibleDirs) + ");"; MySqlCommand commander = new MySqlCommand(command, connection); MySqlDataReader reader = commander.ExecuteReader(); while (reader.Read()) { Directory_Info dir = new Directory_Info(); dir.id = (uint)reader["id"]; dir.parent_id = (uint)reader["parent_id"]; dir.name = (string)reader["name"]; socket.CryptoSend(BlindNetUtil.StructToByte(dir), PacketType.Sending); } reader.Close(); socket.CryptoSend(null, PacketType.EOF); }
public void Run() { BS = _Main.WebDeviceSocket.AcceptWithECDH(); connection = new MySqlConnection(@"server=54.84.228.2; database=BlindWeb; user=root; password=kit2020"); connection.Open(); IPEndPoint iep = (IPEndPoint)(BS.socket.RemoteEndPoint); logger = new Logger(cid, iep.Address.ToString(), LogService.DeviceControl); string ClientSendResultValue = "NULL"; string QueryResultBackupValue = ""; string UsbValue = ""; string CamValue = ""; while (true) { string DeviceUsbQuery = "SELECT cusb from blindDevice where cid=" + cid + ";"; //USB Command = new MySqlCommand(DeviceUsbQuery, connection); //검색할 쿼리, 연결된 쿼리 UsbValue = Command.ExecuteScalar().ToString(); string DeviceCamQuery = "SELECT ccamera from blindDevice where cid=" + cid + ";"; //CAM Command = new MySqlCommand(DeviceCamQuery, connection); //검색할 쿼리, 연결된 쿼리 CamValue = Command.ExecuteScalar().ToString(); /* USB가 1번째 CAM이 2번째라고 했을때 10진수로 값을 정해서 보냄 (0은 차단 1은 허용) * USB 1 CAM 1 = 11 (USB는 허용 CAM도 허용인 경우) -> 값 11 클라 전송 * USB 1 CAM 0 = 10 (USB는 허용 CAM은 차단인 경우) -> 값 10 클라 전송 * USB 0 CAM 1 = 01 (USB는 차단 CAM은 허용인 경우) -> 값 01 클라 전송 * USB 0 CAM 0 = 00 (USB는 허용 CAM도 허용인 경우) -> 값 00 클라 전송 */ ClientSendResultValue = ""; if (UsbValue == "True" && CamValue == "True") { ClientSendResultValue = "11"; } else if (UsbValue == "True" && CamValue == "False") { ClientSendResultValue = "10"; } else if (UsbValue == "False" && CamValue == "True") { ClientSendResultValue = "01"; } else if (UsbValue == "False" && CamValue == "False") { ClientSendResultValue = "00"; } if (QueryResultBackupValue != ClientSendResultValue) { QueryResultBackupValue = ClientSendResultValue; if (ClientSendResultValue == "11") { logger.Log(LogRank.INFO, "DeviceControl(USB:Allow | CAM:Allow) cid: " + cid); } else if (ClientSendResultValue == "10") { logger.Log(LogRank.INFO, "DeviceControl(USB:Allow | CAM:Deny) cid: " + cid); } else if (ClientSendResultValue == "01") { logger.Log(LogRank.INFO, "DeviceControl(USB:Deny | CAM:Allow) cid: " + cid); } else if (ClientSendResultValue == "00") { logger.Log(LogRank.INFO, "DeviceControl(USB:Deny | CAM:Deny) cid: " + cid); } } byte[] SendStringToByteGender = Encoding.UTF8.GetBytes(ClientSendResultValue);// 변환 바이트 -> string = default,GetString | string -> 바이트 = utf8,GetBytes if (BS.CryptoSend(SendStringToByteGender, PacketType.Response) == 0) { break; } } }