解决方案 »
- 想再PageControl上边的标签页右边加一个按钮,不知道怎么实现
- 老人家向大家问好,好久没来了,祝愿大家事事如意,一帆风顺。
- dephi连接access,修改功能代码?
- 邮件问题,请大侠支招
- 85分跪求DEPHI(前台)+SQLSERVER(后台)的财务管理系统(源代码)或相关资料
- 有一个问题(关于将子窗体嵌入父窗体的容器里)
- 如何在局域网里的一台普通电脑上运行iw的standalone(即exe文件)?
- 请问,去除字符串前后空格的函数是哪个?
- 静态引用DLL出错,百思不得其解!!郁闷中!!
- 一个remote data module的问题?请指教!!!
- 求购sscom调试程序的 代码 本人就70分了
- 关于Socket,请各位帮帮忙
socket相关代码网上多的很,就不多说了。
http://www.2ccc.com/article.asp?articleid=1871
然后利用木马技术在客户端利用以下程序关机等操作uses
Windows;function GetSysTypes: Boolean; // & 获取操作系统类型 &
function SetPrivilege(sPrivilegeName: AnsiString; bEnable: Boolean): Boolean; // & 设置权限 &
procedure ExitWin32Sys(iFlags: Integer); // & 执行注销、退出或重启系统的操作 &implementationfunction GetSysTypes: Boolean;
var
Ver: TOSVersionInfo;
begin
Result := False;
Ver.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
if GetVersionEx(Ver) then
if Ver.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS then
Result := True
else
Result := False;
end;function SetPrivilege(sPrivilegeName: AnsiString; bEnable: Boolean): Boolean;
var
TPPrev, TP: TTokenPrivileges;
Token : THandle;
dwRetLen : DWord;
begin
Result := False;
OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES or
TOKEN_QUERY, Token);
TP.PrivilegeCount := 1;
if LookupPrivilegeValue(nil,PAnsiChar(sPrivilegeName),TP.Privileges[0].LUID) then
begin
if bEnable then
TP.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED
else
TP.Privileges[0].Attributes := 0;
dwRetLen := 0;
Result := AdjustTokenPrivileges(Token, False, TP, SizeOf(TPPrev), TPPrev, dwRetLen);
end;
CloseHandle(Token);
end;procedure ExitWin32Sys(iFlags: Integer);
begin
if GetSysTypes then
ExitWindowsEx(iFlags,0)
else
if SetPrivilege('SeShutdownPrivilege',True) then
if not ExitWindowsEx(iFlags,0) then
SetPrivilege('SeShutdownPrivilege',False);
end;
2k和2003都没问题,也就是说只需要使用XP/2003自带的Shutdown.exe就可以控制(win2k亦可以使用),但XP默认配置就是不行。
Windows,
StdCtrls; procedure shut(system, nachricht: string; force, reboot: boolean; countdown: integer);
procedure abortshut(system: string);implementation const
SE_SHUTDOWN_NAME = 'SeShutdownPrivilege';
var
hdlg: DWORD = 0;procedure shut(system, nachricht: string; force, reboot: boolean; countdown: integer);
var
otoken, hToken: THandle;
tp: TTokenPrivileges;
h: Dword;
begin
OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES, hToken);
otoken := htoken;
LookupPrivilegeValue(nil, SE_SHUTDOWN_NAME, tp.Privileges[0].luid);
tp.privilegecount := 1;
tp.privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
h := 0;
AdjustTokenPrivileges(hToken, False, tp, 0, PTokenPrivileges(nil)^, h);
InitiateSystemShutdown(PChar(system), pchar(nachricht), countdown, force, reboot);
tp.privilegecount := 1;
tp.privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
h := 0;
AdjustTokenPrivileges(oToken, False, tp, 0, PTokenPrivileges(nil)^, h);
CloseHandle(hToken);
end;procedure abortshut(system: string);
var
hToken: THandle;
tp: TTokenPrivileges;
h: Dword;
begin
OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES, hToken);
LookupPrivilegeValue(pchar(system), SE_SHUTDOWN_NAME, tp.Privileges[0].luid);
tp.privilegecount := 1;
tp.privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
h := 0;
AdjustTokenPrivileges(hToken, False, tp, 0, PTokenPrivileges(nil)^, h);
CloseHandle(hToken);
abortSystemShutdown(pchar(system));
end;end.
不过pcanywhere可以做到这种效果,我想是它在计算机重启之前做好了很多东西,然后在启动的时候把这些加载进去。
1、使用c/s结构,在远程安装一个服务器端程序,类似木马,随时监听特定端口的信息,接到指令后,执行……
2、在nt/2000操作系统下,利用NetRemoteTOD取得远程机器时间,再利用NetScheduleJobAdd函数添加命令(类似nt下的at命令,同时需要取得对方管理员口令,对方须启动Schedule服务),这两个函数在delphi中没有声明,需要自己声明(使用WNetAddConnection2 建立连接,delphi可直接使用);