SHARE
TWEET

Untitled

a guest Jul 19th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Security.Cryptography;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using HarmonyLib;
  10.  
  11. namespace ConsoleApp1 {
  12.    class Program {
  13.       static Stream Decry(string FileName, int type) {
  14.          // This is just a demonstration, this method should not run because default(Stream) is null
  15.          byte[] array = File.ReadAllBytes(FileName);
  16.          TripleDESCryptoServiceProvider tripleDESCryptoServiceProvider = new TripleDESCryptoServiceProvider();
  17.          MD5CryptoServiceProvider md5CryptoServiceProvider = new MD5CryptoServiceProvider();
  18.          tripleDESCryptoServiceProvider.Key = md5CryptoServiceProvider.ComputeHash(default(Stream));
  19.          tripleDESCryptoServiceProvider.Mode = CipherMode.ECB;
  20.          ICryptoTransform cryptoTransform = tripleDESCryptoServiceProvider.CreateDecryptor();
  21.          byte[] array2 = array;
  22.          array2 = cryptoTransform.TransformFinalBlock(array2, 0, array2.Length);
  23.          return new MemoryStream(array2);
  24.       }
  25.       static Stream StandInMethod1(string FileName, int type) {
  26.          return null;
  27.       }
  28.       static Program StandInMethod2(string FileName, int type) {
  29.          byte[] array;
  30.          TripleDESCryptoServiceProvider tripleDESCryptoServiceProvider;
  31.          MD5CryptoServiceProvider md5CryptoServiceProvider;
  32.          ICryptoTransform cryptoTransform;
  33.          byte[] array2;
  34.          return null;
  35.       }
  36.       static void Main(string[] args) {
  37.          var HarmonyInst = new Harmony("Just a Test");
  38.          var original = AccessTools.Method(typeof(Program), "Decry");
  39.          var standin1 = AccessTools.Method(typeof(Program), "StandInMethod1");
  40.          var standin2 = AccessTools.Method(typeof(Program), "StandInMethod2");
  41.          new ReversePatcher(HarmonyInst, original, standin2).Patch();
  42.          new ReversePatcher(HarmonyInst, original, standin1).Patch();
  43.       }
  44.    }
  45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top