From 00f8d41fe0fd38ac64a6bfcaf2b7fc5590f3af88 Mon Sep 17 00:00:00 2001 From: Yan Date: Wed, 31 Jan 2024 14:20:25 -0700 Subject: [PATCH] make flag printing optional --- chio.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/chio.py b/chio.py index 452c699..4f3eedf 100755 --- a/chio.py +++ b/chio.py @@ -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) @@ -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)