Skip to content

Commit e27ffba

Browse files
committed
Update broken challenge
1 parent 23fee36 commit e27ffba

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

chal_types/challenge.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from .utils import WorkDir, get_open_port, logger
1111
from rich import print
1212
from rich.status import Status
13+
from rich.panel import Panel
1314

1415
yaml = ruamel.yaml.YAML()
1516

@@ -287,7 +288,7 @@ def create(self):
287288
chal_name=self.container_id, chal_run_options=''))
288289

289290
with WorkDir(self.host_dir), Status(f"[cyan] Building Challenge Host", spinner_style="cyan"):
290-
subprocess.check_output(['make', 'build'])
291+
process = subprocess.Popen(["make", "build"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, shell=True)
291292
print(f":confetti_ball: Built Challenge Host :confetti_ball:")
292293

293294

@@ -348,15 +349,12 @@ def build_docker(self, docker_dir):
348349
with WorkDir(docker_dir), Status(f"[cyan] Building Container for [bold]{self.name}[/bold]", spinner_style="cyan"):
349350
try:
350351
process = subprocess.Popen(["make", "build"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, shell=True)
351-
352-
# Read and print standard output line by line
353-
for line in process.stdout:
354-
print("Standard Output:", line, end="")
355-
356352
# Read and print standard error line by line
353+
out = ""
357354
for line in process.stderr:
358-
print("Standard Error:", line, end="")
355+
out += line
359356

357+
print(Panel(out, title="Build Output", border_style="cyan"))
360358
# Wait for the command to finish
361359
process.wait()
362360

@@ -365,9 +363,10 @@ def build_docker(self, docker_dir):
365363
print("Command completed successfully.")
366364
else:
367365
print(f"Command failed with exit code {process.returncode}")
366+
print(f":star2: Built Container for [bold]{self.name}[bold] :star2:")
368367
except Exception as e:
369368
print(f"An error occurred: {str(e)}")
370-
print(f":star2: Built Container for [bold]{self.name}[bold] :star2:")
369+
371370

372371
def get_value(self, key, required=True):
373372
if key not in self.config.keys():

chal_types/templates/facebook_django/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM python:2.7.17-buster as builder
22
ADD app /app
33
WORKDIR /app
4-
RUN pip install -r requirements.txt
4+
RUN pip install --no-build-isolation -r requirements.txt
55
RUN echo no | python manage.py syncdb
66
RUN python manage.py loaddata fixture.yaml
77

@@ -11,7 +11,7 @@ RUN mkdir /facebook
1111
WORKDIR /facebook
1212

1313
ADD app/requirements.txt /facebook/requirements.txt
14-
RUN pip install -r requirements.txt
14+
RUN pip install --no-build-isolation -r requirements.txt
1515

1616
ADD app/fb /facebook/fb
1717
ADD app/purepython /facebook/purepython

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ python main.py comp gen -f <relative path of the competition> -r <registry to pu
8383

8484
This command builds all of the Kubernetes files needed to deploy to a prexisting Kubernetes cluster. Upon completion, a graph of the challenges will be generated. The graph will be located at `evidence_graph.png` file in the competition folder.
8585

86-
Note: If you are using an M1 or M2 Macbook, you must put `export DOCKER_DEFAULT_PLATFORM=linux/amd64` in your `~/.zshrc` or `~/.bashrc` file. This is because the docker images must be built for linux/amd64 and not arm64.
86+
Note: If you are using an M1 or M2 Macbook, you must put `export DOCKER_DEFAULT_PLATFORM=linux/amd64` in your `~/.zshrc` or `~/.bashrc` file. This is because the docker images must be built for linux/amd64 and not arm64. Change this to `export DOCKER_DEFAULT_PLATFORM=linux/arm64` if you are running locally.
8787

8888
### Build and run a competition locally
8989

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def traverse(tree):
204204

205205
def create_ctfg(comp_folder, reg_url, admin_email, admin_password, local):
206206
ctfg_folder = join(comp_folder, 'ctfg')
207-
template_dir = join('competition_infra', 'ctfg_kube')
207+
template_dir = join('competition_infra', 'xctf_kube')
208208

209209
if os.path.exists(ctfg_folder):
210210
shutil.rmtree(ctfg_folder)

0 commit comments

Comments
 (0)