Skip to content

Commit

Permalink
bump
Browse files Browse the repository at this point in the history
  • Loading branch information
zardus committed Dec 18, 2024
1 parent 30a5475 commit 1fc9e83
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
27 changes: 21 additions & 6 deletions pwnshop/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ def f_with_challenge(args):
return f(args, challenges)
return f_with_challenge

@with_challenges
def handle_run(args, challenges):
if args.debug_output:
pwnlib.context.context.log_level = "DEBUG"
challenge = challenges[0]
challenge.render()
challenge.build()
os.chdir(challenge.work_dir)
with challenge.run_challenge() as r:
if challenge.hostname != "localhost":
print("PWNSHOP HOSTNAME:", challenge.hostname)
r.wait()

@with_challenges
def handle_render(args, challenges):
for challenge in challenges:
Expand Down Expand Up @@ -258,6 +271,7 @@ def main():
command_build = commands.add_parser("build", help="build the binary code of a challenge")
command_verify = commands.add_parser("verify", help="verify the functionality of a challenge")
command_apply = commands.add_parser("apply", help="parse a yaml and generate the defined challenges")
command_run = commands.add_parser("run", help="run a challenge")

command_render.add_argument(
"--line-numbers",
Expand Down Expand Up @@ -349,11 +363,12 @@ def main():
default=os.environ.get("BUILD_IMAGE", None)
)

command_verify.add_argument(
"--verify-image",
help="Docker image to use for verification",
default=os.environ.get("VERIFY_IMAGE", None)
)
for command in [ command_verify, command_run ]:
command.add_argument(
"--verify-image",
help="Docker image to use for verification",
default=os.environ.get("VERIFY_IMAGE", None)
)


# where to write
Expand Down Expand Up @@ -405,7 +420,7 @@ def main():
)

# common to all single-challenge commands
for subparser in [ command_render, command_build, command_verify, command_apply ]:
for subparser in [ command_render, command_build, command_verify, command_apply, command_run ]:
subparser.add_argument("challenges", help="the challenges, as multiple ChallengeClassName or ModuleName:level_number. Default: all challenges.", nargs="*")

parser.epilog = f"""Commands usage:\n\t{command_render.format_usage()}\t{command_build.format_usage()}\t{command_verify.format_usage()}"""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name="pwnshop",
version="7.7",
version="7.8",
python_requires=">=3.8",
packages=packages,
install_requires=["jinja2==3.0.3", "nbconvert==6.4.4", "asteval", "pyastyle", "pwntools", "pyyaml", "docker", "ezmp", "black"],
Expand Down

0 comments on commit 1fc9e83

Please sign in to comment.