Skip to content

Instantly share code, notes, and snippets.

@Osb0rn3
Last active March 13, 2024 19:42
Show Gist options
  • Save Osb0rn3/16bbbecdb6cfe16a4526523e6854a501 to your computer and use it in GitHub Desktop.
Save Osb0rn3/16bbbecdb6cfe16a4526523e6854a501 to your computer and use it in GitHub Desktop.
Is there a method to access the admin panel?
const express = require('express');
const axios = require('axios');
const app = express();
const port = 80;
app.get('/', async (req, res) => {
const whitelist = ['voorivex.team'];
try {
const { url } = req.query;
const parsedUrl = new URL(url);
if (whitelist.includes(parsedUrl.hostname)) {
const response = await axios.get(url);
res.json(response.data);
} else {
res.status(403).send('Forbidden: Hostname not in whitelist');
}
} catch (error) {
if (error.request) {
res.status(500).send('Internal Server Error');
} else {
res.status(400).send('Bad Request: Invalid URL');
}
}
});
app.get('/admin', async (req, res) => {
const clientIP = req.ip;
if (clientIP === '::1' || clientIP === '127.0.0.1' || clientIP === '::ffff:127.0.0.1') {
res.send("Welcome to admin panel!")
} else {
res.status(403).send('Forbidden');
}
})
app.listen(port, () => {
console.log(`Server is running on http://localhost:${port}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment