From 66ea305d24b394f402b1c9296a9a7c8cbf2d7fcd Mon Sep 17 00:00:00 2001 From: Pranav Ramesh Date: Tue, 5 Mar 2024 23:54:15 -0500 Subject: [PATCH 01/12] [chore] fixed styling issues on edit assignment view --- src/pages/challenges/[id].jsx | 1802 ++++++++--------- .../groups/[group]/edit-assignment/[id].jsx | 4 +- 2 files changed, 903 insertions(+), 903 deletions(-) diff --git a/src/pages/challenges/[id].jsx b/src/pages/challenges/[id].jsx index 426485d3..b553533b 100644 --- a/src/pages/challenges/[id].jsx +++ b/src/pages/challenges/[id].jsx @@ -1,1012 +1,1012 @@ -import React, { use } from 'react'; -import { useRouter } from 'next/router'; -import Head from 'next/head'; -import { StandardNav } from '@/components/StandardNav'; -import { useEffect, useState, Fragment } from 'react'; -import { Transition, Dialog } from '@headlessui/react'; -import { - XMarkIcon, - HeartIcon, -} from '@heroicons/react/24/outline'; - -import { ToastContainer, toast } from 'react-toastify'; -import 'react-toastify/dist/ReactToastify.css'; - -import { getAuth } from 'firebase/auth'; -const auth = getAuth(); - -import { Footer } from '@/components/Footer'; -import { MarkdownViewer } from '@/components/MarkdownViewer'; -import { - CheckCircleIcon, - FlagIcon, -} from '@heroicons/react/20/solid'; -import request from '@/utils/request'; - -import api from '@/utils/terminal-api'; - -export default function Challenge() { - const router = useRouter(); - const { id } = router.query; - - const NO_PLACE = 'Not placed'; - - const [challenge, setChallenge] = useState({}); - const [liked, setLiked] = useState(false); - const [likeCount, setLikeCount] = useState(0); - const [open, setOpen] = useState(false); - const [submissionMsg, setSubmissionMsg] = useState(false); - const [hintOpen, setHintOpen] = useState(false); - const [flag, setFlag] = useState(''); - const [comment, setComment] = useState(''); - const [comments, setComments] = useState([]); - const [leaderboards, setLeaderboards] = useState([ - NO_PLACE, - NO_PLACE, - NO_PLACE, - ]); - - const [award, setAward] = useState(''); - const [terminalUsername, setTerminalUsername] = useState('...'); - const [terminalPassword, setTerminalPassword] = useState('...'); - - const [terminalUrl, setTerminalUrl] = useState(''); - const [serviceName, setServiceName] = useState(''); - const [minutesRemaining, setMinutesRemaining] = useState(-1); - const [foundTerminal, setFoundTerminal] = useState(false); - const [fetchingTerminal, setFetchingTerminal] = useState(false); - - const [difficulty, setDifficulty] = useState(''); - const [alreadySolved, setAlreadySolved] = useState(false); - - const [progress, setProgress] = useState(0); - const [eta, setEta] = useState(15); - - // change eta by one every sec - useEffect(() => { - let interval; - - if (eta >= 0) { - interval = setInterval(() => { - setEta((prevEta) => prevEta - 1); - }, 1000); // Update every 1 second - } + import React, { use } from 'react'; + import { useRouter } from 'next/router'; + import Head from 'next/head'; + import { StandardNav } from '@/components/StandardNav'; + import { useEffect, useState, Fragment } from 'react'; + import { Transition, Dialog } from '@headlessui/react'; + import { + XMarkIcon, + HeartIcon, + } from '@heroicons/react/24/outline'; + + import { ToastContainer, toast } from 'react-toastify'; + import 'react-toastify/dist/ReactToastify.css'; + + import { getAuth } from 'firebase/auth'; + const auth = getAuth(); + + import { Footer } from '@/components/Footer'; + import { MarkdownViewer } from '@/components/MarkdownViewer'; + import { + CheckCircleIcon, + FlagIcon, + } from '@heroicons/react/20/solid'; + import request from '@/utils/request'; + + import api from '@/utils/terminal-api'; + + export default function Challenge() { + const router = useRouter(); + const { id } = router.query; + + const NO_PLACE = 'Not placed'; + + const [challenge, setChallenge] = useState({}); + const [liked, setLiked] = useState(false); + const [likeCount, setLikeCount] = useState(0); + const [open, setOpen] = useState(false); + const [submissionMsg, setSubmissionMsg] = useState(false); + const [hintOpen, setHintOpen] = useState(false); + const [flag, setFlag] = useState(''); + const [comment, setComment] = useState(''); + const [comments, setComments] = useState([]); + const [leaderboards, setLeaderboards] = useState([ + NO_PLACE, + NO_PLACE, + NO_PLACE, + ]); + + const [award, setAward] = useState(''); + const [terminalUsername, setTerminalUsername] = useState('...'); + const [terminalPassword, setTerminalPassword] = useState('...'); + + const [terminalUrl, setTerminalUrl] = useState(''); + const [serviceName, setServiceName] = useState(''); + const [minutesRemaining, setMinutesRemaining] = useState(-1); + const [foundTerminal, setFoundTerminal] = useState(false); + const [fetchingTerminal, setFetchingTerminal] = useState(false); + + const [difficulty, setDifficulty] = useState(''); + const [alreadySolved, setAlreadySolved] = useState(false); + + const [progress, setProgress] = useState(0); + const [eta, setEta] = useState(15); + + // change eta by one every sec + useEffect(() => { + let interval; + + if (eta >= 0) { + interval = setInterval(() => { + setEta((prevEta) => prevEta - 1); + }, 1000); // Update every 1 second + } - return () => { - clearInterval(interval); - }; - }, []); + return () => { + clearInterval(interval); + }; + }, []); - // console.log(challenge); + // console.log(challenge); - const loadBar = () => { - const interval = setInterval(() => { - setProgress((prevProgress) => { - const newProgress = prevProgress + 100 / (15 * 10); - if (newProgress >= 100) { - clearInterval(interval); - return 100; - } - return newProgress; - }); - }, 100); // Update every 100ms (15 seconds total for 0 to 100) + const loadBar = () => { + const interval = setInterval(() => { + setProgress((prevProgress) => { + const newProgress = prevProgress + 100 / (15 * 10); + if (newProgress >= 100) { + clearInterval(interval); + return 100; + } + return newProgress; + }); + }, 100); // Update every 100ms (15 seconds total for 0 to 100) - return () => { - clearInterval(interval); + return () => { + clearInterval(interval); + }; }; - }; - // Kshitij - const [hintMessages, setHintMessages] = useState([]); - const [hideHintButton, setHideHintButton] = useState(false); + // Kshitij + const [hintMessages, setHintMessages] = useState([]); + const [hideHintButton, setHideHintButton] = useState(false); - const [userData, setUserData] = useState({ - points: 0, - susername: 'Loading...', - spassword: 'Loading...', - }); + const [userData, setUserData] = useState({ + points: 0, + susername: 'Loading...', + spassword: 'Loading...', + }); - const getTerminalStatus = async (id) => { - setFetchingTerminal(true); - if(!foundTerminal) { - const isActive = await api.getStatus(id); - if(isActive) { + const getTerminalStatus = async (id) => { + setFetchingTerminal(true); + if (!foundTerminal) { + const isActive = await api.getStatus(id); + if (isActive) { - setFoundTerminal(true); - setFetchingTerminal(false); + setFoundTerminal(true); + setFetchingTerminal(false); - setTimeout(() => { - document.getElementById('termurl').classList.remove('absolute'); - document.getElementById('termurl').classList.remove('opacity-0'); - document.getElementById('terminalLoader').classList.add('hidden'); - }, 3000); + setTimeout(() => { + document.getElementById('termurl').classList.remove('absolute'); + document.getElementById('termurl').classList.remove('opacity-0'); + document.getElementById('terminalLoader').classList.add('hidden'); + }, 3000); + } else { + setTimeout(async () => { + await getTerminalStatus(id); + }, 3000); + } + } + }; + + + const fetchTerminal = async () => { + if (!challenge) return; + loadBar(); + const token = auth.currentUser.accessToken; + setFetchingTerminal(true); + const data = await api.checkUserTerminal(token, challenge.id); + if (data !== null) { + setPassword(data.password); + setServiceName(data.serviceName); + setTerminalUrl(data.url); + setUserName(data.userName); + setMinutesRemaining(data.minutesRemaining); + console.log('Terminal data ID:', data.id); + console.log('Terminal url:', data.url); + await getTerminalStatus(data.id); } else { - setTimeout(async () => { - await getTerminalStatus(id); - }, 3000); + await createTerminal(); } - } - }; - - - const fetchTerminal = async () => { - if(!challenge) return; - loadBar(); - const token = auth.currentUser.accessToken; - setFetchingTerminal(true); - const data = await api.checkUserTerminal(token, challenge.id); - if(data !== null) { - setPassword(data.password); - setServiceName(data.serviceName); - setTerminalUrl(data.url); - setUserName(data.userName); - setMinutesRemaining(data.minutesRemaining); - console.log('Terminal data ID:', data.id); - console.log('Terminal url:', data.url); - await getTerminalStatus(data.id); - } else { - await createTerminal(); - } - }; - - const createTerminal = async () => { - if(!challenge) return; - setFetchingTerminal(true); - const token = auth.currentUser.accessToken; - const data = await api.buildTerminal(challenge, token); - if(data) { - setPassword(data.password); - setServiceName(data.serviceName); - setTerminalUrl(data.url); - setUserName(data.userName); - setMinutesRemaining(data.minutesRemaining); - await getTerminalStatus(data.id); - } else { - toast.error("Unable to create the terminal, please refresh the page and try again"); - setFetchingTerminal(false); - } - }; - - const getChallengeData = async () => { - const endPoint = process.env.NEXT_PUBLIC_API_URL + '/challenges/' + id; - const result = await request(endPoint, 'GET', null); - const { difficulty } = result.body; - setChallenge(result.body); - setDifficulty(difficulty); - }; - - const fetchLikeUrl = async () => { - try { - const userLikesUrl = localStorage.getItem('userLikesUrl'); - const requestOptions = { - method: 'GET', - headers: { - 'Content-Type': 'application/json', - }, - credentials: 'include' - }; - const response = await fetch(userLikesUrl, requestOptions); - const result = await response.json(); - const likes = result.filter((item) => { - return item.challenge.slug === slug; - }); - } catch (err) { - console.log(err); - } - }; - - useEffect(() => { - if (id) { - fetchLeaderboard(); - //fetchComments(); - if (challenge.upvotes) { - setLikeCount(challenge.upvotes); - } - fetchLikeUrl(); - getChallengeData(); - } - const award = localStorage.getItem('award'); - if (award) { - setAward(award); - } - }, [id]); - - const fetchSolvedUsers = async () => { - try { - const endPoint = - process.env.NEXT_PUBLIC_API_URL + - '/challenges/' + - id + - '/completed-users'; - const requestOptions = { - method: 'GET', - headers: { - 'Content-Type': 'application/json', - }, - credentials: 'include' - }; - const response = await fetch(endPoint, requestOptions); - const result = await response.json(); + }; + + const createTerminal = async () => { + if (!challenge) return; + setFetchingTerminal(true); + const token = auth.currentUser.accessToken; + const data = await api.buildTerminal(challenge, token); + if (data) { + setPassword(data.password); + setServiceName(data.serviceName); + setTerminalUrl(data.url); + setUserName(data.userName); + setMinutesRemaining(data.minutesRemaining); + await getTerminalStatus(data.id); + } else { + toast.error("Unable to create the terminal, please refresh the page and try again"); + setFetchingTerminal(false); + } + }; + + const getChallengeData = async () => { + const endPoint = process.env.NEXT_PUBLIC_API_URL + '/challenges/' + id; + const result = await request(endPoint, 'GET', null); + const { difficulty } = result.body; + setChallenge(result.body); + setDifficulty(difficulty); + }; - if (result != null) { - const user = result.users.filter((user) => { - return user.username === localStorage.getItem('username'); + const fetchLikeUrl = async () => { + try { + const userLikesUrl = localStorage.getItem('userLikesUrl'); + const requestOptions = { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + credentials: 'include' + }; + const response = await fetch(userLikesUrl, requestOptions); + const result = await response.json(); + const likes = result.filter((item) => { + return item.challenge.slug === slug; }); + } catch (err) { + console.log(err); + } + }; - if (user.length) { - setAlreadySolved(true); - console.log('Already solved'); + useEffect(() => { + if (id) { + fetchLeaderboard(); + //fetchComments(); + if (challenge.upvotes) { + setLikeCount(challenge.upvotes); } + fetchLikeUrl(); + getChallengeData(); } - } catch (error) { - console.log(error); - } - }; - - const submitFlag = async () => { - const slug = challenge.slug; - // console.log(flag.length); - - if (!flag) { - document - .getElementById('enteredFlag') - .classList.remove('border-gray-700'); - document.getElementById('enteredFlag').classList.add('border-red-600'); - document.getElementById('enterFlagBTN').innerHTML = 'Submit Flag'; + const award = localStorage.getItem('award'); + if (award) { + setAward(award); + } + }, [id]); - setTimeout(function () { - document - .getElementById('enteredFlag') - .classList.remove('border-red-600'); - }, 2000); - } else { + const fetchSolvedUsers = async () => { try { const endPoint = process.env.NEXT_PUBLIC_API_URL + '/challenges/' + id + - '/submissions'; + '/completed-users'; const requestOptions = { - method: 'POST', + method: 'GET', headers: { 'Content-Type': 'application/json', }, - credentials: 'include', - body: JSON.stringify({ - keyword: flag, - }), + credentials: 'include' }; const response = await fetch(endPoint, requestOptions); - console.log(await response.json()); - const { success, incorrect, error } = await response.json(); + const result = await response.json(); + if (result != null) { + const user = result.users.filter((user) => { + return user.username === localStorage.getItem('username'); + }); - if (error) { - document.getElementById('enterFlagBTN').innerHTML = 'Submit Flag'; - setSubmissionMsg('error'); - setOpen(true); - } else if (success) { - document - .getElementById('enteredFlag') - .classList.add('border-green-600'); - document.getElementById('enterFlagBTN').innerHTML = 'Submit Flag'; - setSubmissionMsg('success'); - setOpen(true); - - if (!alreadySolved) { - try { - const endPoint = - process.env.NEXT_PUBLIC_API_URL + - '/users/' + - localStorage.getItem('username') + - '/complete-challenge/' + - id + - '/' + - difficulty; - const response = await request(endPoint, "POST", {keyword: flag}); - } catch (err) { - console.log(err); - } + if (user.length) { + setAlreadySolved(true); + console.log('Already solved'); } + } + } catch (error) { + console.log(error); + } + }; - setTimeout(function () { - document - .getElementById('enteredFlag') - .classList.remove('border-green-600'); - }, 2000); - } else { + const submitFlag = async () => { + const slug = challenge.slug; + // console.log(flag.length); + + if (!flag) { + document + .getElementById('enteredFlag') + .classList.remove('border-gray-700'); + document.getElementById('enteredFlag').classList.add('border-red-600'); + document.getElementById('enterFlagBTN').innerHTML = 'Submit Flag'; + + setTimeout(function () { document .getElementById('enteredFlag') - .classList.add('border-red-600'); - document.getElementById('enterFlagBTN').innerHTML = 'Submit Flag'; - setSubmissionMsg('incorrect'); - setOpen(true); + .classList.remove('border-red-600'); + }, 2000); + } else { + try { + const endPoint = + process.env.NEXT_PUBLIC_API_URL + + '/challenges/' + + id + + '/submissions'; + const requestOptions = { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + credentials: 'include', + body: JSON.stringify({ + keyword: flag, + }), + }; + const response = await fetch(endPoint, requestOptions); + console.log(await response.json()); + const { success, incorrect, error } = await response.json(); + + + if (error) { + document.getElementById('enterFlagBTN').innerHTML = 'Submit Flag'; + setSubmissionMsg('error'); + setOpen(true); + } else if (success) { + document + .getElementById('enteredFlag') + .classList.add('border-green-600'); + document.getElementById('enterFlagBTN').innerHTML = 'Submit Flag'; + setSubmissionMsg('success'); + setOpen(true); + + if (!alreadySolved) { + try { + const endPoint = + process.env.NEXT_PUBLIC_API_URL + + '/users/' + + localStorage.getItem('username') + + '/complete-challenge/' + + id + + '/' + + difficulty; + const response = await request(endPoint, "POST", { keyword: flag }); + } catch (err) { + console.log(err); + } + } - setTimeout(function () { + setTimeout(function () { + document + .getElementById('enteredFlag') + .classList.remove('border-green-600'); + }, 2000); + } else { document .getElementById('enteredFlag') - .classList.remove('border-red-600'); - }, 2000); + .classList.add('border-red-600'); + document.getElementById('enterFlagBTN').innerHTML = 'Submit Flag'; + setSubmissionMsg('incorrect'); + setOpen(true); + + setTimeout(function () { + document + .getElementById('enteredFlag') + .classList.remove('border-red-600'); + }, 2000); + } + } catch (err) { + console.log(err); } - } catch (err) { - console.log(err); } - } - }; - - const fetchComments = async () => { - try { - const url = process.env.NEXT_PUBLIC_API_URL + '/challenges/' + id + '/comments'; - const { result } = await request(url, 'GET', null); - if (result && result.length) { - setComments([...result]); + }; + + const fetchComments = async () => { + try { + const url = process.env.NEXT_PUBLIC_API_URL + '/challenges/' + id + '/comments'; + const { result } = await request(url, 'GET', null); + if (result && result.length) { + setComments([...result]); + } + } catch (error) { + console.log(error); } - } catch (error) { - console.log(error); - } - }; + }; - // Kshitij - async function fetchHints() { - try { - const endPoint = process.env.NEXT_PUBLIC_API_URL + '/challenges/' + id + '/hint'; - const result = await request(endPoint, 'GET', null); - updateHintMessage(result.hintMessage, result.order); - } catch (error) { - console.log(error); + // Kshitij + async function fetchHints() { + try { + const endPoint = process.env.NEXT_PUBLIC_API_URL + '/challenges/' + id + '/hint'; + const result = await request(endPoint, 'GET', null); + updateHintMessage(result.hintMessage, result.order); + } catch (error) { + console.log(error); + } } - } - // Kshitij - const updateHintMessage = (message, id) => { - setHintMessages((prevHints) => { - const newHints = [...prevHints]; - newHints[id] = message; - if (newHints.length === 3) { + // Kshitij + const updateHintMessage = (message, id) => { + setHintMessages((prevHints) => { + const newHints = [...prevHints]; + newHints[id] = message; + if (newHints.length === 3) { + setHideHintButton(true); + } + return newHints; + }); + }; + + // Kshitij + const handleButtonClick = () => { + if (hintMessages.length < 3) { + fetchHints(); + } + if (hintMessages.length === 3) { setHideHintButton(true); } - return newHints; - }); - }; - - // Kshitij - const handleButtonClick = () => { - if (hintMessages.length < 3) { - fetchHints(); - } - if (hintMessages.length === 3) { - setHideHintButton(true); - } - }; + }; - const onCommentReport = async () => { - alert( - 'Thank you for reporting this comment. Our moderation team will look into this.' - ); - // Call comment report API - }; + const onCommentReport = async () => { + alert( + 'Thank you for reporting this comment. Our moderation team will look into this.' + ); + // Call comment report API + }; - const fetchLeaderboard = async () => { - try { - const url = process.env.NEXT_PUBLIC_API_URL + '/challenges/' + id + '/leaderboard'; - const leaderboards = await request(url, 'GET', null); - const NO_PLACE = 'Not placed'; + const fetchLeaderboard = async () => { + try { + const url = process.env.NEXT_PUBLIC_API_URL + '/challenges/' + id + '/leaderboard'; + const leaderboards = await request(url, 'GET', null); + const NO_PLACE = 'Not placed'; - if (!leaderboards.length) return; + if (!leaderboards.length) return; - const user1 = leaderboards.filter((leaderboard) => { - return leaderboard.id == 5; - }); - const user2 = leaderboards.filter((leaderboard) => { - return leaderboard.id == 4; - }); - const user3 = leaderboards.filter((leaderboard) => { - return leaderboard.id == 3; - }); + const user1 = leaderboards.filter((leaderboard) => { + return leaderboard.id == 5; + }); + const user2 = leaderboards.filter((leaderboard) => { + return leaderboard.id == 4; + }); + const user3 = leaderboards.filter((leaderboard) => { + return leaderboard.id == 3; + }); - setLeaderboards([ - user1.length ? user1[0].username : NO_PLACE, - user2.length ? user2[0].username : NO_PLACE, - user3.length ? user3[0].username : NO_PLACE, - ]); - } catch (error) { - console.log(error); - } - }; + setLeaderboards([ + user1.length ? user1[0].username : NO_PLACE, + user2.length ? user2[0].username : NO_PLACE, + user3.length ? user3[0].username : NO_PLACE, + ]); + } catch (error) { + console.log(error); + } + }; - const submitComment = async () => { - const endPoint = process.env.NEXT_PUBLIC_API_URL + '/challenges/' + id + '/comments'; - const result = await request(endPoint, 'POST', {content: comment}); + const submitComment = async () => { + const endPoint = process.env.NEXT_PUBLIC_API_URL + '/challenges/' + id + '/comments'; + const result = await request(endPoint, 'POST', { content: comment }); - setComments([result, ...comments]); + setComments([result, ...comments]); - if (result.error) { - console.log('Error occured while adding the comment'); - } - }; - const commentChange = (event) => { - setComment(event.target.value); - }; - const flagChanged = (event) => { - setFlag(event.target.value); - }; - const likeChallenge = async () => { - console.log(liked); - if (!liked) { - const endPoint = - process.env.NEXT_PUBLIC_API_URL + '/challenges/' + id + '/like'; - const { error }= await request(endPoint, 'POST', {}); - if (error) { - alert(error); - } else { - setLikeCount(likeCount + 1); - setLiked(true); + if (result.error) { + console.log('Error occured while adding the comment'); } - } else { - const endPoint = process.env.NEXT_PUBLIC_API_URL + '/challenges/' + id + '/deletelike'; - const { error } = await request(endPoint, "POST", {}); - if (error) { - alert(error); + }; + const commentChange = (event) => { + setComment(event.target.value); + }; + const flagChanged = (event) => { + setFlag(event.target.value); + }; + const likeChallenge = async () => { + console.log(liked); + if (!liked) { + const endPoint = + process.env.NEXT_PUBLIC_API_URL + '/challenges/' + id + '/like'; + const { error } = await request(endPoint, 'POST', {}); + if (error) { + alert(error); + } else { + setLikeCount(likeCount + 1); + setLiked(true); + } } else { - setLikeCount(likeCount - 1); - setLiked(false); + const endPoint = process.env.NEXT_PUBLIC_API_URL + '/challenges/' + id + '/deletelike'; + const { error } = await request(endPoint, "POST", {}); + if (error) { + alert(error); + } else { + setLikeCount(likeCount - 1); + setLiked(false); + } } - } - }; - - return ( - <> - - {challenge ? challenge.title : ''} - CTFGuide - - -
-
- We'll - investigate this challenge and take appropriate action. -
- -
-
-

- {' '} - {challenge.title}{' '} -

-
-
-
-

Created by

- -

{challenge.creator}

-
-
-
- -
-
-
-

- {' '} - Challenge Description{' '} -

-
+ }; -
- - - -
+ return ( + <> + + {challenge ? challenge.title : ''} - CTFGuide + + +
+
+ We'll + investigate this challenge and take appropriate action.
- {/* ***************************************** */} - +
-
- +
+

+ {' '} + {challenge.title}{' '} +

-
-
-
-
-
- - - -
+
+
+

Created by

+ +

{challenge.creator}

-
-

Public terminals are temporarily unavaliable. Some challenges that require pre-configured enviroments may not be solvable.

-
-
-
-
-

- #1 +
+
+
+

+ {' '} + Challenge Description{' '}

-

{leaderboards[0]}

-
-
-
-

- #2 -

-

{leaderboards[1]}

+
+ + +
+ {/* ***************************************** */}
-
-

- #3 -

-

{leaderboards[2]}

+
+
-
-
-
- - {' '} - - {' '} - Login as{' '} - {terminalUsername} using - the password{' '} - {terminalPassword} -
- - Container will stop in: - - - { - window.location.reload(); - }} - className="ml-2 hidden text-red-500" - > - If you see a 404, click here. - +
+
+
+
+ + + +
+
-
- - {Math.round(progress)}% - -

