diff --git a/BadMorals/Program.cs b/BadMorals/Program.cs index b6292d7..e4949c4 100644 --- a/BadMorals/Program.cs +++ b/BadMorals/Program.cs @@ -1,24 +1,55 @@ using System; - namespace BadMorals { public class Program { - static string s1 = "SFYyMHtyM3YzcnMzXzNuZzFuMzNyMW5nX2"; - static string s2 = "Q1RGX3BsNHkxbmdf"; - static string s3 = "00ZDNfMzRzeX0="; - static byte[] b = Convert.FromBase64String(s1 + s3); + static string s1 = "2SXFnY5yWMMHytNyzMM3uYFzzcZnuMNzzXXzzNMunZczzFYu3MMzyNtyHMMWy5YnFXS2"; + static string s2 = "fdmbxkHNsB3XGR1Q"; + static string s3 = "::PNDlGpXpoR:7"; + + static char[] a = s1.ToCharArray(); + static char[] b = s2.ToCharArray(); + static char[] c = s3.ToCharArray(); public static void Main(string[] args) { - string TurnBack = "You're not ready yet..."; - Console.WriteLine(TurnBack); - } - public static string secret() - { - string flag = System.Text.Encoding.UTF8.GetString(b); - Console.Write("Ho ho ho, it seems you have solved the riddle and are now ready for your Christmas gift: "); - return flag; + // Section 1: Get every second char of s1 + string firstresult = ""; + for (int i = 0; i < a.Length; i++) + { + if (i % 2 == 0) + { + a[i] = a[i + 1]; + firstresult += a[i]; + } + } + + // Section 2: Reverse the string s2 + string secondresult = ""; + Array.Reverse(b); + for (int u = 0; u < b.Length; u++) + { + secondresult += b[u]; + } + + // Section 3: XOR the string with a fixed byte + string thirdresult = ""; + byte q = 10; + for (int z = 0; z < c.Length; z++) + { + + char newchar = (char)(c[z] ^ q); + thirdresult += newchar; + } + + // Final section: Convert the two strings from Base64 and print it out. + string final = firstresult + thirdresult; + + byte[] bit = Convert.FromBase64String(final); + + string flag = System.Text.Encoding.ASCII.GetString(bit); + + Console.Write(flag); } } }