๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐ŸดCTF/Root Me

Root Me - TCP - Encoded string

by Janger 2024. 2. 16.
728x90
๋ฐ˜์‘ํ˜•

 

๋ฌธ์ œ ๋‚ด์šฉ

 

TCP ํ”„๋กœํ† ์ฝœ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ด ํ…Œ์ŠคํŠธ๋ฅผ ์‹œ์ž‘ํ•˜๋ ค๋ฉด ๋„คํŠธ์›Œํฌ ์†Œ์ผ“์— ์žˆ๋Š” ํ”„๋กœ๊ทธ๋žจ์— ์—ฐ๊ฒฐํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

 ํ”„๋กœ๊ทธ๋žจ์—์„œ ๋ณด๋‚ธ ์ธ์ฝ”๋”ฉ๋œ ๋ฌธ์ž์—ด์„ ํ•ด๋…ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
 ํ”„๋กœ๊ทธ๋žจ์ด ๋ฌธ์ž์—ด์„ ๋ณด๋‚ธ ์ˆœ๊ฐ„๋ถ€ํ„ฐ 2์ดˆ ์ด๋‚ด์— ์ •๋‹ต์„ ๋ณด๋‚ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
 ๋‹ต์€ ๋ฌธ์ž์—ด๋กœ ๋ณด๋‚ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

 

์ •๋‹ต ์ฝ”๋“œ

 

"""
To start this test using the TCP protocol, you need to connect to a program on a network socket.

 You must decode the encoded character string sent by the program.
 You have 2 seconds to send the correct answer from the moment the program sends you the string.
 The answer must be sent as a string.

Challenge connection informations
Host	challenge01.root-me.org
Protocol	TCP
Port	52023
"""

import socket
import base64

def main():
    host = "challenge01.root-me.org"
    port = 52023

    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
        s.connect((host, port))
        data = s.recv(1024)
        print(data.decode())

        string = data.decode().split("my string is '")[1].split("'")[0]

        result = base64.b64decode(string).decode() + "\n"
        print(result)

        s.sendall(result.encode())

        data = s.recv(1024)
        
    print(data.decode())




if __name__ == "__main__":
    main()

 

 

 

 

 

 

 

728x90
๋ฐ˜์‘ํ˜•

'๐ŸดCTF > Root Me' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

Root Me - TCP - Back to school  (0) 2024.02.16
Root Me - Encoding - ASCII  (0) 2024.02.16
Root Me - CSP Bypass - Inline code  (0) 2024.02.15