๋ฐ์ํ
ํ์ด ๋ฐฉ๋ฒ
- ๋ก๋ด์์ ์ธ์ฆ
- ์ถ๋ ฅ๋๋ ํ ํฐ์ ์ฌ์ ๋ ฅ
- ๋ฐฐํ ์ ํตํด ๋์ ๋ฒ๋ฐฐํ ํ๋ ๋์ด ๊ฐ์ง๊ณ ์๋ ๋๋ณด๋ค ์๊ฑฐ๋ ๊ฐ์ผ๋ฉด ๋๋ ๊ฒ์ ํ์ธ. ์์์ ๋์ ๋ฐฐํ ํ์ฌ ๋ฐฐํ ์์ ์ง๋ ๊ฒฝ์ฐ, money - bet ์์ ํตํด ์คํ๋ ค ๋์ ์ป์ ์ ์๋ ๊ฒ์ ํ์ธ
- bet = int(input('how much money do you want to bet (your money: ${0})? '.format(money))) if money < bet: print('you don\\'t have enough money (your money: ${0}).'.format(money)) return
- ๋์ฃผ๊ณ flag๋ฅผ ์ฐ๋ค.
์ฝ๋
from pwn import *
import time
p = remote("host3.dreamhack.games", 23111)
# p = process("./robot_only.py")
data = p.recvline().decode('utf-8')
data += p.recvline().decode('utf-8')
data += p.recvline().decode('utf-8')
data += p.recvline().decode('utf-8')
data += p.recvline().decode('utf-8')
print(data)
## ๋ก๋ด ์ธ์ฆ ์ ํ
p.sendafter(b"> ", b"2\\n")
## ํ ํฐ์ด ์ถ๋ ฅ๋จ
data = p.recvline().decode('utf-8')
print(data)
## ํ ํฐ๋ง ๋ถํ ํด์ ์ถ๋ ฅ
token = data.split("please type this same: \\"")[1]
token = token.split("\\"")[0] + "\\n"
print("token : " + token)
p.sendafter(b"> ", bytes(token, 'utf-8'))
## ๋ก๋ด์์ ํ์ธํ๋ค๋ ๋ฉ์์ง ์ถ๋ ฅ
data = p.recvline().decode('utf-8')
data += p.recvline().decode('utf-8')
data += p.recvline().decode('utf-8')
data += p.recvline().decode('utf-8')
data += p.recvline().decode('utf-8')
data += p.recvline().decode('utf-8')
print(data)
## ๋ฐฐํ
์์
p.sendafter(b"> ", b"1\\n")
data = p.recvline().decode('utf-8')
print(data)
## ๋ฐฐํ
ํ ๊ธ์ก ์ ํ
## ์ฝ๋์์ money < bet ๋ก ํ์ธํ๋ ๊ฑธ ํตํด ์์ ์
๋ ฅ๊ฐ๋ฅํ ๊ฒ์ ํ์ธ
p.sendafter(b")?", b"-1000000000000000\\n")
data = p.recvline().decode('utf-8')
print(data)
## 1 ์ ํ. 1์ด ๋ต์ธ ๊ฒฝ์ฐ๋ ์๋ฌ ๋ฐ์ -> ํ๋ฒ ๋ ์๋
p.sendafter(b"> ", b"1\\n")
data = p.recvline().decode('utf-8')
data += p.recvline().decode('utf-8')
data += p.recvline().decode('utf-8')
data += p.recvline().decode('utf-8')
data += p.recvline().decode('utf-8')
data += p.recvline().decode('utf-8')
data += p.recvline().decode('utf-8')
print(data)
## flag ์ฌ๊ธฐ!!
p.sendafter(b"> ", b"3\\n")
data = p.recvline().decode('utf-8')
data += p.recvline().decode('utf-8')
print(data)
p.close()
๊ฒฐ๊ณผ
๋ฐ์ํ
'๐ดโโ ๏ธ CTF ๐ดโโ ๏ธ > ๐งฎ ์ํธํ ๐งฎ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Dream Hack - Crypto] chinese what? (0) | 2023.09.04 |
---|---|
[Dream Hack - Crypto] ICM2022 (0) | 2023.09.04 |
[Dream Hack - Crypto] darimchal_001 (0) | 2023.09.04 |
[Dream Hack - Crypto] ROT128 (0) | 2023.09.04 |
[WebHacking] #1 old-1 (1) | 2022.10.26 |