Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
nwoolls committed Dec 24, 2017
2 parents a7b333f + dde3f06 commit 10065ba
Show file tree
Hide file tree
Showing 13 changed files with 528 additions and 521 deletions.
348 changes: 93 additions & 255 deletions MultiMiner.Engine/Helpers/DonationPools.cs

Large diffs are not rendered by default.

146 changes: 146 additions & 0 deletions MultiMiner.Engine/Helpers/Fingerprint.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
using System;
using System.Security.Cryptography;
using System.Text;

namespace MultiMiner.Engine.Helpers
{
public class Fingerprint
{
private static string fingerPrint = String.Empty;

public static string Value()
{
if (String.IsNullOrEmpty(fingerPrint))
{
fingerPrint = GetHash(
"CPU >> " + GetProcessorID() +
"\nBIOS >> " + GetBIOSID() +
"\nBASE >> " + GetBaseBoardID() +
"\nDISK >> " + GetDiskDriveID() +
"\nVIDEO >> " + GetVideoControllerID() +
"\nMAC >> " + GetMACAddressID()
);
}
return fingerPrint;
}

private static string GetHash(string s)
{
MD5 sec = new MD5CryptoServiceProvider();
ASCIIEncoding enc = new ASCIIEncoding();
byte[] bt = enc.GetBytes(s);
return GetHexString(sec.ComputeHash(bt));
}

private static string GetHexString(byte[] bt)
{
Guid guid = new Guid(bt);
return guid.ToString();
}

//Return a hardware identifier
private static string GetWMIIdentifier(string wmiClass, string wmiProperty, string wmiMustBeTrue)
{
System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass);
System.Management.ManagementObjectCollection moc = mc.GetInstances();
foreach (System.Management.ManagementObject mo in moc)
{
if (mo[wmiMustBeTrue].ToString() == "True")
{
object propVal = mo[wmiProperty];
if (propVal != null)
{
return propVal.ToString();
}
}
}
return "";
}

//Return a hardware identifier
private static string GetWMIIdentifier(string wmiClass, string wmiProperty)
{
System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass);
System.Management.ManagementObjectCollection moc = mc.GetInstances();
foreach (System.Management.ManagementObject mo in moc)
{
object propVal = mo[wmiProperty];
if (propVal != null)
{
return propVal.ToString();
}
}
return "";
}

private static string GetProcessorID()
{
//Uses first CPU identifier available in order of preference
//Don't get all identifiers, as it is very time consuming
string retVal = GetWMIIdentifier("Win32_Processor", "UniqueId");

if (retVal == "") //If no UniqueID, use ProcessorID
{
retVal = GetWMIIdentifier("Win32_Processor", "ProcessorId");
}

if (retVal == "") //If no ProcessorId, use Name
{
retVal = GetWMIIdentifier("Win32_Processor", "Name");
}

if (retVal == "") //If no Name, use Manufacturer
{
retVal = GetWMIIdentifier("Win32_Processor", "Manufacturer");
}

//Add clock speed for extra security
retVal += GetWMIIdentifier("Win32_Processor", "MaxClockSpeed");

return retVal;
}

//BIOS Identifier
private static string GetBIOSID()
{
return GetWMIIdentifier("Win32_BIOS", "Manufacturer")
+ GetWMIIdentifier("Win32_BIOS", "SMBIOSBIOSVersion")
+ GetWMIIdentifier("Win32_BIOS", "IdentificationCode")
+ GetWMIIdentifier("Win32_BIOS", "SerialNumber")
+ GetWMIIdentifier("Win32_BIOS", "ReleaseDate")
+ GetWMIIdentifier("Win32_BIOS", "Version");
}

//Main physical hard drive ID
private static string GetDiskDriveID()
{
return GetWMIIdentifier("Win32_DiskDrive", "Model")
+ GetWMIIdentifier("Win32_DiskDrive", "Manufacturer")
+ GetWMIIdentifier("Win32_DiskDrive", "Signature")
+ GetWMIIdentifier("Win32_DiskDrive", "TotalHeads");
}

//Motherboard ID
private static string GetBaseBoardID()
{
return GetWMIIdentifier("Win32_BaseBoard", "Model")
+ GetWMIIdentifier("Win32_BaseBoard", "Manufacturer")
+ GetWMIIdentifier("Win32_BaseBoard", "Name")
+ GetWMIIdentifier("Win32_BaseBoard", "SerialNumber");
}

//Primary video controller ID
private static string GetVideoControllerID()
{
return GetWMIIdentifier("Win32_VideoController", "DriverVersion")
+ GetWMIIdentifier("Win32_VideoController", "Name");
}