{!fetchingTerminal ? "Launch Terminal" : "Launching Terminal"}

-
-
- +
+

Public terminals are temporarily unavaliable. Some challenges that require pre-configured enviroments may not be solvable.

+
+
+
+
+

+ #1 +

+

{leaderboards[0]}

-
-
+
+ +
+
+

+ #2 +

+

{leaderboards[1]}

+
- - Expected Time: {eta} seconds - +
+
+

+ #3 +

+

{leaderboards[2]}

+
-
+
+
+ + {' '} + + {' '} + Login as{' '} + {terminalUsername} using + the password{' '} + {terminalPassword} +
+ + Container will stop in: + + + { + window.location.reload(); + }} + className="ml-2 hidden text-red-500" + > + If you see a 404, click here. + +
+
- {foundTerminal ? ( - window.location.reload()} - className="absolute w-full bg-white opacity-0" +
- ) : ( - <> - )} - -

- {challenge && !fetchingTerminal && !foundTerminal && -
- - Launch Terminal + id="terminalLoader" + > + + {Math.round(progress)}% +

{!fetchingTerminal ? "Launch Terminal" : "Launching Terminal"}

+
+
+ +
+
+
+
+ + + Expected Time: {eta} seconds + +
+
- } -
-
-

Comments

- - - -

