51
loading...
This website collects cookies to deliver better user experience
<div class="center-docker">
<div class="d-flex justify-content-center">
<div class="searchbar text-white">
[root @localhost~]# <input id="inp" class="search_input text-white" type="text" name="" placeholder="Enter the command">
<a onclick="lw()" class="search_icon">
<i class="fas fa-arrow-right" aria-hidden="true"></i>
</a>
</div>
</div>
</div>
<script>
function lw() {
var i = document.getElementById("inp").value
var xhr = new XMLHttpRequest();
xhr.open("GET","http://localhostIP/cgi-bin/PIPOS/docker.py?x="+i,true);
xhr.send();
xhr.onload = function() {
var output = xhr.responseText;
document.getElementById("d1").innerHTML = output;
}
}
</script>
import cgi
import subprocess
import time
print("context-type: text/html")
print()
#print("let's build something new Nitesh")#here now if now I change anything it will change in page without refreshing
#time.sleep(10) #this holds program for 10 seconds and then run the prog auto
f=cgi.FieldStorage()
cmd=f.getvalue("x")
#print(cmd)
o = subprocess.getoutput("sudo " +cmd)
print(o)
<div class="center-docker">
<div class="d-flex justify-content-center">
<div class="searchbar text-white">
[root @localhost~]# <input class="search_input text-white" id="inp1" type="text" name="" placeholder="Enter the command">
<a onclick="lw()" class="search_icon">
<i class="fa fa-arrow-right" aria-hidden="true"></i>
</a>
</div>
</div>
</div>
import cgi
import subprocess as sp
import time
print("context-type: text/html")
print()
#print("let's build something new Nitesh")#here now if now I change anything it will change in page without refreshing
#time.sleep(10) #this holds program for 10 seconds and then run the prog auto
f=cgi.FieldStorage()
#print(cmd)
#cmd = f.getvalue("x")
#o = subprocess.getoutput(cmd + " --kubeconfig admin.conf")
#print(o)
query = f.getvalue("x")
if "show pods" in query:
cmd = "kubectl get pods --kubeconfig admin.conf"
o=sp.getoutput(cmd)
print(o)
elif "show deployment" in query:
cmd = "kubectl get deployments --kubeconfig admin.conf"
o = sp.getoutput(cmd)
print(o)