summaryrefslogtreecommitdiffstats
path: root/iv/orodja/napad/genconfig.sh
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2024-09-04 01:10:18 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2024-09-04 01:10:18 +0200
commit5a21bf8a591721b2e55927902309daf73248be84 (patch)
treefbf924e0e57a6f084a3a054c2512e75df8af7bea /iv/orodja/napad/genconfig.sh
parentmaking submission safe again ): separating rce to another process (diff)
downloadr-5a21bf8a591721b2e55927902309daf73248be84.tar
r-5a21bf8a591721b2e55927902309daf73248be84.tar.gz
r-5a21bf8a591721b2e55927902309daf73248be84.tar.bz2
r-5a21bf8a591721b2e55927902309daf73248be84.tar.lz
r-5a21bf8a591721b2e55927902309daf73248be84.tar.xz
r-5a21bf8a591721b2e55927902309daf73248be84.tar.zst
r-5a21bf8a591721b2e55927902309daf73248be84.zip
Diffstat (limited to '')
-rwxr-xr-x[-rw-r--r--]iv/orodja/napad/genconfig.sh (renamed from iv/orodja/napad/config)30
1 files changed, 24 insertions, 6 deletions
diff --git a/iv/orodja/napad/config b/iv/orodja/napad/genconfig.sh
index dc165ce..825da18 100644..100755
--- a/iv/orodja/napad/config
+++ b/iv/orodja/napad/genconfig.sh
@@ -1,4 +1,14 @@
-# Common config for exploit.sh and submission.py.
+#!/bin/bash
+set -xeuo pipefail
+statusresp=`curl --fail-with-body --no-progress-meter https://ad.ecsc2024.it/api/status`
+starttime=`jq --raw-output .start <<<"$statusresp"`
+roundtime=`jq --raw-output .roundTime <<<"$statusresp"`
+team_names=`jq --raw-output .teams.[].shortname <<<"$statusresp" | tr $'\n' ' '`
+team_numbers=`jq --raw-output .teams.[].id <<<"$statusresp" | tr $'\n' ' '`
+services=`jq --raw-output .services.[].shortname <<<"$statusresp" | tr $'\n' ' '`
+cat <<EOF
+# THIS CONFIG IS AUTOGENERATED BY genconfig.sh, edit config values there!
+# Common config for exploit.sh, submission.py and nadzor.py
# It is to be sourced. It only sets environment variables.
# ==========================
@@ -9,6 +19,9 @@ export SUBMISSION_PORT=21502
# ==========================
# ======= EXPLOIT.SH =======
+# Additional help text
+export EXPLOIT_ADDITIONAL_HELP_TEXT="Services: $services"
+
# This regex is used to grep -Eo flags from stdout of exploits before submitting them
export FLAG_REGEX_SEARCH="[A-Za-z0-9]{31}="
@@ -17,15 +30,16 @@ export SUBMISSION_HOST=localhost
### export SUBMISSION_HOST=k.4a.si
# Must be precise, not less than round duration. Used to calculate round id.
-export ROUND_DURATION=120
+export ROUND_DURATION=$roundtime
# When does the game start (in UTC). Used to calculate current round id.
-export GAME_START=2024-09-01T07:00:00
+export GAME_START=$starttime
# Team numbers to attack
-export GAME_TEAMS="2 69"
+export GAME_TEAMS="$team_numbers"
###export GAME_TEAMS={0..10}
-
+EOF
+cat <<'EOF'
# Flag IDs URL
game_flag_ids_url()
{
@@ -48,7 +62,7 @@ export GAME_NOP_TEAM=0
# For how many non-current rounds are flags valid at a time?
# It doesn't make sense for this to be less than 0.
# Setting to 0 means only the current round is valid.
-export GAME_VALID_ROUNDS=5
+export GAME_VALID_ROUNDS=4
# Function exploit.sh should call on errors.
# Args: service team pwd usr@pc message
@@ -94,3 +108,7 @@ export SUBMISSION_TEAM_TOKEN=e5152d70a4d18093cae8844f4e959cf1
# Where to bind to. Use SUBMISSION_PORT in common settings for port.
export SUBMISSION_BIND=::
+
+# ==========================
+# ======== NADZOR.PY =======
+EOF