Update challenges for simple challenge image
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
#!/opt/pwn.college/python
|
||||
#!/usr/bin/exec-suid -- /usr/local/bin/python -I
|
||||
|
||||
with open("/flag") as f:
|
||||
print(f.read())
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#!/opt/pwn.college/python
|
||||
#!/usr/bin/exec-suid -- /usr/local/bin/python -I
|
||||
|
||||
import pathlib
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#!/opt/pwn.college/python
|
||||
#!/usr/local/bin/python
|
||||
|
||||
import pathlib
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#!/opt/pwn.college/python
|
||||
#!/usr/bin/exec-suid -- /usr/local/bin/python -I
|
||||
|
||||
with open("/flag") as f:
|
||||
print(f.read())
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#!/opt/pwn.college/python
|
||||
#!/usr/bin/exec-suid -- /usr/local/bin/python -I
|
||||
|
||||
import pathlib
|
||||
import random
|
||||
|
||||
+5
-6
@@ -1,9 +1,8 @@
|
||||
#!/opt/pwn.college/python
|
||||
#!/usr/local/bin/python
|
||||
|
||||
import pathlib
|
||||
import random
|
||||
|
||||
import jinja2
|
||||
import string
|
||||
|
||||
with open("/flag") as f:
|
||||
random.seed(f.read())
|
||||
@@ -11,12 +10,12 @@ with open("/flag") as f:
|
||||
init_path = pathlib.Path(__file__)
|
||||
planets_path = (pathlib.Path(__file__).parent / "planets.txt")
|
||||
launch_path = (pathlib.Path(__file__).parent / "launch")
|
||||
launch_template_path = (pathlib.Path(__file__).parent / "launch.j2")
|
||||
launch_template_path = (pathlib.Path(__file__).parent / "launch.template")
|
||||
|
||||
planet = random.choice(planets_path.read_text().strip().splitlines())
|
||||
|
||||
template = jinja2.Template(launch_template_path)
|
||||
launch_path.write_text(template.render(planet=planet))
|
||||
template = string.Template(launch_template_path.read_text())
|
||||
launch_path.write_text(template.safe_substitute(planet=planet))
|
||||
|
||||
launch_template_path.unlink()
|
||||
planets_path.unlink()
|
||||
|
||||
@@ -9,9 +9,9 @@ When users start this challenge, their environment will have:
|
||||
- `/challenge/launch`
|
||||
|
||||
In this challenge, `takeoff` is a statically instanced file.
|
||||
There is also files `.init`, `planets.txt`, and `launch.j2` which students will never see.
|
||||
At run time, `.init` reads in `planets.txt` to construct `launch` from the templated file `launch.j2`.
|
||||
There is also files `.init`, `planets.txt`, and `launch.template` which students will never see.
|
||||
At run time, `.init` reads in `planets.txt` to construct `launch` from the templated file `launch.template`.
|
||||
This gives the challenge static instancing dependent upon the flag.
|
||||
In general, it is best to define a pool of static instanced files prior, so that this setup does not need to be performed at runtime every challenge start.
|
||||
However, for simple cases, this may be acceptable.
|
||||
It is important to note, however, that the results of these static instances are still dependent upon the flag, which means running the challenge with a different flag (e.g. with a practice flag), will fundamentally change the instance.
|
||||
It is important to note, however, that the results of these static instances are still dependent upon the flag, which means running the challenge with a different flag (e.g. with a practice flag), will change the behavior of the instance.
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/opt/pwn.college/python
|
||||
|
||||
import subprocess
|
||||
|
||||
subprocess.run(["/challenge/takeoff", "{{ planet }}"])
|
||||
|
||||
with open("/flag") as f:
|
||||
print(f.read())
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/exec-suid -- /usr/local/bin/python -I
|
||||
|
||||
import subprocess
|
||||
|
||||
subprocess.run(["/challenge/takeoff", "${planet}"])
|
||||
|
||||
with open("/flag") as f:
|
||||
print(f.read())
|
||||
Reference in New Issue
Block a user