public void TestBase255EncodingForEdgeCasePayloads() { byte[] shellcode = new byte[] { 0x00, 0x01, 0x02, 0x03, 0xFC, 0xFD, 0xFE, 0xFF }; BaseNEncoder encoder = new BaseNEncoder(); Console.WriteLine(encoder); string encodedShellcode = encoder.Encode(shellcode); List <int> lookups = new List <int>(); foreach (var c in encodedShellcode) { lookups.Add((int)c); } int encodedLen = encodedShellcode.Length; byte[] decodedShellcode = encoder.Decode(encodedShellcode); Assert.AreEqual(shellcode, decodedShellcode); }
public void TestBase255EncodingForBasicPayload() { byte[] shellcode = TestHelpers.GetPopCalcShellcode(); BaseNEncoder encoder = new BaseNEncoder(); var strings = FormulaHelper.BuildBase64PayloadMacros(shellcode); foreach (var s in strings) { Console.WriteLine(string.Format("=\"{0}\"", s)); } string encodedShellcode = encoder.Encode(shellcode); int encodedLen = encodedShellcode.Length; byte[] decodedShellcode = encoder.Decode(encodedShellcode); Assert.AreEqual(shellcode, decodedShellcode); }