Skip to content

Commit 2ed8005

Browse files
committed
chore(readme): update readme challenge
Signed-off-by: Gabriel Mocanu <gabi.mocanu98@gmail.com>
1 parent 585e802 commit 2ed8005

File tree

5 files changed

+65
-14
lines changed

5 files changed

+65
-14
lines changed

chapters/web-application-security/web-basics/drills/readme/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Web: Web basics and browser security model: Readme
44

55
## Description
66

7-
Get the flag from [readme](http://141.85.224.118:8092/readme/).
7+
Get the flag from [readme](http://141.85.224.101:30013/readme/).
88

99
Score: 25
1010

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
FROM php:7.2-apache AS builder
2+
3+
ARG FLAG
4+
COPY src/index.template.html /tmp/index.template.html
5+
RUN sed "s/__TEMPLATE__/${FLAG}/g" /tmp/index.template.html > /tmp/index.html
6+
17
FROM php:7.2-apache
28

3-
COPY /src /var/www/html/readme/
9+
COPY --from=builder /tmp/index.html /var/www/html/readme/index.html
Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
1-
EXTERNAL_PORT := 8092
1+
EXTERNAL_PORT := 30013
2+
INTERNAL_PORT := 80
23
IMG_NAME := sss-web-01_readme
3-
FILE_TEMPLATE := ../src/index.template.html
4-
FILE_SRC := ../src/index.html
4+
CONT_NAME := ${IMG_NAME}
5+
FLAG_FILE := ../flag
56

6-
include activity.mk
7+
ifndef CONT_NAME
8+
$(error You need to set a name for IMG_NAME variable(e.g. sss-web-01_activity-name).)
9+
endif
10+
11+
ifndef EXTERNAL_PORT
12+
$(error You need to set EXTERNAL_PORT variable.)
13+
endif
14+
15+
run: build
16+
docker run -d -p $(EXTERNAL_PORT):$(INTERNAL_PORT) --name $(CONT_NAME) -t $(IMG_NAME)
17+
18+
build:
19+
docker build --build-arg FLAG="$$(cat $(FLAG_FILE))" -t $(IMG_NAME) -f Dockerfile ..
20+
21+
stop:
22+
docker stop $(CONT_NAME)
23+
24+
clean: stop
25+
docker rm $(IMG_NAME)
26+
docker image rm $(IMG_NAME):latest
27+
28+
.PHONY: run build stop clean
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
namespace: web-basics
2+
3+
challenge:
4+
name: readme
5+
category: web-basics
6+
7+
image:
8+
repository: sss-web-01_readme
9+
tag: latest
10+
pullPolicy: IfNotPresent
11+
12+
replicaCount: 1
13+
14+
containerPort: 80
15+
16+
service:
17+
type: NodePort
18+
port: 80
19+
nodePort: 30013
20+
21+
healthCheck:
22+
enabled: true
23+
path: /readme/
24+
initialDelaySeconds: 5
25+
periodSeconds: 10

chapters/web-application-security/web-basics/drills/readme/sol/solution.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
#!/bin/bash
2-
PORT=8092
2+
PORT=30013
33

4-
if [[ $1 == "local" ]]
5-
then
6-
url='http://127.0.0.1:'$PORT
7-
elif [[ $1 == "remote" ]] && [[ -z $2 ]]
8-
then
9-
url='http://141.85.224.118:'$PORT
4+
if [[ $1 == "local" ]]; then
5+
url='http://127.0.0.1:'$PORT
6+
elif [[ $1 == "remote" ]] && [[ -z $2 ]]; then
7+
url='http://141.85.224.101:'$PORT
108
else
11-
url=$1':'$2
9+
url=$1':'$2
1210
fi
1311

1412
# Readme

0 commit comments

Comments
 (0)