CSAW CTF: Reversing 200
Binary available at http://repo.shell-storm.org/CTF/CSAW-2012/Reversing/200/.
We’re given a .NET binary in this challenge. It merely prints a string and exits instantly. Decompiling it using ILSpy and we see the main routine as follows.
private static void Main(string[] args)
{
Console.WriteLine("Okay, going to compute the key. Have to remember to write it out at the end! I keep forgetting!");
string arg = "";
byte[] array = Program.encrypted;
for (int i = 0; i < array.Length; i++)
{
byte b = array[i];
arg += Convert.ToChar((int)(b ^ 255));
}
Console.ReadLine();
}
Simple stuff! I wrote a python script to reverse it.
>>> cipher_text = [171, 151, 154, 223, 148, 154, 134, 223, 150, 140, 223, 198, 156, 207, 198, 153, 199, 203, 206, 201, 158, 205, 205, 207, 201, 205, 205, 206, 154, 202, 207, 157, 198, 199, 154, 204, 203, 201, 207, 203, 200, 157, 200] >>> plain_text = "" >>> for char in cipher_text: ... plain_text += chr(char ^ 255) ... >>> plain_text 'The key is 9c09f8416a2206221e50b98e346047b7'

Reblogged this on Sutoprise Avenue, A SutoCom Source.