Tags: misc shellscript 

Rating: 5.0

```
1. linux
2. bash
3. shell script
3. tar
4. gzip
5. unzip
6. fcrackzip
7. password.txt
```
```
#!/bin/bash
x=1819
while [ $x -gt -1 ]
do
typ=`ls $x.*|cut -f2 -d.`
echo $x.$typ
case $typ in
gz)
out=`gzip -fkNd $x.$typ`
;;
tar)
out=`tar -kxvf $x.$typ`
;;
zip)
pas=`fcrackzip -Du $x.$typ -p password.txt|grep "=="|cut -f3 -d= |tr -d ' \n'`
#echo $x.$typ:$pas
out=`unzip -oP $pas $x.$typ`
;;
esac
x=$(( $x - 1 ))
done
```
```
$ time bash loop.sh; more flag.txt
1819.gz
1818.tar
1817.tar
1816.gz
1815.zip
1814.tar
..
..
..
6.zip
5.zip
4.zip
3.zip
2.zip
1.tar
0.gz

real 0m17.057s
user 0m13.506s
sys 0m5.277s
rtcp{z1pPeD_4_c0uPl3_t00_M4Ny_t1m3s_a1b8c687}
```

Original writeup (https://github.com/page2me/Houseplant-CTF-2020/tree/master/Zip-a-Dee-Doo-Dah).