Russian Dolls
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!
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!
used this php function ..it was a pain, first I thought it was simple zip,
And my code was bugged, and runned the func for like 15k times, but it was fun
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;
}
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.
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()
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
I didnt realize till now that 7zip would unzip a file without a .gz extension
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")
Script?
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.
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.
Re: Script?
It's just simple gzip encryptionawf 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. :?
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
I knew aready that it was 999 times compressed so i left a few out just in case
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