How to embed shellinabox into my webpage? - javascript

I am trying to ssh into some machine , but port 22 is blocked due to
our college firewall .
Later I was able to ssh using web-ssh client : shellinabox running in some server , but i don't have sudo access in that server, as I need to download some software too , I planned to install shellinabox using iframe<>
in my server , but i have no idea how to do it ??
I have no ssh-access to my server so I can't install it using apt-get
Can anyone help me to do this ?

For installing shellinabox you need a working server.
Access your shellinbox server from outside your LAN
Configure your home router to forward TCP traffic port 443 (assuming you followed the above tip) to your computer's IP address. You can right click on the Network Manager applet and choose connection information to find your computers IP address. Now you can access your computer when away from home by navigating to https://yourpublicIPaddress. You can get your public IP address by going to http://whatismyip.com. To make it easier to remember your public IP address you can register with a Dynamic DNS service.
If you wish to install shellinabox in your web page after installing a working server by using iframe use the below mentioned command
<iframe src="https://yourpublicIpaddress" width="300" height="300" frameBorder="0" scrolling="no">Browser not compatible. </iframe>

Related

How do I make my electron apps communicate locally between different machines

I have two electron apps. One is a server on machine1 and another is a client on machine2.
When I start the server from the electron app on machine1, I want machine2 (the client) to be able to be able to receive and send data to machine1 (the server).
I tried using http://localhost approach which works for the app during development but doesn't work for the packaged app which is installed on the machine.
Please help. Thanks
When you package an Electron app, it is no longer running on localhost, it runs on the IP address of the machine on which it is installed.
To establish communication between the server and client apps, you will need to use the IP address of the machine on which the server app is running. You can use the os module in Node.js to determine the IP address of the machine on which the server app is running. Once you have the IP address, you can use it to connect the client app to the server app.
You can also use a package like ip to get the IP address of the machine.
const ip = require('ip');
console.log(ip.address());
Hope this helps.

How connect to Html page with node.js server and aws virtual machine

I'm trying to install a node.js server for a sentiment analysis service with my Twitter account that retrieve the tweets on my profile and provides a statistical output and saves them on a Mongo db istance.
I have uploaded my node.js code on an AWS virtual machine with an public IP address and with the permission to create an endpoint with HTTP and HTTPS protocols.
I have installed successfully the node.js code on AWS virtual machine with Windows Server 2019 OS, with the npm install -g -n command with 0 dependencies errors, and when I try to connect to the AWS virtual machine with http://ip_public_address:8080 I get the error "impossible to connect - err-connection_timeout".
This is the link to the github project that I need to install and to work on AWS virtual machine:
https://github.com/thisandagain/sentiment
Maybe I am confused about how to connect with the index.html page via AWS virtual machine and I don't know if this page must be retrieved with a IP public address or localhost parameter and what is required, at node.js level code, in order to enable the AWS virtual machine to respond to my browser with the content of index.html page.
Please can you give me advices about to implement successfully this project?
Thanks
Filippo
You don't mention security groups in your question at all, so the likely cause is that you never opened port 8080 in the security group assigned to the EC2 instance. You may also need to open that port in the Windows firewall on that server.

How to get SSL certificate for homemade webserver

I've created my own webserver using Node.js ans is using it with my DNS from webhost routed to my raspberry pi at home.
How do I prepare the webserver and all the files for getting an SSL certificate using Let'sencrypt?
I've not made any work prior to getting the SSL other than creating the server to run on localhost. Now it's running on a public ip while using my purchased DNS.
I haven't been able to find any litterature other than the off the shelf webservers like apache and such and I really want to run with my own.

Access network camera from outside LAN without port forwarded

