write-ups-challenges-2022-2023/k8s_easter_eggs/part4/source.js

27 lines
853 B
JavaScript
Raw Permalink Normal View History

2022-11-24 21:59:22 +00:00
const express = require('express');
const path = require('path');
const app = express();
app.use(express.urlencoded());
const port = 3001;
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, '/index.html'));
});
app.post('/', (req, res) => {
const body = req.body;
const beerCount = parseInt(body.beerCount);
if(isNaN(beerCount)) {
console.log("NOOOO PANIC PANIC!!!!! WE NEVER ANTICIPATED SUCH AN ANSWER AJPIFGNLDFG");
console.log("Also here is a cool flag :) IGCTF-KLARRIO{brand_brand_paniek_paniek_brand}");
res.send('Something went horribly wrong... Check logs. Bailing out!');
process.exit(1);
} else {
res.send('It works :)');
}
});
app.listen(port, () => {
console.log(`Express app listening on port ${port}. Any logs performed by POST requests land here...`);
});