asteroidsteam icon

sudo

asteroidsteam | PRO | 10/30/17 03:51:13 AM UTC | 0 ⭐ | 571 👁️ | Never ⏰ | []
Lua |

580 B

|

None

|

0 👍

/

0 👎

local tArgs = {...}
function sudo(command)
  fileP = fs.open("key", "r")
  passwd = fileP.readAll()
  fileP.close()
  write("Enter Password: ")
  password = read("*")
  if (password == passwd) then
    shell.run(command)
  else
    print("Incorrect password!")
  end
end
function printUsage()
  printError("----------PHUDO 1.0----------")
  printError("Usage:")
  printError("sudo <command> (args)")
  printError("-----------------------------")
end
cmd = ""
if (#tArgs == 0) then
  printUsage()
else
  for i=1,#tArgs do
    cmd = cmd.." "..tArgs[i]
  end
  sudo(cmd)
end

Comments