I have raspberryPi camera with mjpeg stream to show live streaming. Right now when I create a web-server inside the local network I am able to see the live stream on web browser using simple html iframe. Now I need to move my webserver to public server and I will not be able to do port forwarding with raspberryPi to show the live on web-page.
Is there any way to stream a video feed to we-browser where the server is publicly accessible.
I have found the webRTC. Is there any quicker why available to make stream a camera feed to website. That is peer to peer connection between a web Browser and raspbarryPi where no port forwarding can be do at raspbarryPi.
Make port public using ngrok.com
This tool can make a port publicly accessible without router access. It creates a link from where you can see your current link to your webcam. The free version of ngrok do have some limitations like that max amount of new connections per minute.
Port forwarding through VPS using ssh
In Godaddy you can also create an ubuntu system. You can open ports on this system for it to be accessible from anywhere. Then on your raspberry-pi you can run ssh -L [public-port]:localhost:[private-port] [youruser]#[server-ip] example: ssh -L 3000:localhost:3000 myuser#mywebsite.com. This would make your project on the raspberry pi on port 3000 be accessible with "mywebsite.com:3000"
I know it's an old question, but will answer for the late me.
I answered a similar question here. It boils down to:
/usr/bin/autossh -N -f -M 0 -i /home/pi/.ssh/id_rsa -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -R 10554:192.168.1.100:554 root#example.com
where:
-N: don't execute any command via SSH
-f: put SSH in the background
-R: remote port forwarding
10554: a port to open on the VPS to access the IP camera (better if > 1024)
192.168.1.100:554: IP address and port you want to access remotely
root#example.com: user and address of your VPS
To access the RTSP stream of the camera, open rtsp://<username>:<password>#example.com:10554/<path-to-stream>.
Of course it works fine also for other kind of streams (e.g. HTTP).

JavaScript GetUserMedia using Chrome with localhost without HTTPS

I didn't know how to express it in the title, but I'm having an issue with Chrome.
I'm trying to use GetUserMedia() and GetPosition() in Chrome. I know that it requires SSL certification first, unless you're on localhost. The thing is, I can't try my project on my computer, so I must use my smart phone, and in order to access localhost through my smartphone, I must use the machine's IP address (192.168.1.4). The problem is that Chrome doesn't consider this IP address as localhost, so it requires an SSL certificate.
Is there any way I can test my project on my smartphone without having to install an SSL certififcate?
Add your IP address to Chrome's Insecure origins treated as secure setting.
Go to chrome://flags/#unsafely-treat-insecure-origin-as-secure in Chrome.
Find the Insecure origins treated as secure setting.
Enable it.
Enter in http://cntral.me:3000.
Relaunch Chrome.
Voila!
See https://medium.com/#Carmichaelize/enabling-the-microphone-camera-in-chrome-for-local-unsecure-origins-9c90c3149339 for a good walkthrough as well.
You can use a service like https://ngrok.com/ to map a public DNS address with SSL certificate to a port on your local machine.
I assume you're trying to host a Web service on a computer and access it from a smart phone using the hostname localhost.
Two options come to mind:
First, if your smart phone is rooted, you can change /etc/hosts so that the name localhost resolves to 192.168.1.4 instead of to 127.0.0.1.
Second, if you can run an SSH server on your computer, you can set up an SSH client on your phone to forward traffic on some port to another port on a different machine.
For example, in ConnectBot for Android, you can
create a profile for your computer running an SSH server on 192.168.1.4
long-press the profile, and select "Edit port forwards" and then "Add port forward" from the port forwarding menu
configure it to "Local" and then choose a local source port that can be claimed by a non-root user on your phone (say, 8080) and on the bottom line, use localhost:80 (or whatever port the computer is running the service on) to make the SSH server have the forwarding tunnel direct to itself on port 80
This will cause all traffic directed at localhost:8080 on your phone to go to 192.168.1.4:80 on your computer. The browser has no idea that the localhsot:8080 service is actually just an SSH tunnel to 192.168.1.4:80, so it will treat it like any other localhost address.
You can do this without an SSL certificate at all by tunneling the webserver to your phone's localhost.
I use termux to run this command (on the phone itself):
ssh -L 8080:localhost:8080 192.168.0.172
(Leave the ssh session open)
Then go to http://localhost:8080/ on your phone.
If you don't want the session to time out, you can use autossh:
autossh -M 0 -L 8080:localhost:8080 192.168.0.172
Important note: Your development machine (or dev server) needs to be accessible through ssh. For Linux, this can be done by installing open-ssh and enabling/starting the sshd service. You can look up guides for this online.

Categories