用其他身份执行程序
来源:互联网 发布:美的网络专供 编辑:程序博客网 时间:2024/04/27 15:51
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
const
LOGON_WITH_PROFILE = 1;
LOGON_NETCREDENTIALS_ONLY = 2;
function CreateProcessWithLogon(
lpUsername: PWChar;
lpDomain: PWChar;
lpPassword: PWChar;
dwLogonFlags: DWORD;
lpApplicationName: PWChar;
lpCommandLine: PWChar;
dwCreationFlags: DWORD;
lpEnvironment: Pointer;
lpCurrentDirectory: PWChar;
const lpStartupInfo: TStartupInfo;
var lpProcessInfo: TProcessInformation
): BOOL; stdcall;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function CreateProcessWithLogon; external advapi32 name 'CreateProcessWithLogonW';
procedure TForm1.Button1Click(Sender: TObject);
var
wUsername, wDomain, wPassword, wApplicationName: WideString;
pwUsername, pwDomain, pwPassword, pwApplicationName: PWideChar;
StartupInfo: TStartupInfo;
ProcessInfo: TProcessInformation;
begin
wUsername := 'administrator';
wDomain := '';
wPassword := '123456';
wApplicationName := 'cmd.exe';
pwUsername := Addr(wUsername[1]);
pwDomain := Addr(wDomain[1]);
pwPassword := Addr(wPassword[1]);
pwApplicationName := Addr(wApplicationName[1]);
FillChar(StartupInfo, SizeOf(TStartupInfo), 0);
StartupInfo.cb := SizeOf(TStartupInfo);
if not CreateProcessWithLogon(pwUsername,pwDomain,pwPassword,LOGON_WITH_PROFILE,
pwApplicationName,nil,CREATE_DEFAULT_ERROR_MODE,
nil,nil,StartupInfo,ProcessInfo) then
RaiseLastOSError;
end;
end.
可带入其它使用者的Profile,使用上比LogonUser、CreateProcessAsUser简单,省去设定SE_TCB_NAME privilege
此函数可用于暴力破解本地账号密码
CreateProcessWithLogonW函数
CreateProcessWithLogonW API的定义如下:
BOOL CreateProcessWithLogonW(
LPCWSTR , // 用户乙的账号(Account)
LPCWSTR , //用户乙的域(Domain)
LPCWSTR , // 用户乙的密码(Password)
DWORD , // logon option
LPCWSTR , // executable module name
LPWSTR , // command-line string
DWORD , // creation flags
LPVOID , // new environment block
LPCWSTR , // current directory name
LPSTARTUPINFOW , // startup information
LPPROCESS_INFORMATION // process information
);
- 用其他身份执行程序
- 用其他身份执行程序
- java执行其他程序
- sudo命令用其他身份来执行命令,限制root远程登录详解
- C#对执行的程序设定执行身份权限
- 以指定系统用户身份执行指定程序
- 用其他用户的身份执行命令:sudo
- shell中等待其他程序执行完毕
- BCB 用管理员身份运行程序
- 把参数传递给其他的 Exe 程序并执行
- VC2005在Unicode环境下执行其他程序
- jsp Session创建销毁后执行其他程序。
- delphi编程中调用其他执行程序?(转)
- java中执行其他程序并处理线程阻塞
- VB 执行其他程序并等待其结束
- 进程控制:创建执行其他程序的进程
- crontab中执行其他账号运行的程序 免密码
- crontab中执行其他账号运行的程序 免密码
- Apache2+PHP5开发环境配置
- Windows Vista Brute Force Product Key Keygen for Activation
- 心情不爽
- 我在服务程序里用CreateProcessWithLogon
- 今年过年 我很冷
- 用其他身份执行程序
- 关于“C++中产生随机数”(引用 http://hi.baidu.com/vincey/blog/item/5c145d08dd1e6d950a7b824b.html)
- 使用Flash的XMLSocket与Servlet建立长连接(1,建立socket控件)
- 如何处理Java里的DOM异常
- Eclipse plugin.xml中的%(百分号)
- 哇,体重超了9公斤!
- 使用Flash的XMLSocket与Servlet建立长连接(2,建立JavaScript类)
- Control Spy 2.0
- 使用Flash的XMLSocket与Servlet建立长连接(3,建立XMLSocketWriter类)