Connect To Terminal Server - javascript

I have a site built in Javascript/PHP.
I have a terminal server that I can connect to using puTTy.
What I would like is to display the terminal server on the website.
I want to be able to send data to the terminal server through the code and display the response in the terminal screen.
I am not sure what could help me accomplish this. Are there any Javascript, PHP, Python plugins for this type of thing? I was able to play around with one PHP plugin but it only allowed me to send a command and get a response back. I would like to be able to actually see the terminal session as I would in puTTy.

You can use a Java applet for this.
http://weavervsworld.com/ssh/ssh.php

Related

Sending data from node-red to local webpage

I'd like some help to my project, I do not know how to proceed.
Actually, I have a python code which send data to mosquitto and in my node I have a mqtt listener which get my data from my python code. Then I send those data to influxdb and then I use grafana to display my data in a time series graph. This works perfectly. My problem is that grafana allow you to display data with timeseries. Or I'd like to make X/Y plot.
So my idea is, from node-red and my MQTT listener, I send the data to a personal web page (this webpage could run locally in a local server, let's say localhost:1234 for example). On this server I run my index.html with some javascript on it and the plotly.js library which allows to make nice plot.
I have completly no idea how to send the data from node-red to a external webpage running on a local server. Someone could orientate me ? If you guys know some links or tutorial for this, it would be great.
Why bother with Node-RED, just use the paho Javascript MQTT client and subscribe directly to the MQTT broker from the webpage.

how to connect vue with a raw tcp node server?

the client i am working with has a node js tcp server working with gps trackers through raw tcp. This trackers can not be upgraded to use socket.io or any other library. They simply send raw data.
My work is to upgrade the client and admin communication, currently they login by console using netcat ip port and typing the command they want to execute.
My idea is to use vue since they woule like realtime communication and better ui/ux. I have no idea how to make a raw tcp tranport with vue. any help?
The short answer to this question, is that the browser cannot directly use raw TCP connections. If the browser is your only option you are probably out of luck.
However if you still want to use vue you have a couple of options. You could implement a kind of TCP-socket-bridge. Such as ws-tcp-bridge. You could also write your own middleware server to dispatch events in node.js, using something like the example here.
A third option would be to do something like electron-vue and use its node instance to relay the data to vue with a websocket or socket.io. Here is an example of an express server with electron.
Good luck, and sorry it isn't easier.
Im just thinking above my head here. But what about having maybe a bash script that post to a webhook back and forth. You can post to an endpoint and run a bash script behind cameras, and this same script post back to another webhook that you will be listening to. It wont be fast i believe but it will get the job done. You just have to manage the queue and the webhook listening. Also be sure to limit the webhook origin request to your app only.
Bash easily can save the output of a netcat command, and also this way you isolate the raw tcp communication, giving it an extra layer of security.

How to give Node.js server a command from php script?

sorry to bother you, but I've been looking for answers and I couldn't find them anywhere... Well i'm a fresh dude in the field of javascript and node.js and here's my problem:
I've created an application based on the tutorial of socket.io - Here's the link to the completed project of their chat example. everything is working as it should, but I would really need to trigger somekind of a command while node server is running... command should be triggered via php script.
The command should trigger an emit event - so every client in our case would see a new message sent via php.
I saw couple of suggestions to do it from another server with php/using cURL. The problem is that I don't know how to fetch POST data sent from php to node.js server.
Any solution to command node with php is more than welcome and again i'm sorry to bother you :)
You can use a bridge to exchange data between NodeJS and PHP. You will need to implement a PHP server that exposes remote procedures and a NodeJS client that calls those remote procedures. You can send any data to the NodeJS application from PHP using these remote procedures.
Here are a few links to get you started:
http://bergie.iki.fi/blog/dnode-make_php_and_node-js_talk_to_each_other/
https://github.com/bergie/dnode-php

Nodejs serverside debugging

I am trying to learn NodeJS along with AngularJS. On the frontend, I can simply put debugger statement when I want to put a breakpoint and debug from the browser console. How can I put breakpoints from the server side? In other words, I am looking for a function like pdb in nodejs version.
More specifically, I am trying to learn how to upload files using angularjs on the front and express on the back. When I submit a form with a file attached, a POST request is sent to the server with a set of parameters. Then, the server must submit this form to Amazon S3 with the appropriate credentials. I want to set a breakpoint before submitting the form to Amazon S3 to check the params.
Any help will be appreciated. Thank you!
https://github.com/node-inspector/node-inspector
try this node-inspector, allow you to debug the nodejs just like debugging frontend codes in the chrome devtool
Give it a try for visionmedia debug module.
You may require to configure your node app on your server app.js/main.js/web.js which actually bootstrap your node server app.
var debug = require('debug')('YOUR-APP-NAME');

Embedding a Bash shell in my Flask application?

I know this is kind of weird and not secure at all, but is there a way of displaying a bash shell with a remote control on the machine where the webapp is running ?
I would like to have a bash interpreter running directly in the webapplication in flask, does anyone knows how to do such a thing ?
Thanks a lot,
If my post wasn't clear enough just tell me and I will try to improve it.
You can create an interface that looks like you opened a new terminal. To do so, create a form, and everytime you hit Enter, you send this data (using jQuery.ajax for instance) to the server.
On the server side, use subprocess to run the commands you get from the server. You might need to parse this data (something like: my_string.split(' ')) in order to get the argument in a list. You can return the result of that command using: subprocess.check_output in a JSON data type to the client. With Javascript (and jQuery) you can now parse that data and display it wherever you want.

Categories