示例#1
0
        ////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////
        private static Boolean CreateProcessWithTokenW(IntPtr phNewToken, String name, String arguments)
        {
            Console.WriteLine("[*] CreateProcessWithTokenW");
            IntPtr lpProcessName = Marshal.StringToHGlobalUni(name);
            IntPtr lpProcessArgs = Marshal.StringToHGlobalUni(name);

            Structs._STARTUPINFO startupInfo = new Structs._STARTUPINFO();
            startupInfo.cb = (UInt32)Marshal.SizeOf(typeof(Structs._STARTUPINFO));
            Structs._PROCESS_INFORMATION processInformation = new Structs._PROCESS_INFORMATION();
            if (!Unmanaged.CreateProcessWithTokenW(
                    phNewToken,
                    Enums.LOGON_FLAGS.NetCredentialsOnly,
                    lpProcessName,
                    lpProcessArgs,
                    Enums.CREATION_FLAGS.NONE,
                    IntPtr.Zero,
                    IntPtr.Zero,
                    ref startupInfo,
                    out processInformation
                    ))
            {
                GetError("CreateProcessWithTokenW: ");
                return(false);
            }
            Console.WriteLine(" [+] Created process: " + processInformation.dwProcessId);
            Console.WriteLine(" [+] Created thread: " + processInformation.dwThreadId);
            return(true);
        }
示例#2
0
 internal static extern bool CreateProcessWithLogonW(
     String userName,
     String domain,
     String password,
     int logonFlags,
     String applicationName,
     String commandLine,
     int creationFlags,
     IntPtr environment,
     String currentDirectory,
     ref Structs._STARTUPINFO startupInfo,
     out Structs._PROCESS_INFORMATION processInformation
     );
示例#3
0
 internal static extern Boolean CreateProcessAsUserW(IntPtr hToken, IntPtr lpApplicationName, IntPtr lpCommandLine, IntPtr lpProcessAttributes, IntPtr lpThreadAttributes, Boolean bInheritHandles, Enums.CREATION_FLAGS dwCreationFlags, IntPtr lpEnvironment, IntPtr lpCurrentDirectory, ref Structs._STARTUPINFO lpStartupInfo, out Structs._PROCESS_INFORMATION lpProcessInfo);
示例#4
0
 internal static extern Boolean CreateProcessWithTokenW(IntPtr hToken, Enums.LOGON_FLAGS dwLogonFlags, IntPtr lpApplicationName, IntPtr lpCommandLine, Enums.CREATION_FLAGS dwCreationFlags, IntPtr lpEnvironment, IntPtr lpCurrentDirectory, ref Structs._STARTUPINFO lpStartupInfo, out Structs._PROCESS_INFORMATION lpProcessInfo);