File / Directory |
Mutation score |
# Killed |
# Survived |
# Timeout |
# No coverage |
# Runtime errors |
# Transpile errors |
Total detected |
Total undetected |
Total mutants | |
---|---|---|---|---|---|---|---|---|---|---|---|
generateData.js | 96.43 | 27 | 1 | 0 | 0 | 0 | 0 | 27 | 1 | 28 |
const Promise = require('bluebird')
const calculateScore = require('./calculateScore')
const calculateHintCost = require('./calculateHintCost')
const hmacSha1 = require('./hmac')
const options = require('./options')
function generateData (challenges, insertHints, insertHintUrls, ctfKey) 0{
}{
function insertChallenge (data, challenge) 1{
}{
const score = calculateScore(challenge.difficulty)
data.challenges['results'].push(
{
'id': challenge.id,
'name': challenge.name,
'description': 2challenge.description + ' (Difficulty Level: ' + challenge.difficulty - ')'3challenge.description + ' (Difficulty Level: ' - challenge.difficulty4challenge.description - ' (Difficulty Level: 'challenge.description + ' (Difficulty Level: ' + challenge.difficulty + ')',
'max_attempts': 0,
'value': score,
'category': challenge.category,
'type': 'standard',
'hidden': 5truefalse
}
)
}
function insertKey ({flagKeys}, {id, name}) 6{
}{
flagKeys['results'].push(
{
'id': id,
'chal': id,
'type': 'static',
'flag': hmacSha1(ctfKey, name),
'data': null
}
)
}
function insertTextHint ({hints}, challenge) 7{
}{
hints['results'].push(
{
'id': challenge.id,
'type': 0,
'chal': challenge.id,
'hint': challenge.hint,
'cost': calculateHintCost(challenge, insertHints)
}
)
}
function insertHintUrl ({hints}, challenge) 8{
}{
hints['results'].push(
{
'id': 910000 - challenge.id10000 + challenge.id,
'type': 0,
'chal': challenge.id,
'hint': challenge.hintUrl,
'cost': calculateHintCost(challenge, insertHintUrls)
}
)
}
return new Promise((resolve, reject) => 10{
}{
try 11{
}{
const data = {
challenges: {'results': []},
hints: {'results': []},
flagKeys: {'results': []}
}
for (const key in challenges) 12{
}{
if (13false14truechallenges.hasOwnProperty(key)) 15{
}{
const challenge = challenges[key]
insertChallenge(data, challenge)
insertKey(data, challenge)
if (16false17challenge.hint || insertHints !== options.noTextHints18truechallenge.hint && 19insertHints === options.noTextHintsinsertHints !== options.noTextHints) 20{
}{
insertTextHint(data, challenge)
}
if (21false22true23challenge.hintUrl || insertHintUrls !== options.noHintUrlschallenge.hintUrl && 24insertHintUrls === options.noHintUrlsinsertHintUrls !== options.noHintUrls) 25{
}{
insertHintUrl(data, challenge)
}
}
}
resolve(data)
} catch (error) 26{
}{
reject(new Error(27'Failed to generate challenge data! ' - error.message'Failed to generate challenge data! ' + error.message))
}
})
}
module.exports = generateData
# | Mutator | State | Location | Original | Replacement |
---|---|---|---|---|---|
0 | BlockStatement | Killed | 6 : 72 | {
...})
} |
{
} |
1 | BlockStatement | Killed | 7 : 45 | {
...
} |
{
} |
2 | BinaryOperator | Killed | 13 : 23 | . ...+ ')' |
. ...- ')' |
3 | BinaryOperator | Killed | 13 : 23 | . ... . |
. ... . |
4 | BinaryOperator | Killed | 13 : 23 | . ... : ' |
. ... : ' |
5 | BooleanSubstitution | Killed | 18 : 18 |
|
|
6 | BlockStatement | Killed | 23 : 46 | {
...
} |
{
} |
7 | BlockStatement | Killed | 35 : 47 | {
...
} |
{
} |
8 | BlockStatement | Killed | 47 : 46 | {
...
} |
{
} |
9 | BinaryOperator | Killed | 50 : 14 | + . |
- . |
10 | BlockStatement | Killed | 59 : 42 | {
...
} |
{
} |
11 | BlockStatement | Killed | 60 : 8 | {
... } |
{
} |
12 | BlockStatement | Killed | 66 : 36 | {
... } |
{
} |
13 | RemoveConditionals | Killed | 67 : 12 | . ...( ) |
|
14 | RemoveConditionals | Survived | 67 : 12 | . ...( ) |
|
15 | BlockStatement | Killed | 67 : 44 | {
... } |
{
} |
16 | RemoveConditionals | Killed | 71 : 14 | . ... . |
|
17 | LogicalOperator | Killed | 71 : 14 | . ... . |
. ... . |
18 | RemoveConditionals | Killed | 71 : 14 | . ... . |
|
19 | BinaryOperator | Killed | 71 : 32 | !== . |
=== . |
20 | BlockStatement | Killed | 71 : 69 | {
... } |
{
} |
21 | RemoveConditionals | Killed | 74 : 14 | . ... . |
|
22 | RemoveConditionals | Killed | 74 : 14 | . ... . |
|
23 | LogicalOperator | Killed | 74 : 14 | . ... . |
. ... . |
24 | BinaryOperator | Killed | 74 : 35 | !== . |
=== . |
25 | BlockStatement | Killed | 74 : 74 | {
... } |
{
} |
26 | BlockStatement | Killed | 80 : 20 | {
... } |
{
} |
27 | BinaryOperator | Killed | 81 : 23 | ' ... . |
' ... . |