Tags: misc python jail 

Rating:

# yellsatpython - Misc (451 pts)

## Description
> "p*thon"
>
> nc yellsatpython.wolvctf.io 1337

### Provided files
`jail.py` - the Pyhon source code for the server \[[download](https://ctfnote.shinmai.wtf:31337/files/downloadFile?id=W29xPKsskV7t7U0)\]

## Ideas and observations
1. the banned list looks indimitating at first, but notice `open()` isn't in there, and neither is `chr()`
2. the only thing standing between us and `open('flag.txt').read()` are the two dots

## Notes
1. `open()` returns a file object, that is an iterator that processes the file one line at a time (in ASCII mode)
2. the built-in `min` function, if passed an iterable, goes through all the values of the iterable, and returns the smallest one
3. Our flag file likely only has one line

## Solution
1. we send `min(open('flag'+chr(0x2e)+'txt'))` and get the flag.

`wctf{us3_h4sk3ll_n0t_p*th0n-r4g0b}`

Original writeup (https://gist.github.com/shinmai/5720d1f0a214d0878cfb530eb975c469#yellsatpython---misc-451-pts).