Javascript integration with Docker

yum install httpd
systemctl disable firewalld
setenforce 0
systemctl start httpd
cd /var/www/html
gedit <file_Name>.html
<script>
function lw()
{

var xhr=new XMLHttpRequest();
i=document.getElementById("in1").value;

xhr.open("GET","http://192.168.43.104/cgi-bin/lw.py?x="+i,true);
xhr.send();

xhr.onload=function (){
var output=xhr.responseText;
document.getElementById("d1").innerHTML=output;
}
}

</script>
cd /var/www/cgi-bin
gedit <file_Name.py>
#!/usr/bin/python3
import cgi
import subprocess
import time
print("content-type: text/html")
print()
print("Hello from backend")
print()
f=cgi.FieldStorage()
cmd=f.getvalue("x")
o=subprocess.getoutput("sudo "+ cmd)
print(o)
vim /etc/group
vim /etc/sudoers
chmod +x <file_name>.py
http://<IP Address>/<file_Name>.html

I Hope You Like It…

Thank You For Reading…

--

--

--

Lifelong learning technologies

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

CTSI is now Bridged to Avalanche!

Git clone fails in WSL 2

Top Languages for Software Engineering of 2021

circular prime number program in java

C.S Weekly 1: Envelope SVG

Create your own VM using Java Modules

Laravel: how to use services in other classes and how to properly decouple them to perform the…

A controller method with a dependency injected using new

Terraform vs Kubernetes — Everything You Need To Know

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Arnab Saha

Arnab Saha

Lifelong learning technologies

More from Medium

Node.Js Tutorial: A Quick Guide for Beginning Developers in 2020

Object vs JSON

Calling Stored Procedure with NodeJS and MSSQL

How to keep your Javascript projects safe -01