###### tags: `nactf`
# zip madness (175)
- 題目:
- Evan is playing Among Us and just saw an imposter vent in front of him! Help him get to the emergency button by following the directions at each level.
Download: [flag.zip](https://www.nactf.com/files/439581a82f0ae49387ecd38eb180813b/flag.zip?token=eyJ1c2VyX2lkIjozMjYsInRlYW1faWQiOjI5LCJmaWxlX2lkIjo1OX0.X5-9jA.i6vBunfCR6MCg9u2TQ3YxQzZ1bk)
- 解題絲路:
- 觀察flag.zip內的檔案,透過direction.txt索引下一步要解壓縮的檔案內容。
- 檔名的規則是「數字+right/left」.zip,且依序遞減。
- 使用語言:python3.7
- 函示庫:zipfile
```python=
import os
import zipfile
file_path="D:\\CTF\\zip_madness"
count=1000
file_name="%s\\flag.zip"%file_path
print(file_name)
while count > 0:
zf = zipfile.ZipFile(file_name, 'r') ## 找出壓縮檔案格式, r解壓縮, w壓縮
zf.extractall() ## 解壓縮
direTxT=open("D:\\CTF\\zip_madness\\direction.txt")
direction=direTxT.readline() ## 讀第一行文字檔
file_name="%s\\%d%s.zip"%(file_path, count, direction)
count-=1
print(count)
```