Cool PYC – ByteCode Crackme Challenge

Hello again!, after a long time. Today I’m going to share with you a Compiled Python File (.pyc) crackme which is avaiable in root-me.org. This is my first experience with pyc files in reversing because we talk about them rarely in this area.

Here is the challenge : https://www.root-me.org/en/Challenges/Cracking/PYC-ByteCode

It suggests to retrieve the password to validate this challenge.

Let’s run ch19.pyc  ( You have to install python 3.1, if you don’t have it )

Capture5

Okay, fine. Now show us your inside ch19! 😀

Capture61

ord() method convert ASCII to Integer values. We can simply use chr() to reconvert them back

There is an encrypted list named SOLUCE. This list was generated by converting a string/Flag to integer values. Can we convert back these values to a string? In this situation it’s not possible because they have used XOR operator when generating integers.

So I wrote a simple decryption algorithm which bruteforces each integer in SOLUCE list and find which ASCII character is it.

Capture8

Full Code : https://github.com/I2NhbmloZWxweW91/pyc-bytecode-crackme-challenge/blob/master/ch19_solution.py

Let’s execute 😉

Capture10

He hates RUBY then! 😀 😀

Another cool thing happened when I sending the flag in the challenge. Look at bellow one.

Capture3

What!! I just solved your crackme by bruteforcing, actually are you telling me that I’m stupid right now?!

Frustrated moment… Did I miss something..

Tried once again and it worked!

Capture4

Site just adviced not to bruteforce the site itself when finding the password. It detected as I did because of sending wrong passwords two times.

❤❤