- Error posting comment! This could be because it was less than 5 - characters or greater than 250 characters.{' '} -

- {comments.map((message, index) => ( -
window.location.reload()} + className="absolute w-full bg-white opacity-0" + height="500" + id="termurl" + src={foundTerminal ? terminalUrl : ''} + > + ) : ( + <> + )} + +

+ {challenge && !fetchingTerminal && !foundTerminal && +
+ + Launch Terminal + +
+ } +
+
+

Comments

+ + +
- ))} + Post Comment + +

+ Error posting comment! This could be because it was less than 5 + characters or greater than 250 characters.{' '} +

+ {comments.map((message, index) => ( +
+

+ @{message.username} +

+

+ {message.content} +

+ + Report Comment + +

+
+ ))} +
-
- {/* ***************************************** */} -

- - -
- - - + {/* ***************************************** */} +
+ + +
+ + + - {/* This element is to trick the browser into centering the modal contents. */} - - -
-
-
- {submissionMsg == 'success' && ( - - - - )} - - {submissionMsg == 'incorrect' && ( -
+
+
+ {submissionMsg == 'success' && ( + + + + )} + + {submissionMsg == 'incorrect' && ( + + + + )} +
+
+ - - - )} -
-
- - {submissionMsg == 'success' - ? "Nice hackin', partner!" - : ''} - {submissionMsg == 'incorrect' - ? 'Submission incorrect!' - : ''} - {submissionMsg == 'error' ? 'Login to submit a flag' : ''} - -
-

