static void Main(string[] args) { Console.WriteLine(); Console.ForegroundColor = ConsoleColor.DarkGray; Console.WriteLine("Payload Encryption tool for Meterpreter Payloads "); Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine("Published by Damon Mohammadbagher 2016-2017"); Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine(); Console.WriteLine("[!] Using RC4 Encryption for your Payload"); string[] InputArg = args[0].Split(','); byte[] XPay = new byte[InputArg.Length]; Console.WriteLine("[!] Detecting Meterpreter Payload by Arguments"); Console.Write("[!] Payload Length is: "); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write(XPay.Length.ToString() + "\n"); Console.ForegroundColor = ConsoleColor.DarkGreen; for (int i = 0; i < XPay.Length; i++) { XPay[i] = Convert.ToByte(InputArg[i], 16); } Console.WriteLine("[!] Loading Meterpreter Payload in Memory Done."); byte[] Xresult = Encryption_Class.Encrypt(KEY, XPay); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("[>] Encrypting Meterpreter Payload in Memory by KEY Done."); Console.ForegroundColor = ConsoleColor.DarkGreen; Console.Write("[!] Encryption KEY is:"); Console.ForegroundColor = ConsoleColor.Yellow; string Keys = ""; foreach (byte item in KEY) { Keys += item.ToString("x2") + " "; } Console.Write(" {0}", Convert.ToString(Keys)); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("[+] Encrypted Payload with Length {0} is: ", XPay.Length.ToString()); Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine(); for (int i = 0; i < Xresult.Length; i++) { Console.Write(" " + Xresult[i].ToString()); } Console.WriteLine(); Console.WriteLine(); }
static void Main(string[] args) { Console.WriteLine(" "); Console.WriteLine("----------input---payload----------------"); Console.WriteLine(" "); int c = 0; for (int i = 0; i < payload.Length; i++) { c++; Console.Write(payload[i].ToString() + ","); } Console.WriteLine(" "); Console.WriteLine(" "); Console.WriteLine("byte payload:= " + payload.Length.ToString()); Console.WriteLine("c := " + c.ToString()); Console.WriteLine(" "); Console.WriteLine(" "); Console.WriteLine("---------encrypted payload----------------"); Console.WriteLine(" "); byte[] result = Encryption_Class.Encrypt(KEY, payload); int b = 0; for (int i = 0; i < result.Length; i++) { b++; if (i == result.Length + 1) { Console.Write(result[i].ToString()); } if (i != result.Length) { Console.Write(result[i].ToString() + ","); } } Console.WriteLine(" "); Console.WriteLine("byte result:= " + result.Length.ToString()); Console.WriteLine("i:= " + b.ToString()); Console.WriteLine(" "); Console.WriteLine(" "); Console.WriteLine("----------Decrypted payload -------------------"); Console.WriteLine(" "); byte[] result2 = Encryption_Class.Decrypt(KEY, result); for (int i = 0; i < result2.Length; i++) { Console.Write(result2[i].ToString() + ","); } }