forked from snxraven/sshChat-CLI
20 lines
517 B
JavaScript
20 lines
517 B
JavaScript
|
// exec.js
|
||
|
const unirest = require("unirest");
|
||
|
|
||
|
async function runCMD(key, cmd, pwd) {
|
||
|
let requestData = await unirest
|
||
|
.post('https://api.discord-linux.com/exec')
|
||
|
.headers({
|
||
|
'Accept': 'application/json', 'Content-Type': 'application/json',
|
||
|
'x-discord-linux-auth': key
|
||
|
})
|
||
|
.send({ "cmd": cmd, "pwd": pwd })
|
||
|
return requestData.body.stdout
|
||
|
}
|
||
|
|
||
|
async function execute(key, cmd, pwd) {
|
||
|
const stdout = await runCMD(key, cmd, pwd)
|
||
|
console.log(stdout)
|
||
|
}
|
||
|
|
||
|
module.exports = { execute, runCMD }
|