Skip to content

Commit b68fde1

Browse files
committed
chore: update patches from latest commit [skip ci]
1 parent 9891183 commit b68fde1

File tree

112 files changed

+5724
-39
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+5724
-39
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
diff --git a/.github/workflows/create-patches.yml b/.github/workflows/create-patches.yml
2+
new file mode 100644
3+
index 0000000..ca1b632
4+
--- /dev/null
5+
+++ b/.github/workflows/create-patches.yml
6+
@@ -0,0 +1,43 @@
7+
+name: Create Patches
8+
+
9+
+on:
10+
+ push:
11+
+ branches: [ "cla" ]
12+
+
13+
+jobs:
14+
+ generate-patches:
15+
+ runs-on: ubuntu-latest
16+
+
17+
+ steps:
18+
+ - name: Checkout repository
19+
+ uses: actions/checkout@v4
20+
+ with:
21+
+ fetch-depth: 0
22+
+ ref: ${{ github.ref_name }}
23+
+
24+
+ - name: Install build dependencies
25+
+ run: sudo apt-get update && sudo apt-get install -y make
26+
+
27+
+ - name: Run make create-patch
28+
+ run: make create-patch
29+
+
30+
+ - name: Commit and push patch files
31+
+ run: |
32+
+ git config user.name "GitHub Actions"
33+
+ git config user.email "[email protected]"
34+
+
35+
+ if [ -n "$(git status --porcelain patches/)" ]; then
36+
+ git add patches/
37+
+ git commit -m "chore: update patches from latest commit [skip ci]"
38+
+ git push origin HEAD:${GITHUB_REF_NAME}
39+
+ else
40+
+ echo "No changes in patches/ to commit."
41+
+ fi
42+
+ env:
43+
+ GITHUB_REF_NAME: ${{ github.ref_name }}
44+
+
45+
+ - name: Upload patch files as artifact
46+
+ uses: actions/upload-artifact@v4
47+
+ with:
48+
+ name: patches
49+
+ path: patches/

patches/Makefile.patch

Lines changed: 51 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,75 @@
11
diff --git a/Makefile b/Makefile
2-
index e504646..f0e15dc 100644
2+
index e504646..a82b9dc 100644
33
--- a/Makefile
44
+++ b/Makefile
5-
@@ -19,6 +19,22 @@ versions:
5+
@@ -19,19 +19,63 @@ versions:
66
fi \
77
done
88

