Skip to content

Commit 7ee6503

Browse files
committed
Merge remote-tracking branch 'origin/develop' into develop
2 parents ba157a2 + 0ce3a53 commit 7ee6503

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ desired configuration in a file with the following format:
5757
```yaml
5858
ctfFramework: CTFd | FBCTF | RootTheBox
5959
juiceShopUrl: https://juice-shop.herokuapp.com
60-
ctfKey: https://raw.githubusercontent.com/bkimminich/juice-shop/master/ctf.key # can also be actual key instead URL
60+
ctfKey: https://raw.githubusercontent.com/bkimminich/juice-shop/master/ctf.key # can also be actual key or comma-separated list of keys (CTFd only) instead of URL
6161
countryMapping: https://raw.githubusercontent.com/bkimminich/juice-shop/master/config/fbctf.yml # ignored for CTFd and RootTheBox
6262
insertHints: none | free | paid # "paid" handled as "free" for CTFd
6363
insertHintUrls: none | free | paid # optional for FBCTF; "paid" handled as "free" for CTFd

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const questions = [
4848
{
4949
type: 'input',
5050
name: 'ctfKey',
51-
message: 'Secret key <or> URL to ctf.key file?',
51+
message: 'URL to ctf.key file <or> secret key <or> (CTFd only) comma-separated list of secret keys?',
5252
default: 'https://raw.githubusercontent.com/bkimminich/juice-shop/master/ctf.key'
5353
},
5454
{

lib/generators/ctfd.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ function createCtfdExport (challenges, { insertHints, insertHintUrls, insertHint
4040
}
4141
*/
4242

43+
// In the flags section of the returned data we iterate through the result of string splitting by comma, and compute the hash of the single flag key + challenge name.
44+
// Format expected is: challenge3,challenge description,category3,100,dynamic,visible,0,"flag1,flag2,flag3","tag1,tag2,tag3","hint1,hint2,hint3","{""initial"":100, ""minimum"":10, ""decay"":10}"
45+
// If we provide a single key with no commas, we do not incapsulate the output in a "" pair.
4346
return new Promise((resolve, reject) => {
4447
try {
4548
const data = []
@@ -55,7 +58,7 @@ function createCtfdExport (challenges, { insertHints, insertHintUrls, insertHint
5558
type: 'standard',
5659
state: 'visible',
5760
max_attempts: 0,
58-
flags: hmacSha1(ctfKey, challenge.name),
61+
flags: ctfKey.split(',').length === 1 ? hmacSha1(ctfKey, challenge.name) : `"${ctfKey.split(',').map(key => `${hmacSha1(key, challenge.name)}`).join(',')}"`,
5962
tags: challenge.tags ? `"${challenge.tags}"` : '',
6063
hints: insertChallengeHints(challenge),
6164
// hint_cost: insertChallengeHintCosts(challenge),

0 commit comments

Comments
 (0)