remote_shell 0.1.4

remote shell through mqtt written by rust.
remote_shell-0.1.4 is not a library.
Visit the last successful build: remote_shell-2.0.0

remote_shell

Remote shell through nats written by rust. The use scenarios include iot device with no fixed ip, home computer behind local network, etc. with remote shell installed on slave machine, you can access from host like normal ssh process.

step 1: Start golang nats message queue:

nats-server --user test --pass test

step 2: Revise conf string in .env :

NATS_URL = localhost
NATS_ACCOUNT  = username
NATS_PWD=  password
REQ_DURATION  = 60
SLAVEID= yourid

SLAVEID is id for slave, the slave only response for request which specified by 'use' command. NATS_URL is nats host,and the account,password is auth method provided by nats-io.

step 3: Start slave by run slave::slave_dispatch::dispatch();

step 4: Start host by run host::shell::run_shell();

step 5: Use remote shell stared with "use <slave id which from step 2>", and send command as normal shell,like "cd /home" etc.

step6: The buildin function include:

use <slave_id>

This command will specify the slave you want to control.You should run step3 on slave pc and config the slave id in the .env file. This salve_id (use arg) should be same with id in the .env file.

wait <true_or_false>

If true,the shell should demo result immediately.If false,the order is sent async and wait no result, you should consider false when run damon application or forever loop programme.

send <local_file_path> <remote_file_path>

Send local file to remote.

rec <local_file_path> <remote_file_path>

Receive file from remote.

send_all <local_dir_path> <remote_dir_path>

Send local directory and all sub-dirs,sub-files to remote. Command send_all is the combinations of command send.

restart

Will restart remote computer.This command is sent by async message pub channel and act as the final rescue when shell crash. Pay attention to restart remote_shell automatically after system reboot.

Others:

The remote_shell use color scheme might result in errors on win10 cmd or power_shell. But test is passed when use cmder instead.