Rating:

# Treeeeeeee
1. Intro
2. Find every pictures
3. Find the flag

## Intro
With this challenge, a file is attached. It's a zip file with a folder, containg something like 28 000 folders with 1337 files.

IT'S GONNA BE FUN

## Find every pictures
I was using Windows, so here's the way to do it under Windows

Firstly, I extracted the archive. Then, I went to the bigtree folder, and research "."
Scroll to the end and select all the files

![](https://imgur.com/yH8f9kD.png)

Then copy it to a new folder, the flag is one of these.

## Find the flag
We now have 1300 images. A quick look at the images shows that there are two images that are cloned.

![](https://imgur.com/tr4KZa3.jpg) and ![](https://imgur.com/pogbWw1.jpg)

So i decided to made a quick python script to deleted the duplicated images.

Here with all the comments :
```
from os import listdir, remove
from os.path import isfile, join
import hashlib

#a hash is a kind of "signature"

BLOCK_SIZE = 65536 #for hash purpose
mypath = "F:\\CTF\\riceteacatpanda\\gen\\treeeee\\pic\\" #the path of the folder with images

onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))] #an array with the name of every images in the folder

def main(): #the function to execute
uniqueHashs = [] #the array containing the hash of every single file
uniqueHashs.append('test') #just to make the array not empty
for actualFile in onlyfiles: #the loop to test every file
actualFile = mypath + actualFile #here we concatenate the path and the filename, to have a full path
deleted = 0

hashOfFile = hashFile(actualFile) #calculate the hash of the file
for comparaisonHash in uniqueHashs: #test if the hash already exist
if (hashOfFile == comparaisonHash and deleted != 1): #if yes, we delete the file
remove(actualFile)
deleted = 1
if (deleted != 1):
uniqueHashs.append(hashOfFile) #else, we keep the file and add it's hash in the array
return 0;

def hashFile(fileToRead): #this function return the hash of the file given in argument

file_hash = hashlib.sha256()

with open(fileToRead, "rb") as fi:

fb = fi.read(BLOCK_SIZE)
while len(fb) > 0:
file_hash.update(fb)
fb = fi.read(BLOCK_SIZE)
return(file_hash.hexdigest())
```

After executing this script, it only remain 3 pictures :

![](https://imgur.com/tr4KZa3.jpg) and ![](https://imgur.com/pogbWw1.jpg) and ![](https://imgur.com/vbOvcA9.jpg)

The flag is : `rtcp{meow_sharp_pidgion_rice_tree}`

PS: the cat in the hint was like this : ![](https://imgur.com/85gPGoG.png)

-----

*If you have any questions, you can dm me on Discord, nhy47paulo#3590*