PSAttack.PSAttackProcessing.AttackState.ClearIO C# (CSharp) Method

ClearIO() public method

public ClearIO ( bool display = false ) : void
display bool
return void
        public void ClearIO(bool display=false)
        {
            if (display == true)
            {
                this.displayCmd = "";
            }
            this.cmd = "";
            this.keyInfo = new ConsoleKeyInfo();
            this.cmdComplete = false;
            this.output = null;
        }

Usage Example

Beispiel #1
0
        // Here is where we execute posh code
        public static AttackState PSExec(AttackState attackState)
        {
            using (Pipeline pipeline = attackState.runspace.CreatePipeline())
            {
                pipeline.Commands.AddScript(attackState.cmd);
                // If we're in an auto-complete loop, we want the PSObjects, not the string from the output of the command
                // TODO: clean this up
                if (attackState.loopType != null)
                {
                    pipeline.Commands[0].MergeMyResults(PipelineResultTypes.Error, PipelineResultTypes.Output);
                }
                else
                {
                    pipeline.Commands[0].MergeMyResults(PipelineResultTypes.Error, PipelineResultTypes.Output); pipeline.Commands.Add("out-default");
                }
                try
                {
                    attackState.results = pipeline.Invoke();
                }
                catch (Exception e)
                {
                    attackState.results = null;
                    Display.Exception(attackState, e.Message);
                }

                pipeline.Dispose();
            }
            //Clear out command so it doesn't get echo'd out to console again.
            attackState.ClearIO();
            if (attackState.loopType == null)
            {
                attackState.cmdComplete = true;
            }
            return(attackState);
        }
All Usage Examples Of PSAttack.PSAttackProcessing.AttackState::ClearIO