Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --setup
- os.pullEvent = os.pullEventRaw
- local function drawTaskBar(s,x)
- term.setCursorPos(x,18)
- term.setBackgroundColor( colors.black )
- term.clearLine()
- term.write(s)
- term.setBackgroundColor( colors.gray )
- term.setCursorPos(1,1)
- end
- term.setBackgroundColor( colors.gray )
- term.clear()
- drawTaskBar("Telnet.lua", 1)
- --Menu
- local function centerCursor(s, yo)
- local width = ({term.getSize()})[1]
- local height = ({term.getSize()})[2]
- term.setCursorPos(((width/2)-s),(height/2)+yo)
- end
- local function communicate(side, target)
- modem = peripheral.wrap(side)
- rednet.open(side)
- textutils.slowPrint("Connecting!")
- term.clear()
- centerCursor(string.len("Incoming Telnet Request"), -5)
- rednet.send(tonumber(target) ,"Incoming Telnet Request")
- print("OK")
- while true do
- print(target..":")
- command = read()
- rednet.send(tonumber(target), command)
- RXID, RX = rednet.receive()
- print("////")
- print(RXID..":")
- print(RX)
- end
- end
- local function menu()
- while true do
- centerCursor(string.len("Welcome"), -2)
- print("Welcome")
- centerCursor(string.len("Target adress"), -1)
- print("Target adress")
- centerCursor(string.len("****"), 0)
- Target = read()
- centerCursor(string.len("Computer ID is: xxxx"), 1)
- shell.run("id")
- centerCursor(string.len("Side:"), 2)
- print("Side: ")
- centerCursor(string.len("XXXX"), 3)
- side = read()
- sleep(1)
- term.clear()
- centerCursor(string.len("Press 'enter' when ready"), 0)
- print("Press 'enter' when ready")
- read()
- communicate(side, Target)
- end
- end
- --INIT
- menu()
- return "OK"
- --os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement