Rating: 5.0

This task required unpack, and crack password to zip, gzip, tar files.
Here is a script in bash to detect file with bash (tar can return application/gzip type, so is defined checking gzip returned status).

Required avalible commands (for this script):
* zip2john
* john
* wget
* python
* file

Decode.sh
```
#!/bin/bash

mkdir -p new/
mkdir -p old/

if [ ! -f wordlist.txt ]; then
wget https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/xato-net-10-million-passwords-100.txt
mv xato-net-10-million-passwords-100.txt wordlist.txt
fi

File="$1"

function DisPies { # Delete it source Paste incoming extended sources
mv $File old/
File="$( ls new/ )"
mv new/* .
}

while [[ 1 -eq 1 ]]; do
MimeType="$( file --mime-type -b ./$File )"
echo $MimeType
if [ "$MimeType" == "application/zip" ]; then
zip2john $File > o
mv $File $File.gz
File="$File.gz"
john --wordlist=wordlist.txt o > /dev/null
cd new/
$( ../Password.py "../$File" )
cd ..
DisPies
fi
if [ "$MimeType" == "application/gzip" ]; then
gzip -dkc $File > new/$File
if [ $? == 0 ]; then
DisPies
else
MimeType="application/x-tar"
fi
fi
if [ "$MimeType" == "application/x-tar" ]; then
cd new/
tar -xf ../$File
cd ..
DisPies
fi
done
```

Password.py
```
#!/usr/bin/python3

import zipfile
import os
import sys

with zipfile.ZipFile(sys.argv[1]) as f:
f.setpassword(os.popen('john --show ../o').read().split(':')[1].encode())
f.extractall('./')
f.close()
```
This file is required becouse we can't insert password to unzip with pipe.

FLAG: rtcp{z1pPeD_4_c0uPl3_t00_M4Ny_t1m3s_a1b8c687}