This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Dave-ee Jones's profile picture

DISH - Interactive Remote Shell

Started by Dave-ee Jones, 21 August 2017 - 03:00 AM
Dave-ee Jones #1
Posted 21 August 2017 - 05:00 AM
DISH
Dave-ee's Interactive Shell



What's DISH?
It's a program that allows you to remotely control a computer running the same program, seeing the screen as if you were right in front of it, interactively.

How does it work?
One computer hosts a connection on a specific channel (default: 5317), and clients listen on that channel for any functions that make changes to the screen, allowing the clients to see any program without actually having the program. The clients can send events to the host on a channel the host listens to (default: 5318), allowing clients to control the computer remotely.

How many clients can see the host at any one time?
Theoretically? Infinite. Practically? Depends on your processing/RAM power, but it would be a lot. This is because the host doesn't actually keep track of all its clients, it just sends the data over a channel which clients listen to so any client that listens on the channel can read the data.

What else does it do?
DISH has an in-built menu as well which allows you to not only see what channels you are listening/transmitting on, but also allows you to change the channels live. The menu can be pulled up by pressing the menu button (default: Left Control). The host's menu can only be accessed by someone who is directly at the computer, so clients cannot pull up the host's menu, only their own. The host can also change the channels it is listening/transmitting on, meaning clients will also need to change their channels. Keep in mind that the menu acts as a 'pause' button, the computer cannot send/receive events while the menu is open. This goes for the host as well.

DISH also has a view-only feature. This means that the host can have view-only mode enabled which means it ignores any events the clients send to it, meaning that the host can only be controlled directly, while clients can see the screen live. This is off by default, but it is taken as an argument in command-line.

When I first connect to a host my screen is black with some text at the top but the host's screen isn't black. Why is this?
This is because the host hasn't drawn anything on it's screen since you have connected. If the host has it's shell up you can type 'clear' to clear the screen and you will see the same shell as the host. This is a small bug that I am still working on a fix for. The problem is it has to constantly redraw the screen everytime a new client starts listening on the channel, however that is almost impossible. I'm working on a workaround.

Usage:

dish host [view-only] [HostChannel] [ClientChannel]
dish join [HostChannel] [ClientChannel]
dish help
The extra arguments are optional, so if you want to keep defaults then just use 'host' or 'join' as arguments.

Images:
http://imgur.com/a/2RPJE

Credits (also found in the program's commenting):
  • Bomb Bloke
  • KingofGamesYami
  • The Crazy Phoenix
  • Lupus500
Pastebin:

pastebin get Tu5ECpkS dish



Feel free to give feedback or suggestions below! :)/>
Edited on 22 August 2017 - 05:31 AM
Dave-ee Jones #2
Posted 21 August 2017 - 07:21 AM
Quick (but awesome) update!

Added a mini control panel in the menu (only seeable by the host, the client can't even see the control panel in their own menu), allowing you to quickly toggle view-only mode (just click on the button and it toggles! Cute.), useful for those who find it frustrating having 10 clients randomly typing at once and you want to quickly disable their input until they quieten down (kids these days..).

Version 1.1 is a go! :)/>
Wilma456 #3
Posted 21 August 2017 - 03:01 PM
If I want to join, I get the error "dish:351 attempt to index ? (a nil value)"
Dave-ee Jones #4
Posted 21 August 2017 - 11:30 PM
If I want to join, I get the error "dish:351 attempt to index ? (a nil value)"

That would probably be because of the whereabouts of the modem. It's defaultly set to be on top, but you can edit DISH and change it to where you want it to be.

EDIT: It's on line 28:

local p_MODEM = peripheral.wrap("top")
Edited on 21 August 2017 - 09:31 PM
Dave-ee Jones #5
Posted 22 August 2017 - 03:55 AM
For those who go by the code "no pics no clics" there is a link in the main post for images.

Also updated DISH (making it v1.2), fixing some minor bugs where the client could still open the host's menu if the client pressed the host's menu button while it was different to the client's. Also fixed the client updating it's screen while the host was drawing things on it's own screen, ruining the beautiful menu. :(/>

Anyways, all fixed now! :)/>
Edited on 22 August 2017 - 02:20 AM
The Crazy Phoenix #6
Posted 22 August 2017 - 05:02 AM
Why is the modem side hardcoded?
Dave-ee Jones #7
Posted 22 August 2017 - 07:07 AM
Why is the modem side hardcoded?

FOINEEEE since you asked so nicely. I'll get it to detect the side of the modem for the next update :)/>
EDIT: Done. v1.3 is a go.
Edited on 22 August 2017 - 05:17 AM
MattieBit #8
Posted 03 December 2017 - 03:45 PM
I cant control from client :(/>
Dave-ee Jones #9
Posted 07 December 2017 - 04:35 AM
I cant control from client :(/>

Good pickup. I can't immediately see why - I'll keep looking into it.

EDIT: Fixed the issue, now it's working fine.
However, keep in mind that if people find your server's menu button they can open the menu on the server (but can't do anything with it), still makes it annoying for other clients who are trying to take control of the server at the time because they can't interact with the server when the menu on the server is open. Tried fixing this issue but it doesn't want to play ball, I'll try another method and upload another patch at some point.
Edited on 07 December 2017 - 04:11 AM
SkyCrafter0 #10
Posted 10 December 2017 - 07:36 PM
How do i edit what button the menu opens with? left ctrl is used by the edit program
and i need to use the edit program
pls and thank you
KingofGamesYami #11
Posted 10 December 2017 - 07:49 PM
The comments in the file indicate that you would want to edit line 29.
SkyCrafter0 #12
Posted 10 December 2017 - 08:28 PM
The comments in the file indicate that you would want to edit line 29.
Yeh, i did that and it gives me an error on line 179
maybe can you give me a key to replace leftctrl, and i tried leftmenu but it errored
KingofGamesYami #13
Posted 10 December 2017 - 08:33 PM
"keys.leftmenu" is not a valid key. I suggest using left or right shift, as the other will still work for normal shifting purposes.
SkyCrafter0 #14
Posted 10 December 2017 - 09:14 PM
"keys.leftmenu" is not a valid key. I suggest using left or right shift, as the other will still work for normal shifting purposes.
Thanks so much, I figured out its keys.leftAlt
Thanks.
MattieBit #15
Posted 02 January 2018 - 02:27 PM
I cant control from client :(/>

Good pickup. I can't immediately see why - I'll keep looking into it.

EDIT: Fixed the issue, now it's working fine.
However, keep in mind that if people find your server's menu button they can open the menu on the server (but can't do anything with it), still makes it annoying for other clients who are trying to take control of the server at the time because they can't interact with the server when the menu on the server is open. Tried fixing this issue but it doesn't want to play ball, I'll try another method and upload another patch at some point.

thanks :D/>
jaredallard #16
Posted 09 February 2018 - 03:35 AM
Is the network traffic E2E encrypted? Regardless, nice to see other remote shell implementations.