write-ups-challenges-2022-2023/k8s_easter_eggs/part4/source.js
2022-11-24 22:59:22 +01:00

27 lines
853 B
JavaScript

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...`);
});