Advertisement
MrHG

CCRemoteShell

Jun 2nd, 2020
1,207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.72 KB | None | 0 0
  1. local sides = { "top", "bottom", "left", "right",
  2. "front", "back" }
  3. local modemSide = "top";
  4. local protocol = "remoteT";
  5. for i = 1, #sides do
  6.   if peripheral.isPresent(sides[i]) then
  7.     if peripheral.getType(sides[i]) == "modem" then
  8.       print("Modem found.");
  9.       modemSide = sides[i];
  10.       rednet.open(modemSide);
  11.       break
  12.     end
  13.   end
  14. end
  15. if rednet.isOpen(modemSide) then
  16.   print("Now listening for network input.");
  17.   rednet.host(protocol,os.getComputerID().."R")
  18.   Ssender, Smsg, Sprotocol = rednet.receive(protocol);
  19. else
  20.   print("No modem found.");
  21.   return
  22. end
  23. print("command received from "..Ssender);
  24. print("executing in 2 seconds");
  25. sleep(2);
  26. shell.run(Smsg);
  27. os.reboot();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement