Skip to content

Commit

Permalink
handle timeouts during dockerized verification
Browse files Browse the repository at this point in the history
  • Loading branch information
zardus committed Nov 13, 2024
1 parent 5c47170 commit fd3dceb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pwnshop/challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,12 @@ def run_challenge(

if self._verify_container:
docker_cmd = "docker exec -u root -i".split()
for k,v in kwargs.get("env", {}).items():
for k,v in kwargs.pop("env", {}).items():
docker_cmd += [ "-e", f"{k}={v.decode() if type(v) is bytes else v}" ]
kwargs.pop("env", None)
docker_cmd += [ "-w", self.work_dir ]
docker_cmd.append(self._verify_container.name)
if alarm := kwargs.pop("alarm", None):
docker_cmd += [ "timeout", "-sALRM", str(alarm) ]
argv = docker_cmd + argv

with pwnlib.tubes.process.process(
Expand Down

0 comments on commit fd3dceb

Please sign in to comment.