Exemple #1
0
        private void ShowUser(AccessTokenHandle hToken)
        {
            var user = AccessTokenUser.FromTokenHandle(hToken);

            console.WriteLine("[USERNAME]");
            console.WriteLine("");
            console.WriteLine(user.ToOutputString());
            console.WriteLine("");
        }
Exemple #2
0
        private void InnerCreateProcess(int processId, int sessionId)
        {
            var applicationName = @"C:\Windows\System32\cmd.exe";

            if (this.options.ApplicationName != null && this.options.ApplicationName != "")
            {
                applicationName = this.options.ApplicationName;
            }
            var builder = new TMProcessBuilder().
                          SetApplication(applicationName).
                          SetCommandLine(this.options.CommandLine);

            if (sessionId != -1)
            {
                builder.UsingSessionId((uint)sessionId);
            }
            else
            {
                builder.UsingExistingProcessToken(processId);
            }


            if (this.options.EnabledAllPossiblePrivileges)
            {
                builder.EnableAllPrivileges();
            }

            if (this.options.SameSessionId)
            {
                builder.EnsureSameSesssionId();
            }

            if (this.options.NoGUI)
            {
                builder.UseNoGUI();
            }

            if (this.options.AsUser)
            {
                console.Debug("Starting with CreateProcessAsUser");
                builder.UsingCreateProcessAsUser();
            }
            else
            {
                console.Debug("Starting with CreateProcessWithTokenW");
                builder.UsingCreateProcessWithToken();
            }

            if (this.options.Interactive)
            {
                builder.SetupInteractive();
            }

            var tmProcess = builder.Create();

            if (this.options.Interactive)
            {
                // Attempt to attach to the processes STDin and STDout.
                console.WriteLine("[WIP]: Starting interactive shell... ");
            }
        }