Using Nodejs to access ssh commands - node.js

I am using latest NodeJS(12.X) version in my Windows desktop.
I used remote of Cisco routers using putty and execute few commands there.
Now, I need to execute these commands (like show, run version) in my Cisco routers using Nodejs application. I need to write those output from routers in to my base machine in .txt format or need to show it in console.
I already tried simple-ssh and remote-exec but its not successful.
Can anyone help me here with sample code, that would be Great!..
Thanks.

Related

Splashtop Streamer on Ubuntu Server

i am just wondering if it is possible to run Splashtop Streamer on Ubuntu Server ??
i have been able to install it, but, i get an invalid token when trying to connect, i was hoping that i could connect, and just get to a terminal.
i am pretty new to linux, but, am looking at moving across some of our project to linux from windows, but need to be able to remotely access them. and we have a splashtop business account.
thanks in advance
i have tried the following :
installed splashtop streamer
deployed with our code
but when trying to connect, i get a invalid token error.

Dev Container VS Code

I have a scenario that after connecting to Remote SSH in VS Code and docker containers running is=n the host machine, I need to use Dev containers to make the developers have features that is available in VS Code GUI.
Like to create a file using simple clicks in VS Code instead of using Terminal.
My host machine is running on Amazon linux2 and the docker container has python packages, GIT and dbt core. Inside each container, every user has their own GIT cloned repo to work on that.
Tried the steps given in this URL https://code.visualstudio.com/docs/devcontainers/containers#_installation
Its quite different when I look into my VS Code console.
If anyone can provide me with the simple steps to achieve this.
Thanks in advance :)

how to visualize images in debug console when im using vscode via remote ssh

I am using vscode remote ssh and connect to my server (a node in a cluster) via ssh.
My local machine is Windows and my Host is ubuntu.
My vscode is being used to code in python.
I am trying for weeks to be able to run a python code and display images in the debug console like what we do in the normal terminal or in jupyter notebook, but I notice that I cannot display the image in the debug console at all.
here is a toy example
import numpy as np
import matplotlib.pyplot as plt
img = np.random.rand(300,200)
plt.imshow(img);plt.show()
basically when I try to do plt.imshow(img);plt.show() in the debug console I either get nothing or I get qt.qpa.screen: QXcbConnection: Could not connect to display localhost:0.0 Could not connect to any X display. .
I tried several methods such as using x11 extenson or adding x11 forwarding in the putty or add Display in the launch.json. However, none of them works.
I am coming to the conclusion that vscode remote ssh and debug console in python dont have that feature yet. But if you know a way to do it PLEASE let me know.
I hope that I am clear that displaying image in the normal situation is working and it is not working in the debug situation.
Please note that when I am doing the debug I dont want to display the image out side of the debug console.
Thanks
it seems you have done the first steps of my proposed solution.
open your settings in vscode with ctrl+, and search for terminal.integrated.env.linux. Click Edid settings.json
Update terminal.integrated.env.linux to this
"terminal.integrated.env.linux": {
"DISPLAY": "localhost:10.0",
}
Shut down vscode
Open ssh conncetion to server with ssh -X user#host
Open vscode and use remote development add-on as usually.
Now, this will work indefinitely, just open the x11-forwarding on the side every time. The downside, for which I am currently searching for solution is that you need to remove the "DISPLAY": "localhost:10.0" every time you wish to develop locally, which is not optimal.
Edit: Since you are apparently using windows, you need to configure putty with X11 forwarding and use xming or other x11-forwarding software in place of my step 4.

typewrite(),press() on pyautogui is not working on Remote Desktop

I am using my host where i used to connect to the Remote machine where i want to fetch some data.
I am using pyautogui for press operation and typewrite() to enter some values.
The remote server is configured and application i want to operate will be always open when i connect to remote machine.
I am able to login through pyautogui.
after that when i write below code:
pyautogui.press('esc')
pyautogui.press('f1')
pyautogui.typewrite("T")
Its not typing T on the application that is opened on remote server.
Please suggest me some python way so that i can overcome from this issue.
Thanks
Simun
go and change the type of the keyboard , i faced the same situation by typing a full url in ubuntu terminal , i solved by changing the type of keyboard in the system to US

Running .ktr created in windows on centos 6.5 server

Folks,
I trust all is well.
We have .ktr files that are created in widows 7 that we need to run on a centos 6.5 server using pan.
I am trying to run the following command the server:
[root#BTNYSLDVD01 data-integration]# /home/pentaho/data-integration/pan.sh /file=/home/pentaho/data-integration/file.ktr
However I am getting the following error:
2015/10/07 13:03:28 - File Output.0 - Access denied for user 'root'#'localhost' (using password: YES)
The file.ktr file was created and runs properly without errors on a widows 7 computer. The only modification I made was that I altered the <server></server> tag from <server>ip address</server> to <server>localhost</server>
I know that the password is correct because I am able to connect to the database from console.
We cannot create the .ktr files on the centos server since we do not have the desktop installed.
My question is "Is there snything special we need to do when running a .ktr file that was created in windows 7 on a centos 6.5 server"?
Thanks in advance for your help.
Andy
First run this
cd data-integration
chmod +x *.sh
It will make the shell scripts executable.
Without more details, it's hard to know what is wrong.
I guess that you may have a problem of access via ssh : maybe you should have a key (e.g. generated via ssh-keygen) for the user root?
It gets pretty interesting. I find out on page
http://dev.mysql.com/doc/refman/5.6/en/can-not-connect-to-server.html
"A Unix socket file is used if you do not specify a host name or if you specify the special host name localhost."
Unix socket pretty special feature not available on Windows, but Kettle is written on Java which suppose to work on different OS, and can't use Unix socket since it's plafrorm specific. It has to use tcp/ip connection.
Against it, mysql command is platform specific and able to utilize power of Unix socket, since it native tool.
Just try to put 127.0.0.1 instead of localhost
We were able to solve the issue. The issue was that mysql did not allow access from 127.0.0.1. We deployed pentaho on another server and were able to get the file to work. Thanks Simar for all your help.

Resources