FAQ  •  Login

Level 12

Moderators: UncleTimmy, mjpieters

Enjoying the challenge? Need a hint?
Make a donation and help keep the site running! -thesamet
<<

tripzilch

Posts: 3

Joined: Mon Aug 20, 2012 6:17 am

Post Mon Aug 20, 2012 12:02 pm

Re:

BronYAurStomp wrote:I've looked up image headers, and compared notepad-opened image files (jpeg, bmp, gif). I found easily identifiable patterns, none of which occur in the gfx file. I've used a hex-editor (had no idea what i was doing) and looked at the data.


A hex editor is basically a sort of "X-ray vision" for binary files. I can recommend HxD (freeware: http://mh-nexus.de/en/hxd/ ) for Windows (Linux users can use the built-in commandline tool "hexdump" or "hd").

What it shows you are the hexadecimal codes for the bytes on the left side, and the characters representing the same on the right, except with the unprintable characters replaced by a dot.

HxD also has a bunch of other features which you don't need for this challenge, but might be useful to learn about if you're interested in that sort of thing (who knows they might come in handy for later challenges--although you can easily reproduce most of that functionality in Python as well).

But as someone on the previous page said, you don't necessarily *need* a hex editor to solve this one. There's many other ways to examine the file (also with Python), I just found it useful because it's my usual first-try go-to for examining binary files.

Found some identifying header things but couldn't go farther with it. I've also tried building a string from the gfx file, adding one character at a time, and imghdr testing it. For some reason my string wants to be 31 chars long, idk why. But I need some help :*(


Sounds like you're not reading the file in Python in "binary mode". By default Python reads its files in "text mode", which causes it to break on newlines and such. Since images are binary files (meaning they contain unprintable characters, including newlines) you need to read them with open("yourfilename", "rb") which stands for "read binary" when reading, and also very important when "unshuffling" (or "dealing"--I agree it's a better description) you need to open("youroutputfile", "wb") which stands for "write binary" or the file will be written in text mode, causing it not to contain the exact bytes you intend it to have.

For me the hardest part of this challenge was discovering the "shuffled" file :-) I got stuck trying all sorts of transformations on the initial card-dealing image to look for a hidden message, which was a red herring :-)

I wonder, one of the unshuffled images is corrupt--was that on purpose, or a mistake? :) Also it's interesting to see that Win7 Photo Viewer displays less of that image than when I load it into my Opera browser (didn't try other browsers).
<<

ntommy

Posts: 2

Joined: Tue Oct 23, 2012 8:10 pm

Post Tue Feb 05, 2013 10:57 pm

Re: Level 12

I had lots of extra problems with python v3. When I read in the binary file, writing a new binary file is different from v2. When I use the usual:
  Code:
f = open(infile, 'rb')
data = f.read()

The resulting data[0] is an integer, not binary. I have no idea why, but to get the 1st binary, you have to do data[0:1]. Once I stumbled on that, I got my 5 pictures, however the 4th is only the top half of the picture...
Previous

Return to Python Challenge Hints

Who is online

Users browsing this forum: Google [Bot] and 5 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.