|
|
|
@ -630,7 +630,7 @@ app.post('/DeleteImageReplaceFlags', (req,res) => {
|
|
|
|
|
else {
|
|
|
|
|
DeleteImage(images);
|
|
|
|
|
try {
|
|
|
|
|
execSync(`docker rmi -f ${images}`);
|
|
|
|
|
exec(`docker rmi -f ${images}`);
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error(err.message);
|
|
|
|
|
}
|
|
|
|
@ -798,6 +798,20 @@ async function getFlagFromContestID(contestID) {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get all of the flags in the database
|
|
|
|
|
async function getAllFlags() {
|
|
|
|
|
return new Promise((resolve,reject) => {
|
|
|
|
|
const query = 'SELECT * FROM Flags';
|
|
|
|
|
con.query(query, [], (err,rows) => {
|
|
|
|
|
if (err) {
|
|
|
|
|
console.error(err.message);
|
|
|
|
|
reject(err);
|
|
|
|
|
}
|
|
|
|
|
resolve(rows);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get whether the email belongs to an admin or a user
|
|
|
|
|
export async function AdminorUser(email) {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
@ -1081,7 +1095,7 @@ async function placeFlag(messagestring, container, image){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const exec = await container.exec({
|
|
|
|
|
Cmd: ['/bin/bash', '-c', `echo '${FlagHash}' > ${flag.Path}`],
|
|
|
|
|
Cmd: ['/bin/bash', '-c', `sed -i 's|\\[FLAG\\]|${FlagHash}|g' ${flag.Path}`],
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
exec.start({hijack: true, stdin: true, stdout: true, stderr: true}, (err, stream) => {
|
|
|
|
|