A box of chocolate

my public personal notebook

0CTF 2015 Quals - Task SATBeginner

My first CTF programming solution without bug :3 (or at least I haven't found any yet :p)

When we first connect to the server, we are given a 12-byte string. And in order to prove that we are "not robot", we must reply with a 20-byte string which starts with the given string, and its SHA-1 hash must end with '\xff\xff\xff'. So we must brute-force for such a string. I used the code from fail0verflow to deal with it. Thank you :3

After reading the judging code, and it is also suggested in that task's name, we can see that we are required to solve the Boolean satisfiability problem. I used pycosat to solve it.

Here's the code:

0ctf SATBeginner

I forgot to save the flag :<, but I think it is something like "SAT is much easier than GRE".