Make it better

This commit is contained in:
business-goose 2021-03-25 17:09:02 +00:00
parent 4b668dd396
commit 34b5300dcc
2 changed files with 11 additions and 15 deletions

3
config.json Normal file → Executable file
View file

@ -1,4 +1,3 @@
{
"user": "USER",
"pass": "PASSWORD"
"user": "USER"
}

View file

@ -94,24 +94,21 @@ client.on("login", function(){
client.queue.push("&aThe terminal is starting, please wait...")
setTimeout(function(){
child_process.execSync("chmod 760 *")
var term = child_process.exec(`su ${config.user}`, function(err, stdout, stderr) {
var term = child_process.exec(`sudo su ${config.user}`, function(err, stdout, stderr) {
console.log("Process exited.")
process.exit(0)
})
globalTerm = term
setTimeout(function(){
term.stdin.write("${config.pass}\n")
setTimeout(function(){
client.queue.push("&aAuthenticated user, giving input!")
term.stdout.on("data", function(chunk){
client.queue = [].concat(client.queue,chunk.toString().replace(/\n/gm," ").match(/.{1,99}/g))
})
term.stderr.on("data",function(chunk){
client.queue = [].concat(client.queue,chunk.toString().replace(/\n/gm," ").match(/.{1,99}/g))
})
},1000)
},200)
client.queue.push("&aAuthenticated user, giving input!")
term.stdout.on("data", function(chunk){
client.queue = [].concat(client.queue,chunk.toString().replace(/\n/gm," ").match(/.{1,99}/g))
})
term.stderr.on("data",function(chunk){
client.queue = [].concat(client.queue,chunk.toString().replace(/\n/gm," ").match(/.{1,99}/g))
})
},1000)
},1000)
})