Russian Dolls

Discussion of challenges you have already solved
Nihlaeth
Posts: 7
Joined: Sun Aug 16, 2009 1:07 am
Contact:

Post by Nihlaeth »

I started manually at my linux server, but after about 300 times renaming, unzipping and using the file command I gave up and started to look up the bash basics...

I could have guessed the answer easily, but I didn't know that in advance :p

However, I must say I really learned something on this one, thanks!
Curiosu
Posts: 3
Joined: Fri Aug 27, 2010 12:52 pm

Post by Curiosu »

used this php function ..it was a pain, first I thought it was simple zip,

Code: Select all

     function extractGzip ($src, $dest=false)
    {
        $zp = gzopen( $src, "r" );
       if (!is_resource($zp)) return false;
        $data = '';
        while (!gzeof($zp))
            $data .= gzread($zp, 1024*1024);
        gzclose( $zp );
        if (empty($dest)) return $data;
        elseif (file_put_contents($dest, $data)) return true;
        return false;
    }
And my code was bugged, and runned the func for like 15k times, but it was fun
User avatar
laz0r
Posts: 290
Joined: Thu Feb 04, 2010 4:18 pm
Location: Within the depths of Unix

Post by laz0r »

It's really easy under Mac OS - it will do all the unarchiving at once if you ask it to unarchive a file. It just meant sitting waiting for it to finish, and renaming the files every now and again (because Mac OS appends ' 2' onto the archive each iteration, and they get far too long).
There is no spoon.
driest
Posts: 2
Joined: Sun Feb 10, 2008 12:53 pm

Post by driest »

Python solution:

Code: Select all

import gzip
while 1:
    f = gzip.open('doll.bin', 'rb')
    content = f.read()
    f.close()
    out = open('doll.bin', 'wb')
    out.write(content)
    out.close()
junkpete
Posts: 4
Joined: Sat Oct 16, 2010 12:50 pm

Post by junkpete »

under mac os x you only have to click about 10 times, it automatically extraxts but stops when the filename is too long ;-)
al_paz
Posts: 1
Joined: Tue Dec 14, 2010 10:50 am

Post by al_paz »

i guessed the answer... first tried "babushka" and then the correct one.
kjangwa
Posts: 2
Joined: Fri Nov 20, 2009 9:44 pm

Post by kjangwa »

No way, such good solutions, this took me ages.
first copied 7z.exe and 7z.dll into sys32 so 7zip would work from cmdline then wrote this python script.
renamed doll.gz to doll1.gz

Code: Select all

import os

for i in range(1,1000):
    unzip="doll"+str(i)
    q=i+1
    name="doll"+str(q)
    
    os.system("7z e "+unzip+".gz")
    print "unzipped",unzip
    print "renamed to ",name
    os.rename(unzip, name+".gz")
I didnt realize till now that 7zip would unzip a file without a .gz extension
Millennium
Posts: 17
Joined: Thu Apr 21, 2011 3:08 am

Post by Millennium »

I did it in C++ XD
User avatar
awf
Posts: 3
Joined: Sat May 07, 2011 7:20 pm

Script?

Post by awf »

I solved this like "mystery file" by pressing the unpack shortcut
in 7-zip until the solution was found.

Does somebody know how this .bin-packing works? I first tried
to write a script from hand to solve "mystery file" but the input
string from the file is seemingly random hex-numbers that aren't
connected to the solution obtained by 7-zip. :?
FreeFull
Posts: 7
Joined: Fri Apr 22, 2011 6:26 pm

Re: Script?

Post by FreeFull »

awf wrote:I solved this like "mystery file" by pressing the unpack shortcut
in 7-zip until the solution was found.

Does somebody know how this .bin-packing works? I first tried
to write a script from hand to solve "mystery file" but the input
string from the file is seemingly random hex-numbers that aren't
connected to the solution obtained by 7-zip. :?
It's just simple gzip encryption
rain1024
Posts: 27
Joined: Sat Jul 23, 2011 5:20 pm

...

Post by rain1024 »

Finally I got it
It's nice challenge
But seem all comment too open???

I wrote a script to get answer.
hut
Posts: 1
Joined: Fri Jul 29, 2011 10:20 pm

Post by hut »

At first I did it with aunpack which is a wrapper for unpacking any kind of archives. But with each unpack, the file size got doubled... then I read the hint that it's 999 layers and I thought damn, I dont have 10^9999 GB here :(
but luckily it worked fine using gzip directly.
bspus
Posts: 9
Joined: Sun Sep 04, 2011 5:16 pm

Post by bspus »

Too bored to boot a live linux just for the file command
I couldn't get 7z to report the file type. Then after I solved it, I noticed it was in file-properties all along... duh!

renaming it to doll.bin.zip worked anyway. 7z does not care about the corect extension.
Then I used the following batch file

Code: Select all

@echo off

set /a counter=0

:top
ren doll.bin doll.bin.zip
7z x doll.bin.zip
del doll.bin.zip
set /a counter+=1
if %counter% LEQ 996 goto :top

:end
exit
I knew aready that it was 999 times compressed so i left a few out just in case
Schnapphahn
Posts: 12
Joined: Sun Oct 26, 2008 4:33 pm

Post by Schnapphahn »

bat using 7zip did it.
chc4
Posts: 1
Joined: Thu Sep 16, 2010 9:24 pm

Post by chc4 »

Used a C# 7zip wrapper dll. Came out around 10 lines long ^_^
I am pwn.
Post Reply