Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
githubkuyaya authored Nov 5, 2020
1 parent 86c9a1a commit 0c8a5a5
Showing 1 changed file with 44 additions and 13 deletions.
57 changes: 44 additions & 13 deletions BadMorals/Program.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}

0 comments on commit 0c8a5a5

Please sign in to comment.