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

Parameters
  • 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.

Returns

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

Doctest:

>>> 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']