Created
December 20, 2023 16:11
-
-
Save Osb0rn3/e3fd7bd61a69fc668d18d946f05763b9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const fs = require('fs').promises; | |
const axios = require('axios'); | |
const app = express(); | |
const port = 3000; | |
app.get('/request', async (req, res) => { | |
const url = req.query?.url || ''; | |
if (url.match(new RegExp('^http(s)?:\/\/[a-zA-Z0-9]+\.voorivex\.academy$'))) { | |
try { | |
const response = await axios.get(url); | |
if (response.data?.message == 'under-my-command') { | |
res.send(await fs.readFile('/flag', 'utf-8')) | |
} | |
} catch (error) { | |
res.status(500).json({ error: 'Error fetching data from the url' }); | |
} | |
} else { | |
res.status(400).json({ error: 'Invalid url' }); | |
} | |
}); | |
app.listen(port, () => { | |
console.log(`Server is running on port ${port}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this way you can access the flag : http://yourdomain.voorivex.academy/request?url=http://valid-domain.voorivex.academy&message=under-my-command