-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86c9a1a
commit 0c8a5a5
Showing
1 changed file
with
44 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |