MalwareSourceCode/MSIL/Trojan/Win32/P/Trojan.Win32.Patched.mf-fd200e64412b6be5c177c3cfa7b94e83e807ff04211ce324f12e2ffa5537eb36/Broker/Config/ConfigurationManager.cs
2022-08-18 06:28:56 -05:00

143 lines
3.7 KiB
C#

// Decompiled with JetBrains decompiler
// Type: Bmc.Broker.Config.ConfigurationManager
// Assembly: ticketservice, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 3DFB8186-7053-43AF-8B45-70866071B1F2
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Trojan.Win32.Patched.mf-fd200e64412b6be5c177c3cfa7b94e83e807ff04211ce324f12e2ffa5537eb36.exe
using Bmc.RegistryAccess;
using Microsoft.Win32;
using Net.LShift.Utilities;
using System;
using System.IO;
using System.Xml;
namespace Bmc.Broker.Config
{
public class ConfigurationManager
{
public static ConfigurationManager Instance => SingletonFactory.GetInstance(typeof (ConfigurationManager)) as ConfigurationManager;
public string this[FIELD f]
{
get => RegistryFields.Instance[f];
set => RegistryFields.Instance[f] = value;
}
public Uri ProtocolUri => new Uri(this[(FIELD) 1]);
public Uri MessagingUri => new Uri(this[(FIELD) 2]);
public Uri ProtocolRelUri(string path) => new Uri(this.ProtocolUri, path);
public Uri MessagingRelUri(string path) => new Uri(this.MessagingUri, path);
public bool IsProductAvailable(string prodId)
{
string path = this.ProductExePath(prodId);
return path != null && File.Exists(path);
}
private string GetProductValue(string prodId, string valueName)
{
RegistryKey registryKey1 = Registry.LocalMachine.OpenSubKey(BuildVersion.ProductRegistryKey).OpenSubKey("Products");
if (registryKey1 != null)
{
try
{
RegistryKey registryKey2 = registryKey1.OpenSubKey(prodId);
if (registryKey2 != null)
{
try
{
return (string) registryKey2.GetValue(valueName);
}
finally
{
registryKey2.Close();
}
}
}
finally
{
registryKey1.Close();
}
}
return (string) null;
}
public string ProductExePath(string prodId) => this.GetProductValue(prodId, "ExePath");
public bool RegistryIsSane
{
get
{
try
{
Uri protocolUri = this.ProtocolUri;
Uri messagingUri = this.MessagingUri;
return Directory.Exists(this[(FIELD) 3]);
}
catch (Exception ex)
{
return false;
}
}
}
public XmlDocument Xml
{
get
{
XmlDocument xml = new XmlDocument();
xml.LoadXml("<state/>");
foreach (FIELD field in Enum.GetValues(typeof (FIELD)))
{
FIELD f = (FIELD) ^(int&) ref field;
XmlElement element = xml.CreateElement("field");
xml.DocumentElement.AppendChild((XmlNode) element);
try
{
element.InnerText = this[f];
}
catch (Exception ex)
{
element = xml.CreateElement("exception");
element.InnerText = ex.ToString();
xml.DocumentElement.AppendChild((XmlNode) element);
}
element.SetAttribute("name", ((Enum) (object) f).ToString());
}
return xml;
}
}
public void WipeState()
{
FIELD[] fieldArray = new FIELD[7]
{
(FIELD) 5,
(FIELD) 8,
(FIELD) 9,
(FIELD) 10,
(FIELD) 11,
(FIELD) 13,
(FIELD) 14
};
foreach (int num in fieldArray)
{
FIELD field = (FIELD) num;
RegistryKey registryKey = RegistryFields.ConfigKey(field, true);
try
{
registryKey.DeleteValue(((Enum) (object) field).ToString(), false);
}
finally
{
registryKey.Flush();
registryKey.Close();
}
}
}
}
}