Skip to content

Commit

Permalink
make flag printing optional
Browse files Browse the repository at this point in the history
  • Loading branch information
zardus committed Jan 31, 2024
1 parent 05f2fd1 commit 00f8d41
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions chio.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ def add_argument(parser, arg, **kwargs):
add_argument(_parser, "--challenge_depth", type=int, default=1, nargs='?', help="the complexity (in terms of nested expressions) of the arithmetic problems")
add_argument(_parser, "--password", type=str, nargs='?', help="the challenge will check for a hardcoded password over stdin")
add_argument(_parser, "--num_signals", type=int, nargs='?', help="the challenge will require the parent to send number of signals")
add_argument(_parser, "--reward", type=str, nargs='?', help="the challenge will output a reward file (e.g., /flag) if all the tests pass")

# remaining arguments
_parser.add_argument("old_args", nargs=argparse.REMAINDER)
Expand Down Expand Up @@ -520,6 +521,8 @@ def add_argument(parser, arg, **kwargs):
print(f"[FAIL] {_e}")
sys.exit(2)

print("[GOOD] Success! You have satisfied all execution requirements. Here is your flag:")
print(open("/flag").read())
print("[GOOD] Success! You have satisfied all execution requirements.")
if _args.reward:
print("Here is your flag:")
print(open(_args.reward).read()) #pylint:disable=unspecified-encoding,consider-using-with
sys.exit(0)

0 comments on commit 00f8d41

Please sign in to comment.