コード例 #1
0
ファイル: ManagerProtocolTests.cs プロジェクト: 10sa/IBLVM
        public void ConnectionTest()
        {
            IBLVMServer server = new IBLVMServer(new SessionControl());

            server.Bind(new IPEndPoint(IPAddress.Any, 40001));
            server.Listen(5);
            server.Start();

            IBLVMManager manager = new IBLVMManager();

            manager.Conncet(new IPEndPoint(AccessIP, 40001));

            while (manager.Status != (int)ClientSocketStatus.Connected)
            {
                ;
            }
            manager.Login("1234", "1234");

            while (manager.Status != (int)ClientSocketStatus.LoggedIn)
            {
                ;
            }
            server.Dispose();
            manager.Dispose();
        }
コード例 #2
0
        public void BitLockerListingTest()
        {
            IBLVMServer server = new IBLVMServer(new SessionControl());

            server.Bind(new IPEndPoint(IPAddress.Any, 47859));
            server.Listen(5);
            server.Start();

            IBLVMClient client = new IBLVMClient();

            client.Connect(new IPEndPoint(AccessIP, 47859));
            while (client.Status != (int)ClientSocketStatus.Connected)
            {
                ;
            }

            client.Login("Test", "Test");
            while (client.Status != (int)ClientSocketStatus.LoggedIn)
            {
                ;
            }

            IBLVMManager manager = new IBLVMManager();

            manager.Conncet(new IPEndPoint(IPAddress.Loopback, 47859));
            client.Dispose();
            server.Dispose();
        }
コード例 #3
0
        public void IVExchangeTest()
        {
            IBLVMServer server = new IBLVMServer(new SessionControl());

            server.Bind(new IPEndPoint(IPAddress.Any, 47860));
            server.Listen(5);
            server.Start();

            IBLVMClient client = new IBLVMClient();

            client.Connect(new IPEndPoint(AccessIP, 47860));
            while (client.Status != (int)ClientSocketStatus.Connected)
            {
                ;
            }

            client.Login("Test", "Test");
            while (client.Status != (int)ClientSocketStatus.LoggedIn)
            {
                ;
            }

            client.ExchangeIV();
            byte[] nextIV = client.CryptoProvider.NextIV;

            while (!nextIV.SequenceEqual(client.CryptoProvider.CryptoStream.IV))
            {
                ;
            }
            client.Dispose();
            server.Dispose();
        }
コード例 #4
0
ファイル: ManagerProtocolTests.cs プロジェクト: 10sa/IBLVM
        public void DeviceListingTest()
        {
            bool        isEndable = false;
            IBLVMServer server    = new IBLVMServer(new SessionControl());

            server.Bind(new IPEndPoint(IPAddress.Any, 40001));
            server.Listen(5);
            server.Start();

            IBLVMClient client = new IBLVMClient();

            client.Connect(new IPEndPoint(AccessIP, 40001));
            while (client.Status != (int)ClientSocketStatus.Connected)
            {
                ;
            }

            client.Login("1234", "1234");
            while (client.Status != (int)ClientSocketStatus.LoggedIn)
            {
                ;
            }


            IBLVMManager manager = new IBLVMManager();

            manager.Conncet(new IPEndPoint(AccessIP, 40001));

            while (manager.Status != (int)ClientSocketStatus.Connected)
            {
                ;
            }
            manager.Login("1234", "1234");

            while (manager.Status != (int)ClientSocketStatus.LoggedIn)
            {
                ;
            }
            manager.OnDevicesReceived += (a) =>
            {
                foreach (var device in a)
                {
                    Console.WriteLine(device.ToString());
                }

                isEndable = true;
            };

            manager.GetDeviceList();

            while (manager.Status != (int)ClientSocketStatus.LoggedIn || !isEndable)
            {
                ;
            }
            server.Dispose();
            manager.Dispose();
        }
コード例 #5
0
ファイル: ManagerProtocolTests.cs プロジェクト: 10sa/IBLVM
        public void BitLockerLockTest()
        {
            bool        isEndable = false;
            IBLVMServer server    = new IBLVMServer(new SessionControl());

            server.Bind(new IPEndPoint(IPAddress.Any, 40001));
            server.Listen(5);
            server.Start();

            ConnectClient(new IPEndPoint(AccessIP, 40001));

            IBLVMManager manager = new IBLVMManager();

            manager.Conncet(new IPEndPoint(AccessIP, 40001));

            while (manager.Status != (int)ClientSocketStatus.Connected)
            {
                ;
            }
            manager.Login("1234", "1234");

            while (manager.Status != (int)ClientSocketStatus.LoggedIn)
            {
                ;
            }
            manager.OnDevicesReceived += (devices) =>
            {
                manager.OnDrivesReceived += (drives) =>
                {
                    manager.OnBitLockerCommandResponseReceived += (isSuccess) =>
                    {
                        Console.WriteLine(isSuccess);
                        isEndable = true;
                    };

                    foreach (var drive in drives)
                    {
                        Console.WriteLine(drive);
                        if (drive.Drive.Name.Contains("E"))
                        {
                            manager.LockBitLockerDrive(devices[0], drive.Drive);
                        }
                    }
                };

                manager.GetDeviceDrives(devices[0]);
            };

            manager.GetDeviceList();
            while (manager.Status != (int)ClientSocketStatus.LoggedIn || !isEndable)
            {
                ;
            }
            server.Dispose();
            manager.Dispose();
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: 10sa/IBLVM
        static void Main(string[] args)
        {
            Console.WriteLine("Initialize server...");
            IBLVMServer server = new IBLVMServer(new SessionValidateor());

            server.Bind(new IPEndPoint(IPAddress.Any, 54541));
            server.Listen(5);
            server.Start();

            Console.WriteLine("OK!");
            server.ServerThread.Join();
        }
コード例 #7
0
        public void HandshakeTest()
        {
            IBLVMServer server = new IBLVMServer(new SessionControl());

            server.Bind(new IPEndPoint(IPAddress.Any, 47857));
            server.Listen(5);

            server.Start();

            IBLVMClient client = new IBLVMClient();

            client.Connect(new IPEndPoint(AccessIP, 47857));

            while (client.Status != (int)ClientSocketStatus.Connected)
            {
                ;
            }
            client.Dispose();
            server.Dispose();
        }