Updated challenges showing off dojo features

This commit is contained in:
Connor Nelson
2023-02-01 12:20:34 -07:00
parent abc2ab7c7d
commit f553033b3b
29 changed files with 172 additions and 15 deletions
+17
View File
@@ -0,0 +1,17 @@
# world
## mars
This challenge is named `mars`, and is located within module `world`.
When users start this challenge, their environment will have:
- `/flag`
- `/challenge/orbit`
- `/challenge/planets.txt`
In this challenge, `orbit` reads in the flag and seeds random off of it.
While this is a challenge-specific detail, it is a broadly useful idea.
It allows for the challenge's behavior to be dynamically dependent on the flag.
This offers a similar paradigm to instanced challenge files.
However, it is dynamically instanced, rather than statically instanced.
Statically instanced values may be accessed by a student, while dynamically instanced values may not be (since they are dependent on the flag).
Which style is appropriate depends on the specifics of the challenge.
+15
View File
@@ -0,0 +1,15 @@
#!/opt/pwn.college/python
import pathlib
import random
with open("/flag") as f:
random.seed(f.read())
planets = (pathlib.Path(__file__).parent / "planets.txt").read_text().strip().splitlines()
print("This is a flag-seeded random number: {}".format(random.randint(0, 1000)))
print(random.choice(planets))
with open("/flag") as f:
print(f.read())
+1
View File
@@ -0,0 +1 @@
../planets.txt