Shellshare

From ICO wiki
Jump to navigationJump to search

Eesti keeles

IT Kolledž: http://linux.itcollege.ee:3000
avalik teenus: https://shellshare.net/

Versioon 1.1.0 lisab MS Windowsi toetuse ilma emuleerimiseta.

Võimalus jagada käsurida Pythoni abil reaalajas veebipõhiselt ja võimaldada õppuritel paremini jälgida tunnis antud käske ja nende väljundit ja vältida ümberkirjutamisest tekkivaid vigu. Võimalus ka virtuaalmasinast otse käsurida edastada. Edastamine toimub vaid vaatamisrežiimis. Kui soovitakse muutmisrežiimis (aka collaborative hacking) siis näiteks vabavaraline upterm võib huvi pakkuda.

Paigaldamine

Uusima shellshare'i versiooni kiire paigaldus Linuxis kestprogrammi Bash korral

mkdir -p ~/.local/bin/ && wget -q --show-progress https://raw.githubusercontent.com/vitorbaptista/shellshare/master/public/bin/shellshare -O ~/.local/bin/shellshare && chmod u+x ~/.local/bin/shellshare
echo "alias lühikäsunimi='shellshare --server http://linux.itcollege.ee:3000 --room ruuminimi --password ruumisalasõna'" >> ~/.bash_aliases && source ~/.bash_aliases

Palun asendada lühikäsunimi, ruuminimi, ruumisalasõna soovitud väärtustega.

Kasutatud otsiteekonna (path) toimimiseks Bash'i korral tuleb jälgida, et ~/.bashrc sisaldaks ridu:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
   PATH="$HOME/.local/bin:$PATH"
fi

~/.bashrc muudatuste jõustamiseks:

source ~/.bashrc

... või siis sulgeda kõik senised terminalide sessioonid ja avada uuesti terminal. Kui on mõni teine kestprogramm kasutusel, siis tuleb jälgida selle seadistuse nõudeid.

Edaspidi piisab terminali avamisest ja saab määratud lühikäsunime sisestades kiirelt kasutada. Selle käivitamisel öeldakse terminalis ka aadress, mille pealt teised siis terminali sisestatud käske näevad, peaaegu reaalajas. Seda aadressi saab aegsasti ka õppuritele jagada, mida tunni ajal siis avada saab.

  • skripti allalaadimine https://github.com/vitorbaptista/shellshare/releases - valida Latest Release
    • on olemas ka programmi koduleht kus allalaadimise viide kuid võib juhtuda, et see ei tööta
  • lahtipakitud kaustast leiab skripti public/bin/shellshare - selle võib ka ringi nimetada shellshare.py ja kopeerida endale meelepärasesse asukohta, võib paralleelselt ka sobivasse kohta veebis paigutada, et kiirelt näiteks virtuaalmasinasse alla laadida

Edastamine

Kui Ubuntus puudub link python, mis viitaks uusimale paigaldatud python'i versioonile, siis tuleb see luua. Vaatame, mis on olemas: kirjutada python ja vajutada vähemalt 2x kiirelt TAB-klahvi. Kui pakutute hulgas puudub python, siis on vastav symlink vaja luua:

sudo ln -s /usr/bin/python3 /usr/bin/python

Käsurea (peaaegu) reaalajas edastamise alustamiseks:

  • kiire lahendus
shellshare

See käivitab juhuslikult loodud räsiga aadressi, nähtav https://shellshare.net/r/<räsi>

  • saab ka ette anda ruumi ja salasõna
shellshare --room ruuminimi --password salasõna

Siis on see nähtav aadressil https://shellshare.net/r/ruuminimi

IT Kolledži serveri kaudu edastamine:

shellshare --server http://linux.itcollege.ee:3000 --room ruuminimi --password salasõna

Siis on see nähtav aadressil http://linux.itcollege.ee:3000/r/ruuminimi

  • asendada
    • asukoht tegeliku shellshare.py asukohaga arvuti kõvakettal
    • ruuminimi soovitud nimega
    • salasõna soovitud salasõnaga
  • veebi edastatud käsud on kopeeritavad, ajalugu vaadatav tagasi kerides (ei ole soovitav käsurida vahepeal puhastada)
  • ka käsureal avatavad failid, man-lehed jne on kuvatavad; liikumine, klaviatuuri abil teksti märkimine kuvatakse ka veebivoos

