UNPKG

juice-shop-ctf-cli

Version:

Capture-the-Flag (CTF) environment setup tools for OWASP Juice Shop

23 lines (19 loc) 694 B
/* * Copyright (c) 2016-2025 Bjoern Kimminich & the OWASP Juice Shop contributors. * SPDX-License-Identifier: MIT */ const Promise = require('bluebird') const request = require('request-promise') const yaml = Promise.promisifyAll(require('js-yaml')) function fetchChallenges (challengeMapFile, ignoreSslWarnings) { if (!challengeMapFile) { return Promise.resolve() } return request({ url: challengeMapFile, strictSSL: !ignoreSslWarnings }) .then((data) => yaml.loadAll(data)) .then((data) => data[0].ctf.countryMapping) .catch(({ message }) => { throw new Error('Failed to fetch country mapping from API! ' + message) }) } module.exports = fetchChallenges