//First enabled network card ID
private static string GetMACAddressID()
{
return GetWMIIdentifier("Win32_NetworkAdapterConfiguration",
"MACAddress", "IPEnabled");
}
}
}
2 changes: 2 additions & 0 deletions MultiMiner.Engine/MultiMiner.Engine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Management" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
Expand All @@ -60,6 +61,7 @@
<Compile Include="Data\MinerNames.cs" />
<Compile Include="Extensions\StringExtensions.cs" />
<Compile Include="Helpers\DonationPools.cs" />
<Compile Include="Helpers\Fingerprint.cs" />
<Compile Include="Installers\MultiMinerInstaller.cs" />
<Compile Include="Data\AvailableMiner.cs" />
<Compile Include="Installers\AvailableMiners.cs" />
Expand Down
61 changes: 61 additions & 0 deletions MultiMiner.PoolChecker/MultiMiner.PoolChecker.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4409DA1A-D1C3-4AE9-9AAC-D87C2F84AAA8}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>MultiMiner.PoolChecker</RootNamespace>
<AssemblyName>MultiMiner.PoolChecker</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MultiMiner.Engine\MultiMiner.Engine.csproj">
<Project>{845687bb-ec47-46d3-ac9d-6fcfb63de8f5}</Project>
<Name>MultiMiner.Engine</Name>
</ProjectReference>
<ProjectReference Include="..\MultiMiner.Xgminer\MultiMiner.Xgminer.csproj">
<Project>{0DBEF993-1B34-4D80-AB6A-F662604325DC}</Project>
<Name>MultiMiner.Xgminer</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
58 changes: 58 additions & 0 deletions MultiMiner.PoolChecker/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using MultiMiner.Xgminer.Data;
using MultiMiner.Engine.Helpers;
using MultiMiner.Engine.Data.Configuration;
using System.Collections.Generic;
using System;
using System.Net.Sockets;

namespace MultiMiner.PoolChecker
{
class Program
{
static void Main(string[] args)
{
TimeSpan timeout = new TimeSpan(0, 0, 5);
List<Coin> configurations = new List<Coin>(); ;
DonationPools.Seed(configurations);
foreach (Coin coin in configurations)
{
foreach (MiningPool pool in coin.Pools)
{
Uri uri = new Uri(pool.Host);

if (!IsPortOpen(uri.Host, pool.Port, timeout))
{
Console.WriteLine(String.Format("{0} pool {1} (port {2}) is defunct.", coin.PoolGroup.Id, pool.Host, pool.Port));
}

}
}
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}

private static bool IsPortOpen(string host, int port, TimeSpan timeout)
{
try
{
using (var client = new TcpClient())
{
var result = client.BeginConnect(host, port, null, null);
var success = result.AsyncWaitHandle.WaitOne(timeout);
if (!success)
{
return false;
}

client.EndConnect(result);
}

}
catch
{
return false;
}
return true;
}
}
}
36 changes: 36 additions & 0 deletions MultiMiner.PoolChecker/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MultiMiner.PoolChecker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MultiMiner.PoolChecker")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4409da1a-d1c3-4ae9-9aac-d87c2f84aaa8")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
3 changes: 3 additions & 0 deletions MultiMiner.PoolChecker/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/></startup></configuration>
57 changes: 53 additions & 4 deletions MultiMiner.UX/Data/Configuration/Perks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,59 @@ namespace MultiMiner.UX.Data.Configuration
[XmlType(TypeName = "PerksConfiguration")]
public class Perks
{
public bool PerksEnabled { get; set; }
public bool ShowExchangeRates { get; set; }
public bool ShowIncomeRates { get; set; }
public bool ShowIncomeInUsd { get; set; }
private bool perksEnabled = true;
public bool PerksEnabled
{
get
{
return perksEnabled;
}
set
{
perksEnabled = value;
}
}

private bool showExchangeRates = true;
public bool ShowExchangeRates
{
get
{
return showExchangeRates;
}
set
{
showExchangeRates = value;
}
}

private bool showIncomeRates = true;
public bool ShowIncomeRates
{
get
{
return showIncomeRates;
}
set
{
showIncomeRates = value;
}
}

private bool showIncomeInUsd = true;
public bool ShowIncomeInUsd
{
get
{
return showIncomeInUsd;
}
set
{
showIncomeInUsd = value;
}
}


public bool EnableRemoting { get; set; }
public string RemotingPassword { get; set; }
public bool AdvancedProxying { get; set; }
Expand Down
Loading

0 comments on commit 10065ba

Please sign in to comment.