What is it? @.@

Here is the place where I record some tactics about wargame, systems, and other security issues.

2012-09-24

Hack This Site! - Programming 2

Description:

Analyze the picture and find the ascii code

The ascii code for a particular white pixel in the picture is equal to the offset from the last white pixel. The text contained in the image is the answer encoded in Morse. 
Level 2

This level is about image analyzing.
 _____________
|_____________| (image)

The pixels in the above image are numbered 0..99 for the first row, 100..199 for the second row etc. White pixels represent ascii codes. The ascii code for a particular white pixel is equal to the offset from the last white pixel. For example, the first white pixel at location 65 would represent ascii code 65 ('A'), the next at location 131 would represent ascii code (131 - 65) = 66 ('B') and so on.

The text contained in the image is the answer encoded in Morse, where "a test" would be encoded as ".- / - . ... -"

You have 15 seconds time to send the solution.

Answer:
_____________________________________________________________________________
|____________________________________________________________________________|
submit       (remain time: 15 seconds)


Solution:
  1. Each time when you visit the URL: hxxp://www.hackthissite.org/missions/prog/2/index.php , you get a different random coded image displayed on the page.
  2. I write a simple python program below to read the white pixels from the image and convert them into characters.
  3. I use Python Imaging Library (PIL) to help me fetch the pixels from the coded image.
    Reference: http://www.pythonware.com/downloads/index.htm
  4. And, of course the knowledge of Morse code from wikipedia as a mapping dictionary  I used in my python program.
    Reference: http://en.wikipedia.org/wiki/Morse_code
  5. The following is my python script.


  6. Use the script to find out what the coded password hided in the image it is.
  7. Download the image named 'code.png', run the script, fetch the password and submit in 15 seconds.
  8. It's done.