Toetatud on ka mitmest terminalist korraga samale aadressile käsurea edastamine - nii on võimalik samaaegselt edastada käsurida klassiarvutist, virtuaalmasinast jne korraga samale sessioonile - nii on õppuri jaoks info ühes kohas. Info tuleb ära kopeerida, sest edastamise lõppemisel ja akna sulgemisel ajalugu ei säili.

Kiire kasutamine

Võimalus teha ka lühikäsk ehk alias (vt Alias bash shellis, .bash_aliases), skript vms käsurea jagamise kiireks käivitamiseks soovitud ruuminimega

Edastamise lõpetamine

Käsurea edastamise lõpetamine: exit+Enter, sageli toimib ka CTRL+D

Erilised tänud

Erilised tänud TalTechi IT Kolledži Linuxi administraatorile Veiko Tuul serveripoole käivitamise ja selle suurepärase võimaluse loomise eest!

Viited

in English

IT College: http://linux.itcollege.ee:3000
public service: https://shellshare.net/

Version 1.1.0 adds MS Windows support without emulation.

There is an option to share command-line over Internet in real time using Python. This allows for students to follow lecturer commands and its output and avoid mistakes of rewriting commands. Streaming is going only in read-only mode. If there is edit mode needed (aka collaborative hacking) then probably free and open-source upterm is one of the choices you may be interested in.

Setup

Quick install for newest version of shellshare in Linux in case of Bash shell

mkdir -p ~/.local/bin/ && wget -q --show-progress https://raw.githubusercontent.com/vitorbaptista/shellshare/master/public/bin/shellshare -O ~/.local/bin/shellshare && chmod u+x ~/.local/bin/shellshare
echo "alias shortname='shellshare --server http://linux.itcollege.ee:3000 --room roomname --password roompassword'" >> ~/.bash_aliases && source ~/.bash_aliases

Please replace shortname, roomname, roompassword with appropriate values, you wish to use.

For ensuring the used path works in case of Bash there must be in ~/.bashrc the following lines:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
   PATH="$HOME/.local/bin:$PATH"
fi

for applying changes in ~/.bashrc:

source ~/.bashrc

... or close all existing Bash terminal sessions and reopen the terminal. If there is any other shell in use, then its configuration requirements must be followed.

From now on, it is enough to open the terminal and you can quickly use it by entering the specified short command name. When started, the terminal also says the address from which others can then see the commands entered in the terminal, in near real time. This address can also be shared with students in a timely manner, which students can then open during class.

  • download the appropriate script at https://github.com/vitorbaptista/shellshare/releases - choose Latest Release
    • there is also program homepage where download command is described but it might happen that the site is offline
  • from unpacked folder there can be found the script in public/bin/shellshare - this can be renamed to shellshare.py and copy whenever needed. There is also possible to copy unpacked shellshare script to somewhere in the web so you can quickly download e.g. into virtual machine.

Streaming

If Ubuntu does not have a python link pointing to a newest version of python installed, you need to create one. Let's see what's there: type python and press the TAB key at least twice quickly. If python is not included in the list, you need to create it:

sudo ln -s /usr/bin/python3 /usr/bin/python

To start (almost) real-time command line streaming:

  • fast connection
shellshare

This will launch a randomly generated hashed address, visible at https://shellshare.net/r/<hash>

  • you can also specify a room and password
shellshare --room roomname --password password

Then it will be visible at https://shellshare.net/r/roomname

Streaming via IT College server:

shellshare --server http://linux.itcollege.ee:3000 --room roomname --password password

Then it will be visible at http://linux.itcollege.ee:3000/r/roomname

  • replace
    • roomname with the name
    • password with the password
  • commands sent to the web are copyable, history can be viewed by scrolling back (it is not recommended to clean the command line while using shellshare)
  • files opened on the command line, man pages, etc. are also displayed; movement, text marking using the keyboard are also displayed in the web stream

Transmitting a command line from multiple terminals to the same address at the same time is also supported - this way it is possible to simultaneously transmit a command line from a class computer, from a virtual machine, etc. to the same session at the same time - this way the information is in one place for the student. The information must be copied, because the history is not preserved when the transmission ends and the window is closed.

Fast usage

There can be an alias created (see also .bash_aliases), script etc to start quickly streaming command-line with appropriate settings.

Stop streaming

To stop command-line streaming: exit+Enter, usually also CTRL+D works.

Special thanks

Special thanks goes to TalTech IT College Linux administrator Veiko Tuul to set up server side and offering such a great opportunity!

Links