made simple "command" sending

This commit is contained in:
valentijn
2024-01-16 20:53:14 +01:00
parent 713bb6136f
commit ccb19f8124
2 changed files with 42 additions and 11 deletions

View File

@@ -12,11 +12,17 @@ app.get('/', (req, res) => {
})
app.get("/execute", (req, res)=> {
const raw_command = req.body.command;
const formatted_command = toString(raw_command).trim()
if (formatted_command.startsWith("ls")){
const raw_command = req.query.command;
const formatted_command = String(raw_command).trim();
}
console.log(`Executed Command: ${formatted_command}`);
if (formatted_command.startsWith("ls")){
LS(req, res);
}
else {
res.json({"response": "invalid command"})
}
})
app.listen(port, () => {
@@ -25,6 +31,7 @@ app.listen(port, () => {
function LS () {
function LS (req, res) {
res.json({"response": "LS IS WEL FICKING EPISCH"});
}