Advertisement
Golden_Rus

IMG002 miner patch

Oct 31st, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 3.57 KB | None | 0 0
  1. unit AntiI_MG;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7.   Dialogs, ExtCtrls, ShellApi, StdCtrls, Tlhelp32, Registry;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Timer1: TTimer;
  12.     procedure Timer1Timer(Sender: TObject);
  13.   private
  14.     { Private declarations }
  15.   public
  16.     { Public declarations }
  17.   end;
  18.  
  19. var
  20.   Form1: TForm1;
  21. implementation
  22.  
  23. {$R *.dfm}
  24.  
  25. procedure check(disk: string);
  26. var
  27.   EMode: UINT;
  28. begin
  29.   EMode:=SetErrorMode(SEM_FAILCRITICALERRORS);
  30.  try
  31.   if FileExists(disk+'IMG002.exe') then
  32.     DeleteFile(disk+'IMG002.exe');
  33.  finally
  34.   SetErrorMode(EMode);
  35.  end;
  36. end;
  37.  
  38. procedure serchUSB();
  39. var
  40. result, USB: String;
  41. Drive: Char;
  42. EMode: UINT;
  43. const
  44. pref = ':\';
  45. label AbortLabel;
  46. begin
  47. EMode:=SetErrorMode(SEM_FAILCRITICALERRORS);
  48. try
  49. for Drive := 'B' to 'Z' do
  50. if GetDriveType(PChar(Drive + pref)) = DRIVE_REMOVABLE then
  51. begin
  52. Goto AbortLabel;
  53. end
  54. else USB:='';
  55. AbortLabel: USB:=Drive + pref;
  56. check(USB);
  57. finally
  58.   SetErrorMode(EMode);
  59. end;
  60. end;
  61.  
  62.  
  63. procedure Autorun(Flag:boolean; NameParam, Path:String);
  64. var Reg:TRegistry;
  65. begin
  66. if Flag then
  67. begin
  68. Reg := TRegistry.Create;
  69. Reg.RootKey := HKEY_CURRENT_USER;
  70. Reg.OpenKey('\SOFTWARE\Microsoft\Windows\CurrentVersion\Run', false);
  71. Reg.WriteString(NameParam, Path);
  72. Reg.Free;
  73. end
  74. else
  75. begin
  76. Reg := TRegistry.Create;
  77. Reg.RootKey := HKEY_CURRENT_USER;
  78. Reg.OpenKey('\SOFTWARE\Microsoft\Windows\CurrentfVersion\Run',false);
  79. Reg.DeleteValue(NameParam);
  80. Reg.Free;
  81. end;
  82. end;
  83.  
  84.  
  85. function GetWin(Comand: string): string;
  86. var
  87.   buff: array [0 .. $FF] of char;
  88. begin
  89.   ExpandEnvironmentStrings(PChar(Comand), buff, SizeOf(buff));
  90.   Result := buff;
  91. end;
  92.  
  93. function KillTask(ExeFileName: string): Integer;
  94. const
  95.   PROCESS_TERMINATE = $0001;
  96. var
  97.   ContinueLoop: BOOL;
  98.   FSnapshotHandle: THandle;
  99.   FProcessEntry32: TProcessEntry32;
  100. begin
  101.   Result := 0;
  102.   FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  103.   FProcessEntry32.dwSize := SizeOf(FProcessEntry32);
  104.   ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
  105.  
  106.   while Integer(ContinueLoop) <> 0 do
  107.   begin
  108.     if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) =
  109.       UpperCase(ExeFileName)) or (UpperCase(FProcessEntry32.szExeFile) =
  110.       UpperCase(ExeFileName))) then
  111.       Result := Integer(TerminateProcess(
  112.                         OpenProcess(PROCESS_TERMINATE,
  113.                                     BOOL(0),
  114.                                     FProcessEntry32.th32ProcessID),
  115.                                     0));
  116.      ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
  117.   end;
  118.   CloseHandle(FSnapshotHandle);
  119. end;
  120.  
  121.  
  122. procedure TForm1.Timer1Timer(Sender: TObject);
  123. begin
  124.   serchUSB();
  125. end;
  126.  
  127. var
  128.   EMode: UINT;
  129. begin
  130.   Application.ShowMainform:=false;
  131.   EMode:=SetErrorMode(SEM_FAILCRITICALERRORS);
  132.   try
  133.     if FileExists(GetWin('%AppData%\NsCpuCNMiner\IMG002.exe')) then
  134.     begin
  135.       KillTask('IMG002.exe');
  136.       KillTask('NsCpuCNMiner64.exe');
  137.       KillTask('NsCpuCNMiner32.exe');
  138.       WinExec(Pchar('cmd /c rmdir "%AppData%\NsCpuCNMiner" /s /q'), 1);
  139.       WinExec(Pchar('cmd /c mkdir "%AppData%\NsCpuCNMiner"'), 1);
  140.       WinExec(Pchar('cmd /c icacls "%AppData%\NsCpuCNMiner" /deny %username%:F'), 1);
  141.       WinExec(Pchar('cmd /c del "%AppData%\Microsoft\Windows\Start Menu\Programs\Startup\Run.lnk"'), 1);
  142.     end;
  143.     if not FileExists (GetWin('%AppData%\NsCpuCNMiner')) then
  144.     begin
  145.       WinExec(Pchar('cmd /c mkdir "%AppData%\NsCpuCNMiner"'), 1);
  146.       WinExec(Pchar('cmd /c icacls "%AppData%\NsCpuCNMiner" /deny %username%:F'), 1);
  147.     end;
  148.     Autorun(true, 'PatchIMG.exe', paramstr(0));
  149.  finally
  150.   SetErrorMode(EMode);
  151. end;
  152.  
  153.  
  154. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement