Advertisement
Guest User

Untitled

a guest
Apr 15th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.81 KB | None | 0 0
  1. using Renci.SshNet;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using MasternodeInstaller;
  8. namespace MasternodeInstaller
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             startapp:
  15.             Console.WriteLine("################################################################################");
  16.             Console.WriteLine("# MP Hosting UK - Hosting Management Tool Version 0.1.080 RC");
  17.             Console.WriteLine("");
  18.             Console.WriteLine("# This application will only work with MP Hosting servers");
  19.             Console.WriteLine("");
  20.             Console.WriteLine("# What would you like to do today??");
  21.             Console.WriteLine("# 1 :-: Install Masternode");
  22.             Console.WriteLine("# 2 :-: Install Coin (Basic Config)");
  23.             Console.WriteLine("# 3 :-: Install Coin (Advanced Config)");
  24.             Console.WriteLine("");
  25.             var option = Console.ReadKey();
  26.             if (option.Key == ConsoleKey.D1)
  27.             {
  28.                 InstallMasterNodeMenu();
  29.             }
  30.             else if (option.Key == ConsoleKey.D2)
  31.             {
  32.  
  33.             }
  34.             else if (option.Key == ConsoleKey.D3)
  35.             {
  36.  
  37.             }
  38.             else
  39.             {
  40.                 goto startapp;
  41.             }
  42.         }
  43.  
  44.         static void InstallMasterNodeMenu()
  45.         {
  46.             installermenu:
  47.             Console.Clear();
  48.             Console.WriteLine("What masternode would you like to install today");
  49.             Console.WriteLine("");
  50.             Console.WriteLine("# 1 :-: DASH");
  51.             Console.WriteLine("# 2 :-: PivX");
  52.             var option = Console.ReadKey();
  53.             if (option.Key == ConsoleKey.D1)
  54.             {
  55.                 DashInstaller();
  56.             }
  57.             else if (option.Key == ConsoleKey.D2)
  58.             {
  59.                 PivxInstaller();
  60.             }
  61.         }
  62.  
  63.         //
  64.         // mnInstallers
  65.         //
  66.         static void DashInstaller()
  67.         {
  68.             Console.Clear();
  69.             Console.WriteLine("###############################################################################");
  70.             Console.WriteLine("# ");
  71.             Console.WriteLine("# In order to install DASH we need to collect a few details from you, the ");
  72.             Console.WriteLine("# information can be found in your client portal for the target server");
  73.             Console.WriteLine("");
  74.             Console.WriteLine("## Please enter the server ip address");
  75.             string serverIp = Console.ReadLine();
  76.             Console.WriteLine("## Please enter the server username");
  77.             string serverUser = Console.ReadLine();
  78.             Console.WriteLine("## Please enter your server password");
  79.             string serverPassword = Console.ReadLine();
  80.             Console.WriteLine("## Please enter your masternode key");
  81.             string masterNodeKey = Console.ReadLine();
  82.             Console.WriteLine("");
  83.             Console.WriteLine("# You are about to install DASH to server " + serverIp + " as user " + serverUser);
  84.             Console.WriteLine("# Execute Y/N");
  85.             var option = Console.ReadKey();
  86.             if (option.Key == ConsoleKey.Y)
  87.             {
  88.                 using (var ssh = new SshClient(serverIp, serverUser, serverPassword))
  89.                 {
  90.                     ssh.Connect();
  91.                     if (ssh.IsConnected)
  92.                     {
  93.                         Console.WriteLine("# Connected to server, downloading file");
  94.                         ssh.RunCommand("wget http://195.74.52.190:82/dash.zip");
  95.                         ssh.RunCommand("wget http://195.74.52.190:82/dash-chain.zip");
  96.                         Console.WriteLine("# Download Complete. Extracting Files");
  97.                         ssh.RunCommand("unzip dash.zip && unzip dash-chain.zip .dash");
  98.                         ssh.RunCommand("screen -dmS dash ~/dashd");
  99.                         Console.WriteLine("# Dash is now installed and running. Stopping");
  100.                         ssh.RunCommand("killall screen");
  101.                         ssh.RunCommand("echo " + masterNodeKey + " >> .dash/masternode.conf");
  102.                         ssh.RunCommand("./dashd");
  103.                         Console.WriteLine("Install Complete. Disconnecting WAIT....");
  104.                         ssh.Disconnect();
  105.                         Console.WriteLine("# All Done, this app will now teminate");
  106.                     }
  107.                     else
  108.                     {
  109.                         Console.WriteLine("Error");
  110.                     }
  111.                 }
  112.             }
  113.             else
  114.             {
  115.  
  116.             }
  117.            
  118.         }
  119.         static void PivxInstaller()
  120.         {
  121.  
  122.         }
  123.     }
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement