beck3k

ComputerCraft - SSH-clone Server

May 29th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. local version = "Version 1.2"
  2. local description = "Rednet 'SSH'-Sender for Turtles and Computers."
  3. id = 0
  4. running = true
  5. side = "right" --Side of the Modem
  6. --Functions
  7. local function receive_instruction()
  8. rednet.open(side)
  9. while true do
  10. id, commandRaw, distance = rednet.receive()
  11. commandMain = tostring(commandRaw)
  12. id = tonumber(id)
  13.  
  14. --Auswertung
  15. write(id)
  16. write(" ")
  17. write(commandMain)
  18. write(" ")
  19. exe = fs.open("ssh_temp.lua", "w")
  20. exe.write(commandMain)
  21. exe.close()
  22. answerRaw = shell.run("ssh_temp.lua")
  23. answer = tostring(answerRaw)
  24. print(answer)
  25. rednet.send(id, answer)
  26.  
  27. end
  28. rednet.close(side)
  29. end
  30. --Functions END
  31. --Main
  32. while running do
  33. receive_instruction()
  34. end
  35. --Main END
Add Comment
Please, Sign In to add comment