Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bdd176b

Browse files
committed
minor fixes
1 parent 9b7f322 commit bdd176b

2 files changed

Lines changed: 17 additions & 18 deletions

File tree

misc/r8.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Description=r8 ctf system
44
[Service]
55
Type=simple
66
ExecStart=/root/venv/bin/r8 run
7-
WorkingDirectory=/root/r8
7+
WorkingDirectory=/root
88
Restart=always
99

1010
[Install]

r8/challenge.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import asyncio
33
import functools
44
import inspect
5-
import re
65
import time
76
import traceback
87
from pathlib import Path
@@ -62,7 +61,7 @@ async def visible(self, user: str) -> bool:
6261

6362
@property
6463
def active(self) -> bool:
65-
"""`True` if the challenge is currently active, `False` otherwise."""
64+
"""`True` if the challenge is currently active, `False` otherwise (read-only)."""
6665
t_start, t_stop = self._active_times()
6766
return t_start <= time.time() <= t_stop
6867

@@ -87,7 +86,7 @@ def args(self) -> str:
8786
async def start(self) -> None:
8887
"""
8988
Called when the challenge is started,
90-
can be used to e.g. start additional servers.
89+
can be used to start additional services for example.
9190
9291
Note that challenge instances are always started immediately when running r8,
9392
independent of when the challenge will be active. This makes sure that there
@@ -110,12 +109,12 @@ def echo(self, message: str, err: bool = False) -> None:
110109
r8.echo(self.id, message, err)
111110

112111
def log(
113-
self,
114-
ip: r8.util.THasIP,
115-
type: str,
116-
data: Optional[str] = None,
117-
*,
118-
uid: Optional[str] = None
112+
self,
113+
ip: r8.util.THasIP,
114+
type: str,
115+
data: Optional[str] = None,
116+
*,
117+
uid: Optional[str] = None
119118
) -> None:
120119
"""
121120
Log an event for the current challenge.
@@ -124,13 +123,13 @@ def log(
124123
r8.log(ip, type, data, uid=uid, cid=self.id)
125124

126125
def log_and_create_flag(
127-
self,
128-
ip: r8.util.THasIP,
129-
user: Optional[str] = None,
130-
*,
131-
max_submissions: int = 1,
132-
flag: Optional[str] = None,
133-
challenge: Optional[str] = None,
126+
self,
127+
ip: r8.util.THasIP,
128+
user: Optional[str] = None,
129+
*,
130+
max_submissions: int = 1,
131+
flag: Optional[str] = None,
132+
challenge: Optional[str] = None,
134133
) -> str:
135134
"""
136135
Create a new flag that can be redeemed for this challenge and log its creation.
@@ -185,7 +184,7 @@ async def handle_get_request(self, user: str, request: web.Request) -> Union[
185184
return web.HTTPNotFound()
186185

187186
async def handle_post_request(self, user: str, request: web.Request) \
188-
-> Union[str, web.StreamResponse]:
187+
-> Union[str, web.StreamResponse]:
189188
"""
190189
HTTP POST requests to `/api/challenges/cid/*` land here. Serves 404s by default.
191190

0 commit comments

Comments
 (0)