mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2024-12-22 19:36:11 +00:00
382 lines
15 KiB
C#
382 lines
15 KiB
C#
|
// Decompiled with JetBrains decompiler
|
|||
|
// Type: AutoKMS.AutoKMS
|
|||
|
// Assembly: AutoKMS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
|||
|
// MVID: D1CED9E3-1FC7-49B8-B3AC-44976AB7F6E4
|
|||
|
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\HackTool.Win32.KMSAuto.i-f317ba4d4051fad64a0aa45b587fa3dcea795bac30acec2872779abe31a07cbe.exe
|
|||
|
|
|||
|
using Office_2010_Toolkit;
|
|||
|
using Office_2010_Toolkit.Configuration;
|
|||
|
using Office_2010_Toolkit.Logic;
|
|||
|
using System;
|
|||
|
using System.IO;
|
|||
|
using System.Management;
|
|||
|
using System.ServiceProcess;
|
|||
|
|
|||
|
namespace AutoKMS
|
|||
|
{
|
|||
|
internal class AutoKMS
|
|||
|
{
|
|||
|
private StreamWriter log;
|
|||
|
private string logWrite;
|
|||
|
public static bool AutoKMSServiceEnabled;
|
|||
|
|
|||
|
public void RunAutoKMS()
|
|||
|
{
|
|||
|
AutoKMS.AutoKMS.AutoKMSServiceEnabled = Common.IsAutoKMSServiceInstalled();
|
|||
|
if (AutoKMS.AutoKMS.AutoKMSServiceEnabled)
|
|||
|
{
|
|||
|
ServiceController serviceController = new ServiceController();
|
|||
|
serviceController.ServiceName = nameof (AutoKMS);
|
|||
|
if (serviceController.Status.ToString().ToLower() == "stopped")
|
|||
|
serviceController.Start();
|
|||
|
}
|
|||
|
this.log = !Settings.AutoKMSSettings.Logging ? new StreamWriter(Directory.GetCurrentDirectory() + "\\AutoKMS.tmp", true) : new StreamWriter(Directory.GetCurrentDirectory() + "\\AutoKMS.log", true);
|
|||
|
this.logWrite = "------------------------------------";
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
this.logWrite = "AutoKMS Ran At " + (object) DateTime.Now + ".";
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
if (Settings.AutoKMSSettings.UseKMSEmulator)
|
|||
|
{
|
|||
|
if (!AutoKMS.AutoKMS.AutoKMSServiceEnabled)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
Activation.StartKMSEmulator();
|
|||
|
this.logWrite = "Started KMSEmulator.exe";
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
if (Settings.AutoKMSSettings.KMSPID != string.Empty)
|
|||
|
{
|
|||
|
if (Common.isValidPID(Settings.AutoKMSSettings.KMSPID))
|
|||
|
{
|
|||
|
KMSEditor.WritePIDToMemory(Settings.AutoKMSSettings.KMSPID);
|
|||
|
this.logWrite = "Changed KMS PID To: " + Settings.AutoKMSSettings.KMSPID;
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Settings.AutoKMSSettings.KMSPID = string.Empty;
|
|||
|
Settings.MakeNewAutoKMSINIFile();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
this.logWrite = "Failed To Copy Or Start KMSEmulator.exe";
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
this.log.Close();
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
this.logWrite = "Attempting To Activate Office 2010." + Environment.NewLine;
|
|||
|
this.log.Write(this.logWrite);
|
|||
|
if (!Common.OfficeInstalled)
|
|||
|
{
|
|||
|
this.logWrite = "Office 2010 Is Not Installed!" + Environment.NewLine;
|
|||
|
this.log.Write(this.logWrite);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this.logWrite = "Checking Installed Office KMS Products.";
|
|||
|
Common.GetLicConfigStatus();
|
|||
|
if (Common.AccessVLLicenseInstalled)
|
|||
|
this.logWrite = this.logWrite + Environment.NewLine + "Access KMS Installed.";
|
|||
|
if (Common.ExcelVLLicenseInstalled)
|
|||
|
this.logWrite = this.logWrite + Environment.NewLine + "Excel KMS Installed.";
|
|||
|
if (Common.GrooveVLLicenseInstalled)
|
|||
|
this.logWrite = this.logWrite + Environment.NewLine + "SharePoint Workspace KMS Installed.";
|
|||
|
if (Common.InfoPathVLLicenseInstalled)
|
|||
|
this.logWrite = this.logWrite + Environment.NewLine + "InfoPath KMS Installed.";
|
|||
|
if (Common.OneNoteVLLicenseInstalled)
|
|||
|
this.logWrite = this.logWrite + Environment.NewLine + "OneNote KMS Installed.";
|
|||
|
if (Common.OutlookVLLicenseInstalled)
|
|||
|
this.logWrite = this.logWrite + Environment.NewLine + "Outlook KMS Installed.";
|
|||
|
if (Common.PowerPointVLLicenseInstalled)
|
|||
|
this.logWrite = this.logWrite + Environment.NewLine + "PowerPoint KMS Installed.";
|
|||
|
if (Common.ProjectProVLLicenseInstalled)
|
|||
|
this.logWrite = this.logWrite + Environment.NewLine + "Project Professional KMS Installed.";
|
|||
|
if (Common.ProjectStdVLLicenseInstalled)
|
|||
|
this.logWrite = this.logWrite + Environment.NewLine + "Project Standard KMS Installed.";
|
|||
|
if (Common.ProPlusVLLicenseInstalled)
|
|||
|
this.logWrite = this.logWrite + Environment.NewLine + "Professional Plus KMS Installed.";
|
|||
|
if (Common.PublisherVLLicenseInstalled)
|
|||
|
this.logWrite = this.logWrite + Environment.NewLine + "Publisher KMS Installed.";
|
|||
|
if (Common.SmallBusBasicsVLLicenseInstalled)
|
|||
|
this.logWrite = this.logWrite + Environment.NewLine + "Small Business Basics KMS Installed.";
|
|||
|
if (Common.StandardVLLicenseInstalled)
|
|||
|
this.logWrite = this.logWrite + Environment.NewLine + "Standard KMS Installed.";
|
|||
|
if (Common.VisioPremVLLicenseInstalled)
|
|||
|
this.logWrite = this.logWrite + Environment.NewLine + "Visio Premium KMS Installed.";
|
|||
|
if (Common.VisioProVLLicenseInstalled)
|
|||
|
this.logWrite = this.logWrite + Environment.NewLine + "Visio Professional KMS Installed.";
|
|||
|
if (Common.VisioStdVLLicenseInstalled)
|
|||
|
this.logWrite = this.logWrite + Environment.NewLine + "Visio Standard KMS Installed.";
|
|||
|
if (Common.WordVLLicenseInstalled)
|
|||
|
this.logWrite = this.logWrite + Environment.NewLine + "Word KMS Installed.";
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
if (!AutoKMS.AutoKMS.AutoKMSServiceEnabled)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
Activation.SetKMSHost();
|
|||
|
this.logWrite = "Successfully Set Office KMS Host To " + Settings.AutoKMSSettings.KMSServer;
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
this.logWrite = "Failed To Set Office KMS Host To " + Settings.AutoKMSSettings.KMSServer;
|
|||
|
}
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
if (Common.AccessVLLicenseInstalled)
|
|||
|
{
|
|||
|
this.logWrite = "Attempting To Activate Access.";
|
|||
|
this.ActivateKMS("8ce7e872-188c-4b98-9d90-f8f90b7aad02");
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
if (Common.ExcelVLLicenseInstalled)
|
|||
|
{
|
|||
|
this.logWrite = "Attempting To Activate Excel.";
|
|||
|
this.ActivateKMS("cee5d470-6e3b-4fcc-8c2b-d17428568a9f");
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
if (Common.GrooveVLLicenseInstalled)
|
|||
|
{
|
|||
|
this.logWrite = "Attempting To Activate SharePoint Workspace.";
|
|||
|
this.ActivateKMS("8947d0b8-c33b-43e1-8c56-9b674c052832");
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
if (Common.InfoPathVLLicenseInstalled)
|
|||
|
{
|
|||
|
this.logWrite = "Attempting To Activate InfoPath.";
|
|||
|
this.ActivateKMS("ca6b6639-4ad6-40ae-a575-14dee07f6430");
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
if (Common.OneNoteVLLicenseInstalled)
|
|||
|
{
|
|||
|
this.logWrite = "Attempting To Activate OneNote.";
|
|||
|
this.ActivateKMS("ab586f5c-5256-4632-962f-fefd8b49e6f4");
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
if (Common.OutlookVLLicenseInstalled)
|
|||
|
{
|
|||
|
this.logWrite = "Attempting To Activate Outlook.";
|
|||
|
this.ActivateKMS("ecb7c192-73ab-4ded-acf4-2399b095d0cc");
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
if (Common.PowerPointVLLicenseInstalled)
|
|||
|
{
|
|||
|
this.logWrite = "Attempting To Activate PowerPoint.";
|
|||
|
this.ActivateKMS("45593b1d-dfb1-4e91-bbfb-2d5d0ce2227a");
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
if (Common.ProjectProVLLicenseInstalled)
|
|||
|
{
|
|||
|
this.logWrite = "Attempting To Activate Project Professional.";
|
|||
|
this.ActivateKMS("df133ff7-bf14-4f95-afe3-7b48e7e331ef");
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
if (Common.ProjectStdVLLicenseInstalled)
|
|||
|
{
|
|||
|
this.logWrite = "Attempting To Activate Project Standard.";
|
|||
|
this.ActivateKMS("5dc7bf61-5ec9-4996-9ccb-df806a2d0efe");
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
if (Common.ProPlusVLLicenseInstalled)
|
|||
|
{
|
|||
|
this.logWrite = "Attempting To Activate Professional Plus.";
|
|||
|
this.ActivateKMS("6f327760-8c5c-417c-9b61-836a98287e0c");
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
if (Common.PublisherVLLicenseInstalled)
|
|||
|
{
|
|||
|
this.logWrite = "Attempting To Activate Publisher.";
|
|||
|
this.ActivateKMS("b50c4f75-599b-43e8-8dcd-1081a7967241");
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
if (Common.SmallBusBasicsVLLicenseInstalled)
|
|||
|
{
|
|||
|
this.logWrite = "Attempting To Activate Small Business Basics.";
|
|||
|
this.ActivateKMS("ea509e87-07a1-4a45-9edc-eba5a39f36af");
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
if (Common.StandardVLLicenseInstalled)
|
|||
|
{
|
|||
|
this.logWrite = "Attempting To Activate Standard.";
|
|||
|
this.ActivateKMS("9da2a678-fb6b-4e67-ab84-60dd6a9c819a");
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
if (Common.VisioPremVLLicenseInstalled)
|
|||
|
{
|
|||
|
this.logWrite = "Attempting To Activate Visio Premium.";
|
|||
|
this.ActivateKMS("92236105-bb67-494f-94c7-7f7a607929bd");
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
if (Common.VisioProVLLicenseInstalled)
|
|||
|
{
|
|||
|
this.logWrite = "Attempting To Activate Visio Professional.";
|
|||
|
this.ActivateKMS("e558389c-83c3-4b29-adfe-5e4d7f46c358");
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
if (Common.VisioStdVLLicenseInstalled)
|
|||
|
{
|
|||
|
this.logWrite = "Attempting To Activate Visio Standard.";
|
|||
|
this.ActivateKMS("9ed833ff-4f92-4f36-b370-8683a4f13275");
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
if (Common.WordVLLicenseInstalled)
|
|||
|
{
|
|||
|
this.logWrite = "Attempting To Activate Word.";
|
|||
|
this.ActivateKMS("2d0882e7-a4e7-423b-8ccc-70d91e0158b1");
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
if (Settings.AutoKMSSettings.AutoRemoveKMSHost)
|
|||
|
{
|
|||
|
if (!AutoKMS.AutoKMS.AutoKMSServiceEnabled)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
Activation.RemoveKMSHost();
|
|||
|
this.logWrite = "Removed Office KMS Host Registry Entry.";
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
this.logWrite = "Failed To Remove Office KMS Host Registry Entry.";
|
|||
|
}
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
if (Settings.AutoKMSSettings.ActivateWindows)
|
|||
|
{
|
|||
|
this.logWrite = "Attempting To Activate Windows.";
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
this.ActivateKMSWindows();
|
|||
|
}
|
|||
|
if (Settings.AutoKMSSettings.UseKMSEmulator)
|
|||
|
{
|
|||
|
if (!AutoKMS.AutoKMS.AutoKMSServiceEnabled)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
Activation.StopKMSEmulator();
|
|||
|
this.logWrite = "Stopped KMSEmulator.";
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
this.logWrite = "Failed To Stop KMSEmulator.";
|
|||
|
}
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
}
|
|||
|
this.log.Close();
|
|||
|
if (!Settings.AutoKMSSettings.Logging)
|
|||
|
Common.FileDelete(Directory.GetCurrentDirectory() + "\\AutoKMS.tmp");
|
|||
|
if (Common.IsAutoKMSCustomTaskInstalled())
|
|||
|
return;
|
|||
|
Activation.DeleteAutoKMSNormalTask();
|
|||
|
Activation.MakeAutoKMSNormalTask(Directory.GetCurrentDirectory());
|
|||
|
}
|
|||
|
|
|||
|
public bool ActivateKMS(string SKUID)
|
|||
|
{
|
|||
|
int num = 1;
|
|||
|
bool flag = false;
|
|||
|
ManagementObject managementObject = new ManagementObject("root\\CIMV2", "OfficeSoftwareProtectionProduct.ID='" + SKUID + "'", (ObjectGetOptions) null);
|
|||
|
while (num < Settings.AutoKMSSettings.ActAttempts + 1)
|
|||
|
{
|
|||
|
if (!flag)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
managementObject.InvokeMethod("Activate", (ManagementBaseObject) null, (InvokeMethodOptions) null);
|
|||
|
flag = true;
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
++num;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
break;
|
|||
|
}
|
|||
|
if (!flag)
|
|||
|
{
|
|||
|
this.logWrite = this.logWrite + Environment.NewLine + "Failed To Activate " + (object) Settings.AutoKMSSettings.ActAttempts + " Times.";
|
|||
|
return false;
|
|||
|
}
|
|||
|
this.logWrite = this.logWrite + Environment.NewLine + "Successfully activated after " + (object) num + " attempts.";
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
public void ActivateKMSWindows()
|
|||
|
{
|
|||
|
if (!AutoKMS.AutoKMS.AutoKMSServiceEnabled)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
Activation.SetKMSHostWindows();
|
|||
|
this.logWrite = "Set Windows KMS Host";
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
this.logWrite = "Failed To Set Windows KMS Host! Maybe this version of Windows isn't supported?";
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
}
|
|||
|
string empty = string.Empty;
|
|||
|
try
|
|||
|
{
|
|||
|
foreach (ManagementObject managementObject in new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM SoftwareLicensingProduct").Get())
|
|||
|
{
|
|||
|
empty = Convert.ToString(managementObject["ID"]);
|
|||
|
if (Convert.ToInt32(managementObject["LicenseStatus"]) != 0)
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
this.logWrite = "Failed To Query Windows License Status! Maybe this version of Windows isn't supported?";
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
int num = 1;
|
|||
|
bool flag = false;
|
|||
|
ManagementObject managementObject1 = new ManagementObject("root\\CIMV2", "SoftwareLicensingProduct.ID='" + empty + "'", (ObjectGetOptions) null);
|
|||
|
while (num < Settings.AutoKMSSettings.ActAttempts + 1)
|
|||
|
{
|
|||
|
if (!flag)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
managementObject1.InvokeMethod("Activate", (ManagementBaseObject) null, (InvokeMethodOptions) null);
|
|||
|
flag = true;
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
++num;
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
break;
|
|||
|
}
|
|||
|
this.logWrite = flag ? "Successfully activated after " + (object) num + " attempts." : "Failed To Activate " + (object) Settings.AutoKMSSettings.ActAttempts + " Times.";
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
if (!Settings.AutoKMSSettings.AutoRemoveKMSHost)
|
|||
|
return;
|
|||
|
if (AutoKMS.AutoKMS.AutoKMSServiceEnabled)
|
|||
|
return;
|
|||
|
try
|
|||
|
{
|
|||
|
Activation.RemoveKMSHostWindows();
|
|||
|
this.logWrite = "Removed Windows KMS Host";
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
this.logWrite = "Failed To Remove Windows KMS Host! Maybe this version of Windows isn't supported?";
|
|||
|
this.log.WriteLine(this.logWrite);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|