9+
-PATCH:=./name.patch
910
+create-patch:
1011
+ @mkdir -p patches
1112
+ @echo -e "\e[1;34m[+] Creating and splitting patch from branch 'cla' against 'main' (excluding patches/)...\e[0m"
1213
+ @git fetch origin main >/dev/null 2>&1
1314
+ @git diff origin/main...origin/cla -- . ':(exclude)patches/' | awk '\
15+
+ function flush(){ if (out) close(out); out=""; } \
1416
+ /^diff --git a\// { \
15-
+ if (out) close(out); \
16-
+ fname = $$3; \
17-
+ sub(/^a\//, "", fname); \
18-
+ gsub(/\//, "_", fname); \
17+
+ flush(); \
18+
+ fname = $$3; sub(/^a\//, "", fname); \
19+
+ dir = fname; sub(/\/[^/]*$$/, "", dir); \
20+
+ if (dir != "") system("mkdir -p patches/" dir); \
1921
+ out = "patches/" fname ".patch"; \
2022
+ } \
2123
+ { if (out) print > out } \
24+
+ END { flush() } \
2225
+ '
23-
+ @echo -e "\e[1;32m[+] Patch files saved to ./patches/\e[0m"
26+
+ @echo -e "\e[1;32m[+] Patch files saved under ./patches/ (mirroring source dirs)\e[0m"
27+
+
28+
+PATCH := ./name.patch
2429
+
25-
PATCH:=./name.patch
2630
patch:
27-
@if [ -f ${PATCH} ]; then \
28-
@@ -32,6 +48,16 @@ patch:
29-
echo -e "\e[1;31m[+] ${PATCH} file does not exist"; \
31+
- @if [ -f ${PATCH} ]; then \
32+
- for f in $(wildcard */) ; do \
33+
- if [[ -d "$$f" && -f "$$f/Makefile" ]]; then \
34+
- echo -e "\e[1;35m[+] Patching $$f with ${PATCH}\e[0m"; \
35+
- patch -d $$f --backup-if-mismatch -p2 < ${PATCH}; \
36+
- fi \
37+
- done \
38+
+ @patchfile="${PATCH}"; \
39+
+ if [ -f "$$patchfile" ]; then \
40+
+ # --- Derive target dir from patch path/name ---
41+
+ # If nested under patches/<dir>/..., use that <dir>.
42+
+ # Else, fall back to prefix before first "_" in filename.
43+
+ if [[ "$$patchfile" == patches/*/* ]]; then \
44+
+ tmp=$${patchfile#patches/}; \
45+
+ dir=$${tmp%%/*}; \
46+
+ else \
47+
+ base=$${patchfile##*/}; \
48+
+ base=$${base%.patch}; \
49+
+ dir=$${base%%_*}; \
50+
+ fi; \
51+
+ # --- Apply to the single matching dir ---
52+
+ if [[ -d "$$dir" && -f "$$dir/Makefile" ]]; then \
53+
+ echo -e "\e[1;35m[+] Patching $$dir with $$patchfile\e[0m"; \
54+
+ patch -d "$$dir" --backup-if-mismatch -p2 < "$$patchfile"; \
55+
+ else \
56+
+ echo -e "\e[1;31m[!] No matching directory '$$dir' (or missing $$dir/Makefile)\e[0m"; \
57+
+ exit 1; \
58+
+ fi; \
59+
else \
60+
- echo -e "\e[1;31m[+] ${PATCH} file does not exist"; \
61+
+ echo -e "\e[1;31m[!] ${PATCH} file does not exist\e[0m"; \
62+
+ exit 1; \
3063
fi
3164

3265
+patch-all:
33-
+ @for patchfile in patches/*.patch; do \
34-
+ for f in $(wildcard */); do \
35-
+ if [[ -d "$$f" && -f "$$f/Makefile" ]]; then \
36-
+ echo -e "\e[1;35m[+] Patching $$f with $$patchfile\e[0m"; \
37-
+ patch -d $$f --backup-if-mismatch -p2 < "$$patchfile"; \
38-
+ fi \
39-
+ done \
66+
+ @for dir in */; do \
67+
+ [[ -d "$$dir" && -f "$$dir/Makefile" && -d "patches/$$dir" ]] || continue; \
68+
+ for p in patches/"$$dir"*.patch; do \
69+
+ [[ -e "$$p" ]] || continue; \
70+
+ echo -e "\e[1;35m[+] Patching $$dir with $$p\e[0m"; \
71+
+ patch -d "$$dir" --backup-if-mismatch -p2 < "$$p"; \
72+
+ done; \
4073
+ done
4174
+
4275
test:

patches/README.md.patch

Lines changed: 57 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/README.md b/README.md
2-
index 49b3bba..d238898 100644
2+
index 49b3bba..461b6dc 100644
33
--- a/README.md
44
+++ b/README.md
55
@@ -1,4 +1,9 @@
@@ -13,15 +13,55 @@ index 49b3bba..d238898 100644
1313

1414
Preconfigured CTF challenge templates with sane defaults and an homogeneous
1515
interface. Instanced web, instanced qemu+ssh, jailed pwn, sagemath, and much
16-
@@ -22,7 +27,6 @@ limits? Quickly ssh into a VPS and run `make deploy-docker`. Problems? Run
17-
`make HOST=0.0.0.0`. Your infrastructure team will have an easier time fixing
18-
Kubernetes.
16+
@@ -31,26 +36,27 @@ with `make version`.
1917

20-
-Powered by [LosFuzzys](https://losfuzzys.net).
18+
| Name | Version |
19+
| :----------------------------- | :-----: |
20+
-| bash-jail-ubuntu24.04 | 1.0.0 |
21+
-| bash-nojail-ubuntu24.04 | 1.0.0 |
22+
-| flask-instanced-alpine3.21 | 1.0.0 |
23+
-| flask-nojail-alpine3.21 | 1.0.0 |
24+
-| offline | 1.0.0 |
25+
-| php-instanced-ubuntu24.04 | 1.0.0 |
26+
-| php-nojail-ubuntu24.04 | 1.0.0 |
27+
-| phpxss-nojail-ubuntu24.04 | 1.0.0 |
28+
-| pwn-jail-alpine3.21 | 1.0.0 |
29+
-| pwn-jail-ubuntu24.04 | 1.0.0 |
30+
-| pwn-nojail-alpine3.21 | 1.0.0 |
31+
-| pwn-nojail-ubuntu24.04 | 1.0.0 |
32+
-| pwn-qemu-kernel | 1.0.0 |
33+
-| python3.12-jail-alpine3.21 | 1.0.0 |
34+
-| python3.12-jail-ubuntu24.04 | 1.0.0 |
35+
-| python3.12-nojail-alpine3.21 | 1.0.0 |
36+
-| python3.12-nojail-ubuntu24.04 | 1.0.0 |
37+
-| rust-nojail-alpine3.21 | 1.0.0 |
38+
-| rust-nojail-ubuntu24.04 | 1.0.0 |
39+
-| sagemath-nojail-ubuntu22.04 | 1.0.0 |
40+
+| bash-jail-ubuntu24.04 | 1.0.1 |
41+
+| bash-nojail-ubuntu24.04 | 1.0.1 |
42+
+| flask-instanced-alpine3.21 | 1.0.1 |
43+
+| flask-nojail-alpine3.21 | 1.0.1 |
44+
+| offline | 1.0.1 |
45+
+| php-instanced-ubuntu24.04 | 1.0.1 |
46+
+| php-nojail-ubuntu24.04 | 1.0.1 |
47+
+| phpxss-nojail-ubuntu24.04 | 1.0.1 |
48+
+| pwn-jail-alpine3.21 | 1.0.1 |
49+
+| pwn-jail-debian12.11 | 1.0.1 |
50+
+| pwn-jail-ubuntu24.04 | 1.0.1 |
51+
+| pwn-nojail-alpine3.21 | 1.0.1 |
52+
+| pwn-nojail-ubuntu24.04 | 1.0.1 |
53+
+| pwn-qemu-kernel | 1.0.1 |
54+
+| python3.12-jail-alpine3.21 | 1.0.1 |
55+
+| python3.12-jail-ubuntu24.04 | 1.0.1 |
56+
+| python3.12-nojail-alpine3.21 | 1.0.1 |
57+
+| python3.12-nojail-ubuntu24.04 | 1.0.1 |
58+
+| rust-nojail-alpine3.21 | 1.0.1 |
59+
+| rust-nojail-ubuntu24.04 | 1.0.1 |
60+
+| sagemath-nojail-ubuntu22.04 | 1.0.1 |
61+
| solidity-nojail-debian11 | 0.0.1 |
2162

22-
## Versions
23-
24-
@@ -59,13 +63,12 @@ You can check for the latest versions within a script [here](https://raw.githubu
63+
You can check for the latest versions within a script [here](https://raw.githubusercontent.com/LosFuzzys/LosTemplates/refs/heads/main/.versions)
64+
@@ -59,13 +65,12 @@ You can check for the latest versions within a script [here](https://raw.githubu
2565

2666
### Challenge Author
2767

@@ -37,7 +77,7 @@ index 49b3bba..d238898 100644
3777
# Install podman or docker at your choice
3878
sudo apt install podman podman-docker
3979
```
40-
@@ -73,14 +76,14 @@ sudo apt install podman podman-docker
80+
@@ -73,14 +78,14 @@ sudo apt install podman podman-docker
4181
**Fedora**:
4282
```sh
4383
# Fedora 42
@@ -54,7 +94,13 @@ index 49b3bba..d238898 100644
5494
# Install podman or docker at your choice
5595
sudo pacman -S docker
5696
# If you prefer rootless docker, install it from AUR
57-
@@ -96,7 +99,7 @@ nix develop
97+
@@ -91,12 +96,12 @@ yay docker-rootless-extras
98+
**Nix**:
99+
100+
```sh
101+
-nix develop
102+
+nix-shell .
103+
```
58104

59105
### Players
60106

@@ -63,7 +109,7 @@ index 49b3bba..d238898 100644
63109

64110
For Windows: `docker` (WSL2 backend) and `tar` support.
65111

66-
@@ -107,6 +110,9 @@ template folder. This `Makefile` holds metadata configuration that authors can
112+
@@ -107,6 +112,9 @@ template folder. This `Makefile` holds metadata configuration that authors can
67113
change. The name of the challenge will be the name of the folder holding the
68114
`Makefile` (by default).
69115

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
diff --git a/bash-jail-ubuntu24.04/Makefile b/bash-jail-ubuntu24.04/Makefile
2+
index 2d34021..fb5b389 100644
3+
--- a/bash-jail-ubuntu24.04/Makefile
4+
+++ b/bash-jail-ubuntu24.04/Makefile
5+
@@ -13,18 +13,17 @@ kill: ckill skill
6+
# CTFd Configuration #
7+
######################
8+
9+
-export FULLNAME = CTFd challenge name
10+
-export AUTHOR = LosFuzzys
11+
-export CATEGORY = pwn
12+
-define DESC
13+
-This is a multiline challenge description!
14+
+$(shell yq ".flag" Manifest.yaml | tr -d '\n' > challenge/flag.txt)
15+
16+
-Feel free to add more lines.
17+
-endef
18+
-export DESC
19+
-export FLAG = $(shell cat challenge/flag.txt)
20+
-export FAKE_FLAG = $(shell cat dist/flag.txt)
21+
-export TAGS = tag1, tag2, tag with space
22+
+export FULLNAME := $(shell yq -o yaml ".name" Manifest.yaml)
23+
+export DESC := $(shell yq -o yaml ".description" Manifest.yaml | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/<br>/g')
24+
+
25+
+# Config for CTFd
26+
+export AUTHOR := $(shell yq -o yaml ".author.name" Manifest.yaml)
27+
+export CATEGORY := $(shell yq -o yaml ".category" Manifest.yaml)
28+
+export FLAG := $(shell cat challenge/flag.txt)
29+
+export FAKE_FLAG := $(shell cat dist/flag.txt)
30+
+export TAGS := $(shell yq -o=tsv '.tags | join(",")' Manifest.yaml)
31+
32+
############################
33+
# Deployment Configuration #
34+
@@ -47,7 +46,7 @@ export NAME=$(shell echo ${UNCLEAN_NAME} | tr "[:upper:]" "[:lower:]")
35+
# Major: Big features & breakage of interfaces (in sync)
36+
# Minor: Small functionality changes w/ backward compatibility (in sync)
37+
# Patch: Small fixes specific to this template (not in sync)
38+
-export _VERSION = 1.0.0
39+
+export _VERSION = 1.0.1
40+
export _TEMPLATE = bash-jail-ubuntu24.04
41+
42+
########################
43+
@@ -154,9 +153,9 @@ define run_check
44+
RETVAL=$$? ; \
45+
exec 3>&- ; \
46+
echo -e "\e[1;36m<<<<<<<<<<<<<< END $$(date +'%H:%M:%S')\e[0m"; \
47+
- printf "$$O" | grep ${FLAG} > /dev/null 2>&1 && \
48+
+ printf "$$O" | grep -F -q -- "${FLAG}" > /dev/null 2>&1 && \
49+
echo -e "\033[1;32m[+] Real flag found: ${FLAG}\033[0;0m" || ( \
50+
- printf "$$O" | grep ${FAKE_FLAG} > /dev/null 2>&1 && \
51+
+ printf "$$O" | grep -F -q -- "${FAKE_FLAG}" > /dev/null 2>&1 && \
52+
echo -e "\033[1;32m[+] Fake flag found: ${FAKE_FLAG}\033[0;0m" \
53+
|| ([[ "$$RETVAL" -eq "0" ]] && \
54+
echo -e "\033[1;31m[!] Flag not found\033[0;0m"; exit 1))
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
diff --git a/bash-jail-ubuntu24.04/Manifest.yaml b/bash-jail-ubuntu24.04/Manifest.yaml
2+
new file mode 100644
3+
index 0000000..0f99a41
4+
--- /dev/null
5+
+++ b/bash-jail-ubuntu24.04/Manifest.yaml
6+
@@ -0,0 +1,45 @@
7+
+# The name must match the following regex:
8+
+# ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
9+
+name: ctfd-challenge-name
10+
+
11+
+display_name: "CTFd challenge name"
12+
+
13+
+category: misc
14+
+
15+
+# Tags for CTFd
16+
+tags: []
17+
+
18+
+author:
19+
+ name: CTFd author
20+
+ # The email is ignored in gctf & legacy-kdctf
21+
+ email: ""
22+
+
23+
+# This deployment-information is only relevant for yctf
24+
+points:
25+
+ initial: 550
26+
+ decay: 50
27+
+ minimum: 100
28+
+ function: linear
29+
+
30+
+# This deployment-information is only relevant for yctf
31+
+deployment:
32+
+ ports: []
33+
+ web: false
34+
+ compose: false
35+
+ privileged: true
36+
+
37+
+flag: flag{REAL_REAL_REAL_REAL_REAL_REAL}
38+
+
39+
+# The description can be written as block-content, all line breaks are
40+
+# being retained
41+
+# https://yaml.org/spec/1.2.2/#23-scalars
42+
+description: |
43+
+ Description
44+
+
45+
+# The build-flag is only relevant for yctf
46+
+# It indicates if a container needs to be build (false for offline-challenges)
47+
+build: true
48+
+
49+
+# The check-flag is only relevant for yctf
50+
+# If a solvescript is present, it is being used to test the challenge
51+
+check: false
52+
\ No newline at end of file

0 commit comments

Comments
 (0)