{submissionMsg == 'success' - ? `You were awarded ${award} points.` + ? "Nice hackin', partner!" : ''} {submissionMsg == 'incorrect' - ? `Incorrect submission, no points awarded.` + ? 'Submission incorrect!' : ''} -

+ {submissionMsg == 'error' ? 'Login to submit a flag' : ''} + +
+

+ {submissionMsg == 'success' + ? `You were awarded ${award} points.` + : ''} + {submissionMsg == 'incorrect' + ? `Incorrect submission, no points awarded.` + : ''} +

+
+
+ + +
-
- -
+
+
+ + + +
+ +
+
+
+ - Back to Challenges - -
-
- -
-
-
- - - -
- -
-
-
- - -
-
-
- -

Hints

-
-
-
- -
-
-
-

- {' '} - On our main platform, each hint incurs a 10% penalty - and each submission a 3% penalty. -

-
-
-

- You - must be logged in to see hints! -

-
-
-
- {hintMessages ? ( -
- {hintMessages.map((hint, index) => ( -
-

- - Hint #{index + 1} - - {hint &&

{hint}

} -

-
- ))} -
+ +
+
+
+ +

Hints

+
+
+
- ) : ( -

- Oops, no hints for this challenge. -

- )} +
+

+ {' '} + On our main platform, each hint incurs a 10% penalty + and each submission a 3% penalty. +

+
+
+

+ You + must be logged in to see hints! +

+
+
+
+ {hintMessages ? ( +
+ {hintMessages.map((hint, index) => ( +
+

+ + Hint #{index + 1} + + {hint &&

{hint}

} +

+
+ ))} +
+ +
+
+ ) : ( +

+ Oops, no hints for this challenge. +

+ )} +
-
- - + + +
-
-
-
-

- ℹ We provide accessible environments for everyone to run cybersecurity - tools. Abuse and unnecessary computation is prohibited. -

- -