Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/components/groups/studentView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import request from '@/utils/request';
import StudentNav from '@/components/groups/studentNav';

const defaultImages = [
'https://robohash.org/pranavramesh',
'https://robohash.org/laphatize',
'https://robohash.org/stevewilkers',
'https://robohash.org/rickast',
'https://robohash.org/picoarc',
'https://robohash.org/jasoncalcanis',
'/DefaultKana.png',
'/CuteKana.png',
'/FancyKana.png',
'/ConfusedKana.png',
'/TophatKana.png',

];

export default function StudentView({ group }) {
Expand Down
140 changes: 69 additions & 71 deletions src/pages/assignments/[code]/submissions/[id].jsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default function id() {
});

setLoading(false);
} catch(err) {
} catch (err) {
console.log(err);
}
}
Expand All @@ -106,15 +106,15 @@ export default function id() {
async function getJson() {
try {
let jwt = getCookie();
if(!jwt) {
if (!jwt) {
console.log("User is not authenticated");
return;
}
const uid = user.uid;
let url = `${process.env.NEXT_PUBLIC_TERM_URL}get/json?jwtToken=${jwt}&assignmentID=${assignment.id}&uid=${uid}`;
let requestOptions = { method: 'GET' };
let response = await fetch(url, requestOptions);
if(!response.ok) {
if (!response.ok) {
console.log('Error fetching kana log');
return;
}
Expand All @@ -131,27 +131,27 @@ export default function id() {
result = await reader.read();
}

if(!data) {
if (!data) {
console.log('Error parsing kana log');
return;
}

let events = data.events;

for(let i = 0; i < events.length; i++) {
for (let i = 0; i < events.length; i++) {
events[i].seconds = convert(events[i].timestamp);
}

setKanaError(true);

setKanaLog(events); // []
} catch(err) {
} catch (err) {
console.log(err);
}
}

useEffect(() => {
if(!loading) {
if (!loading) {
getJson();
console.log("penguins")
console.log(router.query.key)
Expand Down Expand Up @@ -302,21 +302,14 @@ export default function id() {
<StandardNav />
<div className=" min-h-screen ">
<div className="mx-auto mt-4">
<a
href="/groups/122ctfguide"
className="hidden text-neutral-200 hover:text-neutral-500"
>
<i className="fas fa-long-arrow-alt-left"></i> Return Home
</a>

<div className="w-full bg-gradient-to-r from-blue-800 via-blue-900 to-blue-800 px-4 py-4 ">
<div className="mx-auto px-2">
<div className="flex">
<div>
<h1 className="text-3xl font-semibold text-white">
{
submission && assignment ? <span>{submission.user.firstName} {submission.user.lastName}'s Submission</span>
: <span>... Submission</span>
: <span>... Submission</span>
}
</h1>

Expand All @@ -333,11 +326,16 @@ export default function id() {
)}

</div>

<a
href="/groups/{classroom.id}/home"
className=" text-neutral-200 hover:text-neutral-500 ml-auto "
>
<i className="fas fa-long-arrow-alt-left text-white"></i> <span className='text-white'>Return Home</span>
</a>
<div className="ml-auto">
<div className="rounded-md bg-white px-3 py-1 text-center gap-y-0">
<h1 className="text-4xl font-bold text-blue-600 text-center mb-0 pb-0 ">
{ submission ? submission.grade : '00' }%
{submission ? submission.grade : '00'}%
</h1>
</div>
</div>
Expand Down Expand Up @@ -410,7 +408,7 @@ export default function id() {
>
<div className="absolute -start-1.5 mt-1.5 h-3 w-3 rounded-full border border-neutral-800 bg-blue-500 "></div>
<time className="mb-1 text-sm font-normal leading-none text-neutral-400 ">
{item.timestamp}
{item.timestamp}
</time>
<h3 className="text-md font-semibold text-blue-400 ">
{item.header}
Expand Down Expand Up @@ -442,61 +440,61 @@ export default function id() {


<Transition.Root show={open} as={Fragment}>
<Dialog as="div" className="relative z-10" onClose={setOpen}>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<div className="fixed inset-0 bg-black bg-opacity-75 transition-opacity" />
</Transition.Child>

<div className="fixed inset-0 z-10 w-screen overflow-y-auto">
<div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
enteredo="opacity-100 translate-y-0 sm:scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
>
<Dialog.Panel className="max-w-6xl relative transform overflow-hidden rounded-lg bg-neutral-900 px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:p-6">
<div>
<div className="mt-3 sm:mt-5">
<Dialog.Title as="h3" className=" font-semibold leading-6 text-xl text-white">
Penalty Explanation
</Dialog.Title>
<div className="mt-2 mb-5">
<p className="text-md text-white">
When configuring this assignment, you requested that attempting to guess locations was prohibited.
Typically, the student wouldn't have been penalized for changing to a directory that doesn't exist. But, because they attempted to cd into a folder that they knew wasn't there after running <span className='bg-black px-4'>ls</span>, it can be assumed that they were attempting to guess the location. As a result I gave a 5 point penalty.
</p>


<h1 className='text-md font-semibold text-white mt-4'>Was my penalty appropriate?</h1>
<button className='mt-3 text-white bg-green-700 px-4 py-1 rounded-lg'>Yes</button>
<button className='ml-2 text-white bg-red-700 px-4 py-1 rounded-lg'>No</button>

<h1 className='text-md font-semibold text-white mt-4'>Do you have any feedback? The AI will try to improve its grading strategy.</h1>
<textarea className='bg-neutral-800 text-white w-full rounded-lg px-4 py-2 mt-2 border-none' placeholder='Enter feedback here...'></textarea>
<button className='mt-3 text-white bg-blue-700 px-4 py-1 rounded-lg'>Submit Feedback</button>
<Dialog as="div" className="relative z-10" onClose={setOpen}>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<div className="fixed inset-0 bg-black bg-opacity-75 transition-opacity" />
</Transition.Child>

<div className="fixed inset-0 z-10 w-screen overflow-y-auto">
<div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
enteredo="opacity-100 translate-y-0 sm:scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
>
<Dialog.Panel className="max-w-6xl relative transform overflow-hidden rounded-lg bg-neutral-900 px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:p-6">
<div>
<div className="mt-3 sm:mt-5">
<Dialog.Title as="h3" className=" font-semibold leading-6 text-xl text-white">
Penalty Explanation
</Dialog.Title>
<div className="mt-2 mb-5">
<p className="text-md text-white">
When configuring this assignment, you requested that attempting to guess locations was prohibited.
Typically, the student wouldn't have been penalized for changing to a directory that doesn't exist. But, because they attempted to cd into a folder that they knew wasn't there after running <span className='bg-black px-4'>ls</span>, it can be assumed that they were attempting to guess the location. As a result I gave a 5 point penalty.
</p>


<h1 className='text-md font-semibold text-white mt-4'>Was my penalty appropriate?</h1>
<button className='mt-3 text-white bg-green-700 px-4 py-1 rounded-lg'>Yes</button>
<button className='ml-2 text-white bg-red-700 px-4 py-1 rounded-lg'>No</button>

<h1 className='text-md font-semibold text-white mt-4'>Do you have any feedback? The AI will try to improve its grading strategy.</h1>
<textarea className='bg-neutral-800 text-white w-full rounded-lg px-4 py-2 mt-2 border-none' placeholder='Enter feedback here...'></textarea>
<button className='mt-3 text-white bg-blue-700 px-4 py-1 rounded-lg'>Submit Feedback</button>

</div>
</div>
</div>

</Dialog.Panel>
</Transition.Child>
</div>
</div>
</div>
</div>

</Dialog.Panel>
</Transition.Child>
</div>
</div>
</Dialog>
</Transition.Root>
</Dialog>
</Transition.Root>
</div>
</div>
</div>
Expand Down
24 changes: 14 additions & 10 deletions src/pages/challenges/[id].jsx
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ export default function Challenge() {
<div className="mx-auto mt-6 max-w-6xl text-left">
<div className="mb-2 flex place-items-center justify-between">
<div>
<h1 className="inline-block text-3xl font-semibold text-white">
<h1 className="inline-block text-2xl font-semibold text-white">
{' '}
Challenge Description{' '}
</h1>
Expand All @@ -518,7 +518,7 @@ export default function Challenge() {
onClick={likeChallenge}
className="card-body m-1 flex rounded-md bg-neutral-800 px-10 py-2 hover:bg-neutral-700"
>
<h1 className=" mr-4 bg-gradient-to-br from-orange-400 to-yellow-400 bg-clip-text text-2xl font-semibold text-transparent">
<h1 className=" mr-4 bg-gradient-to-br from-orange-400 to-yellow-400 bg-clip-text text-xl font-semibold text-transparent">
<HeartIcon className="h-8 w-8 text-red-500" />
</h1>
<p className=" text-2xl text-white">{likeCount}</p>
Expand Down Expand Up @@ -555,8 +555,8 @@ export default function Challenge() {

<div
id="challengeDetails"
style={{ color: '#8c8c8c' }}
className="w-full whitespace-pre-wrap border-l-4 border-blue-700 bg-neutral-800/50 px-4 py-2 text-lg text-white"

className="w-full text-white whitespace-pre-wrap border-blue-700 bg-neutral-800/50 px-4 py-2 text-lg text-white"
>
<div>
<MarkdownViewer content={challenge.content} />
Expand All @@ -581,16 +581,20 @@ export default function Challenge() {
Submit Flag
</button>
<button
hidden={!hintMessages}
//hidden={!hintMessages}
onClick={() => setHintOpen(true)}
className="ml-2 mt-4 rounded-lg bg-black bg-yellow-700 px-4 py-1 text-white text-yellow-300 hover:bg-yellow-900"
className="hidden ml-2 mt-4 rounded-lg bg-black bg-yellow-700 px-4 py-1 text-white text-yellow-300 hover:bg-yellow-900"
>
Stuck?
</button>
</div>
</div>
</div>
</div>

<div className='bg-neutral-800 px-2 py-4 mt-10 mb-10'>
<h1 className='text-white text-center'>Public terminals are temporarily unavaliable. Some challenges that require pre-configured enviroments may not be solvable.</h1>
</div>
<div className="mt-6 grid hidden gap-10 sm:grid-cols-1 lg:grid-cols-3">
<div
style={{ backgroundColor: '#212121' }}
Expand Down Expand Up @@ -628,7 +632,7 @@ export default function Challenge() {
</div>
</div>
</div>
<div id="terminal" className=" mx-auto mt-6 max-w-6xl">
<div id="terminal" className="hidden mx-auto mt-6 max-w-6xl">
<div className="hint mb-2 text-gray-400">
<span className="font-semibold text-white ">
{' '}
Expand Down Expand Up @@ -713,8 +717,8 @@ export default function Challenge() {
</div>
}
</div>
<div className="mt-10 rounded-lg px-5 pb-20">
<h1 className="text-3xl font-semibold text-white">Comments</h1>
<div className="mt-10 rounded-lg pb-20">
<h1 className="text-2xl font-semibold text-white">Comments</h1>
<textarea
id="comment"
onChange={commentChange}
Expand Down Expand Up @@ -986,7 +990,7 @@ export default function Challenge() {
</div>
</Dialog>
</Transition.Root>
<p className="mx-auto mt-1.5 w-3/5 rounded-lg bg-neutral-800 px-4 py-0.5 text-sm text-gray-200">
<p className="hidden mx-auto mt-1.5 w-3/5 rounded-lg bg-neutral-800 px-4 py-0.5 text-sm text-gray-200">
ℹ We provide accessible environments for everyone to run cybersecurity
tools. Abuse and unnecessary computation is prohibited.
</p>
Expand Down