one_click.mp4
The extension is a quick utility to automate the ssh process of launching a terminal and moving back and forth in copying the username, password and IP address to login into your Clouways Server terminal.
Tested On :
- OS : Linux(Ubuntu 20.0 )/64bit
- Browser : Google Chrome
-
The expect utility or scripting language works with scripts or programs that expect user inputs. It automates the task by providing inputs to expected outputs. Here is the expect script that we're using to automate the ssh login :
#!/usr/bin/expect spawn ssh -o StrictHostKeyChecking=no user@server_ip expect "password" send "password" send "\r" interact
Inorder for it to execute we need it installed. You may use the following command to install :
$ sudo apt-get install expect
-
The expect script is executed here by using a Python program that we will refer to as the host program and which listens for data from the extension and than adds the necessary data to the script before executing it in a bash shell. The host program currently requires Python3 and isn't backwards compatible. You may use the following command to install if not already:
$ sudo apt-get install python3
To get an overview of the files and science behind the extension you may refer to the doc here :
https://developer.chrome.com/extensions/overview
-
To install the extension turn on developer options by navigating to the extensions tab. You can input the following in the URL area and it'll take you there directly :
chrome://extensions/
Use the load unpacked button to load the extension by navigating to the extension's directory i.e cw_one_click in this case.
-
By now you must have noticed that there are two manifests in our little set-up.
- The extensions's manifest which contains the extension's information like the permissions and scripts to run
- and the other host's manifest which provide's details about the host program that the extension will communicate too(By host we simply mean the machine the program will run on).
In-order for the extension to communicate to the host program we need to update the following :
-
We will include the extension's ID in the python script to allow the desired extension to interact with it. Copy the extension ID which can be found here :
And update it in the host/one_click.json where the Extension_ID_HERE placeholder is.
-
Similarily update the path of the python program in host/one_click.json where the Your_PATH placeholder is. The path can be found simply by running the
$pwd
in the cw_one_click host directory. -
The final step is to move the host's manifest to the location google-chrome extension's looks for by default if there are any relevant host program information an extension needs.
To this simply run the command in the cw_one_click/host's directory :
mv ./host/one_click.json ~/.config/google-chrome/NativeMessagingHosts/
Awesome!. You've just finished installing cw_one_click for automating ssh logins. Keep track of this repo for some amazing upcoming feature(s) and don't forget to star this repo :)