Skip to content
Snippets Groups Projects
changeme.py 1.24 KiB
Newer Older
Ruben Anthony Gonzalez's avatar
Ruben Anthony Gonzalez committed
"""
These are ctf dependent functions.
They have to be aligned.
"""
from random import randint
Ruben Anthony Gonzalez's avatar
Ruben Anthony Gonzalez committed


MESSAGES = [
        "SUCCESS",
        "INVALID",
        "ALREADY_SUBMITTED",
        "ERROR"
]


# TODO: Change these values
# list of team ids
# Has to be byte string since wre looking through byte output (STDOUT)
flag_regex = b"flag{[A-Za-z0-9_.]+}"

exploit_dir = "exploits"
wait_between_runs = 10
# Number of exploit workers
proc_num = 4
# DB file name
db_file_path = "flags.db"
Ruben Anthony Gonzalez's avatar
Ruben Anthony Gonzalez committed

    # hackerdom
    # answ = requests.put("http://10.10.10.10/flags",
    #                     headers={
    #                         'X-Team-Token': "2_d8a4fe6d49b44459b0a73bfdeee7d60d"
    #                     },
    #                     data=json.dumps(flags)
    #                     )
    # # TODO
    # js = answ.json()[0]
    # print(js["msg"])
    # print(js)
    # assert (js['flag'] == flag)
    # if 'you already submitted this flag' in js["msg"]:
    #     return 2
    # return int(js["status"] != True)
    return [randint(0, len(MESSAGES) - 1) for _ in range(len(flags))]

Ruben Anthony Gonzalez's avatar
Ruben Anthony Gonzalez committed

def team_id_to_ip(team_id):
    """
    Somehow map team id to ip adress
    """
    return "10.13.37.{}".format(team_id)