Skip to content

Commit 070164a

Browse files
author
Robert Quander
committed
Checker corrections from the second Testrun - ensure full compatibility with brainfuck flags
1 parent 735a36e commit 070164a

File tree

4 files changed

+49
-5
lines changed

4 files changed

+49
-5
lines changed

checker/src/checker.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import html
12
from enochecker3 import MumbleException
23
from httpx import AsyncClient, Response
34
import re
@@ -85,10 +86,13 @@ async def get_post(self, post_id: str) -> str:
8586
if resp.status_code != 200:
8687
raise MumbleException("Failed to retrieve post")
8788

88-
match = re.search(r'<!-- DEBUG:(.*?) -->', resp.text)
89-
assert match, "No debug comment found in HTML"
89+
match = re.search(r'<p>DEBUG:(.*?)</p>', resp.text)
90+
r=match.group(1)
91+
d=html.unescape(r)
92+
self.logger.debug(f"Extracted debug comment: {d}")
93+
assert d, "No debug comment found in HTML"
9094

91-
return match.group(1)
95+
return d
9296

9397

9498
@checker.putflag(0)
@@ -232,7 +236,7 @@ async def exploit(task: ExploitCheckerTaskMessage, db: ChainDB, searcher: FlagSe
232236
url = f"http://facepalm:4269/profile/{post_id}"
233237
resp = await client.get(url)
234238

235-
match = re.search(r'<!-- DEBUG:(.*?) -->', resp.text)
239+
match = re.search(r'<p>-- DEBUG:(.*?) xx </p>', resp.text)
236240
if not match:
237241
raise MumbleException("Flag not found in post")
238242

service/NUL

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
|1|mohmczZjmIfq4n6bz220ob+9J8E=|E9YzXBPrFI9XjLAkePwxdtf2Y5Y= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINB7KhUBtS18Xqc/B8aC2iwd229VbAx4ojWToQEgNSfl
2+
|1|nlJvuI718NwRlAOPx7n8m/64Ess=|HwupvTNp2S/CBvgUWY64pj/l9+k= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFeVV/jtkPZkOEH5UvUaW+cB5rh5Mf1yrCj+sjQ3NQzl
3+
|1|kArq92mZpfxz0lu7IUhHAa4HKjY=|8adkYFukoY0ZdO98cQPYNLBJMWc= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKXzxD5hthspDPquH7FuklOJFDlj4x/zAGoPezV1pcOW
4+
|1|V6xZH+Ky3gZ1uO8WifWfjUJyUH0=|k2fhuGSmggX0VHsG4e/H4153hKM= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG0ReBr7w3N09mfWTpB0gmg3G+HiummJ7XuqWucV4QPr
5+
|1|mxRbWiWHBhE5oa20WC7UkIvyMNM=|jhDmb/WZmxupCmWRzTFgQ9uw3FA= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJdejKNM5b5dC8rNZtiu44ZpzX2NA7cQpwkl0OBL7a4q
6+
|1|LXjIty5ciJEZclgf2qa7FevJvlc=|wougYpmcv49wLrWn7VBs+AXDKKs= ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMFrdLWX4T3Ji3ICrKQmopDgJI6jIwMIgzkDT2FqK4Ak

service/README_Before_playing.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Very important info for repairing
2+
3+
Hey, service author here.
4+
If you fix the service, don't try to build on the VMs - swift loves to compile stuff, and it could take upwards of **5000 seconds** that the service is down and you lose flags.
5+
6+
However, you can:
7+
8+
Build and compress the image locally (~2-5 min):
9+
```
10+
docker save -o facepalm.tar facepalm:latest
11+
```
12+
13+
scp it to the service
14+
```
15+
scp facepalm.tar vulnbox:/path/to/whereever
16+
```
17+
18+
Then stop and rebuild the service from the file (~5sec)
19+
```
20+
docker stop facepalm
21+
docker rm facepalm
22+
```
23+
24+
(if you also wanna remove the image to be sure you run the corrected version: ```docker images | grep facepalm``` and then ```docker rmi facepalm:latest```)
25+
26+
Simply load the images from the tar you just compiled:
27+
```
28+
docker load -i /path/to/whereever/facepalm.tar
29+
```
30+
31+
And then restart the container:
32+
```
33+
docker compose up -d
34+
```

service/Sources/App/routes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ app.post("register") { req async throws -> Response in
589589
</head>
590590
<body>
591591
<p>\(post.posterName)'s Post</p>
592-
<!-- DEBUG:\(text) -->
592+
<p>DEBUG:\(text)</p>
593593
<p>This page is currently broken</p>
594594
</body></html>
595595
"""

0 commit comments

Comments
 (0)