Exemplo n.º 1
0
        public void RequestSetStartupSafeModeTest()
        {
            if (NonAdmin.DoesServiceExist("Bolter Admin Service", Environment.MachineName))
            {
                var keyPath  = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon";
                var shellKey = "Shell";
                var key      = Registry.LocalMachine.OpenSubKey(keyPath, false);

                ReceiverClient client = new ReceiverClient();
                client.ConnectToBolterService(IP_SERVER_ADDRESS, PORT);

                Thread.Sleep(1000);
                string initial = (string)key.GetValue(shellKey);

                Console.WriteLine("Initial value :" + initial);
                client.RequestSetStartupSafeMode(true, System.Reflection.Assembly.GetEntryAssembly().Location);

                Thread.Sleep(1000);
                string edited = (string)key.GetValue(shellKey);

                Console.WriteLine("Edited value :" + edited);
                client.RequestSetStartupSafeMode(false, System.Reflection.Assembly.GetEntryAssembly().Location);

                Thread.Sleep(1000);
                string revert = (string)key.GetValue(shellKey);

                Console.WriteLine("Revert value :" + revert);
                Assert.AreEqual(initial, revert);
            }
            else
            {
                Assert.Fail("The Bolter Service must be installed to run this test");
            }
        }
Exemplo n.º 2
0
        static void RealServiceTestTCP(bool install)
        {
            string IP_SERVER_ADDRESS = "127.0.0.1";
            int    PORT = 8976;

            if (install)
            {
                if (Bolter.NonAdmin.IsInAdministratorMode())
                {
                    Admin.InstallService();
                }
                else
                {
                    throw new InvalidOperationException("Need the demo to be in Admin mode to install the service");
                }
            }

            var client = new ReceiverClient();

            client.ConnectToBolterService(IP_SERVER_ADDRESS, PORT);
            // client.SendMessage("First_msg");
            // client.SendMessage("2nd_msg");
            // client.SendMessage("last msg");
            // client.SendMessage("2nd_msg_2");
            int LOGON32_LOGON_BATCH             = 4; // DOESNT WORK
            int LOGON32_LOGON_NETWORK           = 3;
            int LOGON32_LOGON_INTERACTIVE       = 2;
            int LOGON32_LOGON_NETWORK_CLEARTEXT = 8;
            int LOGON32_LOGON_SERVICE           = 5;
            int type = LOGON32_LOGON_INTERACTIVE;

            client.RequestImpersonation(type);
            Thread.Sleep(5000);
            client.RequestSetBatchAndCMDBlock(true);

            //client.WaitAndPrintResponse();
            // client.SendToService("{ \"name\":\"SetBatchAndCMDBlock\",\"block\":false}");
            ///client.SendToService("Last msg");
            // client.RequestSetBatchAndCMDBlock(false);
            // client.RequestSetBatchAndCMDBlock(true);

            // Auto free
            var timer = new System.Timers.Timer(20000);

            timer.Elapsed += (s, e) =>
            {
                // Reconnect test
                // client.RequestDisableAllAdminRestrictions(AppDomain.CurrentDomain.BaseDirectory);
                client.SendMessage("Hello");
                Thread.Sleep(3000);
                client.SendMessage("Hello2");
                if (install)
                {
                    Admin.UninstallService();
                }
            };
            timer.AutoReset = false;
            timer.Start();
        }
Exemplo n.º 3
0
        private static void TcpAdminBridgeTest()
        {
            var tcpClient = new ReceiverClient();
            // TODO relative paths
            var bridgePath     = @"C:\Users\franc\source\repos\Bolter\BridgeProcess\bin\Debug\netcoreapp3.1\BridgeProcess.exe";
            var mockServiceApp = @"C:\Users\franc\source\repos\Bolter\MockService\bin\Debug\netcoreapp3.1\MockService.exe";

            tcpClient.ConnectToBolterService(IP_SERVER_ADDRESS, PORT);

            // Info commands
            tcpClient.SendMessage("unblocksqdsqd");
            tcpClient.SendMessage("ooo");
            tcpClient.RequestInstallService();
            Console.ReadLine();
            Bolter.NonAdmin.DisableAllNonAdminRestrictions();
            tcpClient.RequestDisableAllAdminRestrictions(AppDomain.CurrentDomain.BaseDirectory);
        }
Exemplo n.º 4
0
 static void Main(string[] args)
 {
     Console.WriteLine("This is the demo client (console version), user : "******"[MATRIX] Requesting remote service admin commands");
         // Use the service or bridge admin app
         cl.ConnectToBolterService(IP_SERVER_ADDRESS, PORT);
         // cl.RequestSetBatchAndCMDBlock(false);
         // cl.RequestPreventDateEditingW10(true);
         // cl.RequestSetBatchAndCMDBlock(false);
         // AdminSandbox.RequestRemoteCommands(cl);
         Console.WriteLine("[MATRIX] All commands requested");
         // Thread.Sleep(20000);
         Console.WriteLine("Now unblocking");
         cl.RequestDisableAllAdminRestrictions(AppDomain.CurrentDomain.BaseDirectory);
         Console.WriteLine("Sleeping 20s");
     }
     else
     {
         Admin.SetBatchAndCMDBlock(false, "franc");
         Admin.PreventDateEditingW10(true);
         Admin.SetBatchAndCMDBlock(false, "franc");
     }
     Console.WriteLine("Unblocked Admin");
     NonAdmin.DisableAllNonAdminRestrictions();
     //cl.RequestDisableAllAdminRestrictions(AppDomain.CurrentDomain.BaseDirectory);
     // RealServiceTestTCP(true);
     new ManualResetEvent(false).WaitOne();
 }