Esempio n. 1
0
 public static void StartService(string serviceName = "Bolter Admin Service", string adminAppName = "BolterAdminApp", bool enableUACprompt = true)
 {
     if (enableUACprompt && !NonAdmin.IsInAdministratorMode())
     {
         // Technique : Use the admin app (UAC prompt)
         string projectDirPath = Directory.GetParent(System.IO.Directory.GetCurrentDirectory()).Parent.Parent.Parent.Parent.Parent.FullName; // The path to all visual studio projects
         var    adminAppPath   = projectDirPath + @$ "\Bolter\BolterAdminApp\bin\Debug\netcoreapp3.1\{adminAppName}.exe";
Esempio n. 2
0
 private static void InstallService()
 {
     Admin.InstallService();
     if (NonAdmin.IsInAdministratorMode())
     {
     }
     ;
 }
Esempio n. 3
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();
 }
Esempio n. 4
0
        public void SetStartupSafeModeTest()
        {
            if (!NonAdmin.IsInAdministratorMode())
            {
                throw new UnauthorizedAccessException("We need to run these tests with UAC enabled");
            }
            var    keyPath  = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon";
            var    shellKey = "Shell";
            var    key      = Registry.LocalMachine.OpenSubKey(keyPath, true);
            string initial  = (string)key.GetValue(shellKey);

            Admin.SetStartupSafeMode(true);
            Admin.SetStartupSafeMode(true); // Try to put 2 times the same path
            string edited = (string)key.GetValue(shellKey);

            Console.WriteLine("Edited to " + edited);
            Admin.SetStartupSafeMode(false);
            string revert = (string)key.GetValue(shellKey);

            Console.WriteLine("Reverted to " + revert);
            Assert.AreEqual(initial, revert);
        }
Esempio n. 5
0
 public void IsInAdministratorModeTest()
 {
     // No way to be sure at the moment
     NonAdmin.IsInAdministratorMode();
 }