Thứ Tư, 8 tháng 2, 2017

[AlexCTF 2017][Writeup][SC1: Math bot]

Untitled Document.md

[AlexCTF 2017][Writeup][SC1: Math bot]

Hint:

It is well known that computers can do tedious math faster than human.
nc 195.154.53.62 1337
Update
we got another mirror here
nc 195.154.53.62 7331

Try nc I got
nc

I think each question server give client expression and client must return result
So, Here is my script

import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('195.154.53.62',7331))
while 1:
    buffer = sock.recv(1024)
    string = buffer.decode('utf8')
    print(string)
    raw_list = string.split('\n')
    if (len(raw_list) <=2):
        buffer = sock.recv(1024)
        string = buffer.decode('utf8')
        print(string)

    num_list = raw_list[-2].split(' ')
    first_num = int(num_list[0]);
    second_num = int(num_list[2])
    print(first_num)
    print(second_num)

    if (num_list[1] == '+'):
        ans = first_num + second_num
    elif(num_list[1] == '-'):
        ans = first_num - second_num
    elif(num_list[1] == '*'):
        ans = first_num * second_num
    elif(num_list[1] =='%'):
        ans = first_num % second_num
    else:
        ans = first_num / second_num
    print(ans)
    sock.send(bytes(str(int(ans)) + '\n','utf8'))

And here is result

Well no human got time to solve 500 ridiculous math challenges
Congrats MR bot!
Tell your human operator flag is: ALEXCTF{1_4M_l33t_b0t}

Không có nhận xét nào:

Đăng nhận xét

[Alex CTF 2017][Writeup][CR3: What is this encryption?]

alex_ctf_2017_writeup_cr3.md [Alex CTF 2017][Writeup][CR3: What is this encryption?] Sloved this problem when contest ended Hint Fady a...