pwnlib.flag — CTF Flag Management

pwnlib.flag.submit_flag(flag, exploit='unnamed-exploit', target='unknown-target', server='flag-submission-server', port='31337', team='unknown-team')[source]

Submits a flag to the game server

  • flag (str) – The flag to submit.

  • exploit (str) – Exploit identifier, optional

  • target (str) – Target identifier, optional

  • server (str) – Flag server host name, optional

  • port (int) – Flag server port, optional

  • team (str) – Team identifier, optional

Optional arguments are inferred from the environment, or omitted if none is set.


A string indicating the status of the key submission, or an error code.


>>> l = listen()
>>> _ = submit_flag('flag', server='localhost', port=l.lport)
>>> c = l.wait_for_connection()
>>> c.recvall().split()
[b'flag', b'unnamed-exploit', b'unknown-target', b'unknown-team']