Posted 24 July 2012 - 04:41 AM
[EDIT2] This project is no longer active please see lyqyd's nsh [/EDIT2]
These programs are uses to direct information printed on screen from one computer to the other then send back all key and char events making the first computer think they are local events.
this is the sever you place this on the computer you want to control and run it.
ver ALPHA
This is the client you use this to log into the sever.
Instructions
ounce you have installed the sever on the system you want to controll NOTE (Name it startup if you want it to auto run at startup) and installed the client on the system you will be controlling from. You run the sever then go to the controller and run that program. It will ask for sever ID user name and passward. if the screen goes black you have entered them correctly. else you need to terminate using Ctrl+t and try to connect again. use the user "ted" and the password "hello" without quote marks. ounce connected you can run any program as if you were at the other terminal and it will run there is some lag thought this is unavoidable given the massive amount of rednet messages being sent/ received.
you will then see > like normal type in ID and it will show the id of the computer you are remote controlling. to end a setion use the command logoff example if sever is named startup
Pictures
Demonstrating redpower bundel controll over wifi using BENCH v0.9
http://www.computerc...esting-utility/
[EDIT] big thanks to MysticT and xuma202
http://www.computerc...h__1#entry20259
These programs are uses to direct information printed on screen from one computer to the other then send back all key and char events making the first computer think they are local events.
this is the sever you place this on the computer you want to control and run it.
ver ALPHA
Spoiler
--[[
Remote Terminal
by BigShinyToys
OPEN SOURCE CODE (no rights reserved)
]]--
tArgs = {...}
if #tArgs == 0 then
elseif tArgs[1] == "reboot" then
os.reboot()
elseif tArgs[1] == "shutdown" then
os.shutdown()
elseif tArgs[1] == "restore" then
function os.pullEventRaw( _sFilter )
return coroutine.yield( _sFilter )
end
term.restore()
print("Closed Sestion")
return
elseif tArgs[1] == "logoff" then
function os.pullEventRaw( _sFilter )
return coroutine.yield( _sFilter )
end
term.restore()
print("Closed Sestion")
end
UserID = -1
-- user names tha have access
local Authenticate = {
ted = "hello",
harry = "hello2"
}
local function openRednet()
local listOfSides = rs.getSides()
for i = 1,6 do
if peripheral.isPresent(listOfSides[i]) and peripheral.getType(listOfSides[i]) == "modem" then
rednet.open(listOfSides[i])
return listOfSides[i]
end
end
end
modemOn = openRednet()
if not modemOn then
print("No WIFI ModemnPress any key to return to exit")
os.pullEvent("key")
return
end
function os.pullEventRaw(...)
local e1,e2,e3,e4,e5 = coroutine.yield(...)
if e1 == "rednet_message" and e2 == UserID then
local a = string.sub(e3,1,3)
if a == "key" then
return "key",tonumber(string.sub(e3,4,string.len(e3)))
elseif a == "cha" then
return "char",string.sub(e3,4,4)
end
end
return e1,e2,e3,e4,e5
end
remote = {}
function remote.write(s)
rednet.send(UserID,"WRT"..s)
end
function remote.clear()
rednet.send(UserID,"CLR")
end
function remote.clearLine()
rednet.send(UserID,"CLL")
end
function remote.setCursorBlink(s)
rednet.send(UserID,"SCB"..tostring(s))
end
function remote.setCursorPos(x,y)
rednet.send(UserID,"SCP"..textutils.serialize({x,y}))
end
function remote.getSize()
rednet.send(UserID,"GSZ")
while true do
local w1,w2,w3 = os.pullEvent("rednet_message")
if string.sub(w3,1,3) == "SIZ" then
local a = textutils.unserialize(string.sub(w3,4,string.len(w3)))
return a[1],a[2]
end
end
end
function remote.getCursorPos()
rednet.send(UserID,"GCP")
while true do
local w1,w2,w3 = os.pullEvent("rednet_message")
if string.sub(w3,1,3) == "POS" then
local a = textutils.unserialize(string.sub(w3,4,string.len(w3)))
return a[1],a[2]
end
end
end
function remote.scroll(nLines)
rednet.send(UserID,"SCR"..tostring(nLines))
end
term.clear()
term.setCursorPos(1,1)
print("Remote Terminal Started")
while true do
local q1,q2,q3,q4,q5 = os.pullEvent()
print(tostring(q1).." "..tostring(q2))
if q1 == "rednet_message" then
local test = string.sub(q3,1,12)
if test == "RMTLOGINREQ:" then
local uDAT = textutils.unserialize(string.sub(q3,13,string.len(q3)))
if Authenticate[uDAT[1]] == uDAT[2] then
term.clear()
term.setCursorPos(1,1)
print("User "..tostring(uDAT[1]).." Online")
rednet.send(q2,"Request Accepted")
sleep(1)
UserID = q2
term.redirect(remote)
term.clear()
term.setCursorPos(1,1)
break
end
end
end
end
print("Open Connection")
This is the client you use this to log into the sever.
Spoiler
--[[
Remote Terminal Client
by BigShinyToys
OPEN SOURCE CODE (no rights reserved)
]]--
local SeverID = nil
local asa = 1 -- test mode
local function runner()
term.clear()
term.setCursorPos(1,1)
while true do
local e1,e2,e3,e4,e5 = os.pullEvent()
if e1 == "rednet_message" then -- and e2 == SeverID
local sTest = string.sub(e3,1,3)
if sTest == "WRT" then
write(string.sub(e3,4,#e3))
elseif sTest == "CLR" then
term.clear()
elseif sTest == "CLL" then
term.clearLine()
elseif sTest == "SCB" then
local boolin = string.sub(e3,4,#e3)
if boolin == "true" then
term.setCursorBlink(true)
elseif boolin == "false" then
term.setCursorBlink(false)
end
elseif sTest == "SCP" then
local curP = textutils.unserialize(string.sub(e3,4,#e3))
term.setCursorPos(curP[1],curP[2])
elseif sTest == "GSZ" then -- work on this
rednet.send(SeverID,"SIZ"..textutils.serialize({term.getSize()}))
elseif sTest == "GCP" then
rednet.send(SeverID,"POS"..textutils.serialize({term.getCursorPos()}))
elseif sTest == "SCR" then
term.scroll(tonumber(string.sub(e3,4,#e3)))
end
elseif e1 == "key" then
rednet.send(SeverID,"key"..tostring(e2))
rednet.send(asa,"key"..tostring(e2))
elseif e1 == "char" then
rednet.send(SeverID,"cha"..e2)
rednet.send(asa,"cha"..e2)
end
end
end
local function openRednet()
local listOfSides = rs.getSides()
for i = 1,6 do
if peripheral.isPresent(listOfSides[i]) and peripheral.getType(listOfSides[i]) == "modem" then
rednet.open(listOfSides[i])
return listOfSides[i]
end
end
end
modemOn = openRednet()
if not modemOn then
print("No WIFI ModemnPress any key to return to exit")
os.pullEvent("key")
return
end
term.clear()
term.setCursorPos(1,1)
print("Welcom to remote terminal")
print("Sever ID")
SeverID = tonumber(read())
print("User Name :")
local UserName = read()
print("Password")
local UserPass = read("*")
print("authenticating")
rednet.send(SeverID,"RMTLOGINREQ:"..textutils.serialize({UserName,UserPass}))
while true do
local e1,e2,e3,e4,e5 = os.pullEvent()
if e1 == "rednet_message" then
if e2 == SeverID then
if e3 == "Request Accepted" then
runner()
end
end
end
end
Instructions
ounce you have installed the sever on the system you want to controll NOTE (Name it startup if you want it to auto run at startup) and installed the client on the system you will be controlling from. You run the sever then go to the controller and run that program. It will ask for sever ID user name and passward. if the screen goes black you have entered them correctly. else you need to terminate using Ctrl+t and try to connect again. use the user "ted" and the password "hello" without quote marks. ounce connected you can run any program as if you were at the other terminal and it will run there is some lag thought this is unavoidable given the massive amount of rednet messages being sent/ received.
you will then see > like normal type in ID and it will show the id of the computer you are remote controlling. to end a setion use the command logoff example if sever is named startup
> startup logoff
and the system will be disconnected. you can then end the client using Ctrl+t again. from this point the sever is still running and will allow you to login from other PC'sPictures
Demonstrating redpower bundel controll over wifi using BENCH v0.9
http://www.computerc...esting-utility/
Spoiler
[EDIT] big thanks to MysticT and xuma202
http://www.computerc...h__1#entry20259