DAY 5
1
Security

## Day05 [General Skill] Linux基本指令(續)

CTF題目的解法有非常多種，可以先試著自己解看看，解出來後可以再看看別人怎麼解，這樣練習可以很好的訓練自己利用不同的思維來解題，我們就來進行今天的題目吧～

https://www.asciitohex.com/

``````#!/usr/bin/env python
from pwn import *

l = remote('2018shell.picoctf.com',31711) #相當於nc 2018shell.picoctf.com 31711
l.recvuntil('stored')

# 第一個問題 binary->ascii
l.recvuntil(' the ')
binary = hex(int(l.recvuntil('as ')[:-3].replace(' ',''),2))[2:].decode('hex')
l.recv()
l.sendline(binary)

l.recvuntil(' the ')
l.recv()

#第三個問題 octal->ascii
l.recvuntil(' the  ')
octal = l.recvuntil('as ')[:-3]
octal = ''.join([chr(int(i,8)) for i in octal.split()])
l.recv()
l.sendline(octal)

# Flag
print l.recv()

``````

``````\$ ./solve.py
[+] Opening connection to 2018shell.picoctf.com on port 31711: Done
You got it! You're super quick!

[*] Closed connection to 2018shell.picoctf.com port 31711

``````

python在CTF中非常實用，他簡潔的語法可以為解題速度帶來很大的提昇

``````\$ cat ".  "
picoCTF{j0hn_c3na_paparapaaaaaaa_paparapaaaaaa_22f627d9}
``````

`echo "Please may I have the flag?" | ./in-out-error 1>/dev/null`

### 1 則留言

0
pornhub1998
iT邦見習生 ‧ 2020-03-13 19:35:00

suck my dick