Advertisement
Guest User

Untitled

a guest
Feb 25th, 2018
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.81 KB | None | 0 0
  1. // Decompiled with JetBrains decompiler
  2. // Type: Level2.Program
  3. // Assembly: Level2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
  4. // MVID: 8E42502F-4AC8-4897-84C5-FB18B897711E
  5. // Assembly location: D:\Games\Torrents\8d.exe
  6.  
  7. using System;
  8. using System.IO;
  9. using System.Reflection;
  10. using System.Runtime.InteropServices;
  11.  
  12. namespace Level2
  13. {
  14.   internal class Program
  15.   {
  16.     public static void Main(string[] args)
  17.     {
  18.       if (Program.Authorize())
  19.       {
  20.         Console.WriteLine("Security check complete. Starting application...");
  21.         string tempFileName = Path.GetTempFileName();
  22.         Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Level2.level3.dll");
  23.         using (FileStream fileStream = new FileStream(tempFileName, FileMode.Create, FileAccess.Write))
  24.         {
  25.           while (manifestResourceStream.Position < manifestResourceStream.Length)
  26.             fileStream.WriteByte(Program.Deobfuscate((byte) manifestResourceStream.ReadByte()));
  27.         }
  28.         IntPtr hModule = Win32.LoadLibrary(tempFileName);
  29.         ((Action) Marshal.GetDelegateForFunctionPointer(Win32.GetProcAddress(hModule, "check"), typeof (Action)))();
  30.         Win32.FreeLibrary(hModule);
  31.         File.Delete(tempFileName);
  32.       }
  33.       else
  34.         Console.WriteLine("Security check failed. Exiting...");
  35.     }
  36.  
  37.     private static bool Authorize()
  38.     {
  39.       Console.WriteLine("Please, complete security check to run this application.");
  40.       Console.Write("Enter PIN: ");
  41.       long result;
  42.       if (long.TryParse(Console.ReadLine(), out result))
  43.         return result == 15663090876965025L;
  44.       return false;
  45.     }
  46.  
  47.     private static byte Deobfuscate(byte obfuscated)
  48.     {
  49.       return (byte) ((uint) byte.MaxValue - (uint) obfuscated);
  50.     }
  51.   }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement