async def handler_get_2(hostname, id, flag):
    p = await get_point_with_flag(hostname, id['username'], id['password'],
                                  id['id'])
    if p['x'] + p['y'] != flag:
        checker.corrupt(message="Bad flag: expected {}, found {}".format(
            flag, p['message']))
    checker.ok()
Beispiel #2
0
    def process(self):
        if len(self.specs) == 0:
            checker.down(message='No one signal package')

        data = numpy.concatenate(self.specs)
        mx = numpy.max(data)
        data = numpy.log(data / mx) >= -1.5
        skiped, comp = compress(data)

        if len(comp) < 2:
            checker.corrupt(message='No signal')

        bounds = get_bounds(numpy.unique(comp))

        if len(bounds) == 0:
            checker.mumble(message="Can't understand dot size")

        silence = comp[1::2]
        signal = comp[0::2]
        if skiped == 2:
            signal, silence = silence, signal
        signal = list(numpy.where(signal <= bounds[0], '.', '-'))
        silence = apply_silence_bounds(silence, bounds)
        if skiped == 2:
            signal, silence = silence, signal
        morse = merge(signal, silence)
        text = convert_to_text(morse)

        if not text:
            checker.corrupt(message='No one symbol in signal')

        return text
async def handler_get(hostname, id, flag):
    first = State(hostname, PORT, 'first')
    text = await first.get(id)

    if flag not in text:
        print('NO FLAG')
        checker.corrupt()

    checker.ok()
Beispiel #4
0
async def handler_get_1(hostname, id, flag):
    id = json.loads(id)
    user = id['username']
    state = State(hostname)
    await state.get_post(id['public'], True, user)
    file = await state.get_post(id['private'], True, user)
    if file['body'] != flag:
        return checker.corrupt(
            message="Bad flag: expected {}, found {}".format(
                flag, file['body']))
    checker.ok()
Beispiel #5
0
async def handler_get_2(hostname, id, flag):
    id = json.loads(id)
    state = State(hostname)
    skill = id["skill"]
    await state.login(skills=json.dumps([skill]))
    url = id["url"]
    file = await state.get_post(url, True, id['username'])
    if file['body'] != flag:
        return checker.corrupt(
            message="Bad flag: expected {}, found {}".format(
                flag, file['body']))
    checker.ok()
async def handler_get(hostname, id, flag):
    id = json.loads(id)
    getter = State(hostname, PORT, 'get', id['user'], id['pass'])
    if not await check_in_self_list(getter, flag):
        checker.corrupt()
    checker.ok()
Beispiel #7
0
 def ensure_ok(self, method):
     status = self.recv(2).decode(encoding='ascii', errors='ignore')
     if status != 'ok':
         checker.corrupt(
             error="unexpexted status '{}' while {}".format(status, method))