the_lad

CCRemoteClient

Jan 24th, 2021
893
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --global vars
  2. server = 48
  3. --function
  4. function clear()
  5.   term.clear()
  6.   term.setCursorPos(1,1)
  7.   print("Connected to: "..server)
  8. end
  9.  
  10. function UID()
  11.   clear()
  12.   print("Input UID:")
  13.   local num = read()
  14.   rednet.send(server, num, "UID")
  15.   local server,message,protocol = rednet.receive("response",10)
  16.  
  17.   if message == "confirm" then
  18.     print("confirmed")
  19.     sleep(1)
  20.     Username()
  21.   end
  22.   if message == "denied" then
  23.   clear("Rejected")
  24.   sleep(1)
  25.   start()
  26.   end
  27. end
  28.  
  29. function Username()
  30.   clear()
  31.   print("Input Username: ")
  32.   local input = read("*")
  33.   rednet.send(server,input,"username")
  34.  
  35.   local id,message,prot = rednet.receive("response",10)
  36.   if message == "confirm" then
  37.   clear()
  38.   print("username confirmed!")
  39.   sleep(1)
  40.   Password()
  41.   end
  42.   if message == "denied" then
  43.   clear()
  44.   print("denied")
  45.   sleep(1)
  46.   Start()
  47.   end
  48. end
  49.  
  50. function Password()
  51.   clear()
  52.   term.write("Iput Password: ")
  53.   local input = read("*")
  54.   rednet.send(server, input, "password")
  55.   local id,message,prot = rednet.receive("response",10)
  56.   if message == "confirm" then
  57.   clear()
  58.   print("Password Confirmed!")
  59.   sleep(1)
  60.   Task()
  61.   end
  62.   if message == "denied" then
  63.   clear()
  64.   print("Message Denied")
  65.   sleep(1)
  66.   Start()
  67.   end
  68. end
  69.  
  70. function Start()
  71. rednet.open("back")
  72.   UID()
  73. end
  74.  
  75. function Task()
  76.   while true do
  77.   term.write("SERVER SSH: ")
  78.   local cmd = read()
  79.   rednet.send(server, cmd,"ssh")
  80.   clear()
  81.   end
  82. end
  83. Start()
  84.  
  85.  
  86.  
RAW Paste Data