Remote_Cmd / index.html
sayarukshan's picture
Upload 2 files
0267589 verified
Raw
History Blame Contribute Delete
3.4 kB
<!DOCTYPE html>
<html>
<head>
<title>Cyber Terminal Pro</title>
<style>
body {
background: #0d1117;
color: #00ffcc;
font-family: monospace;
text-align: center;
}
h1 {
color: #58a6ff;
}
.container {
width: 600px;
margin: auto;
}
.card {
background: #161b22;
padding: 20px;
margin: 20px 0;
border-radius: 15px;
box-shadow: 0 0 15px #00ffcc33;
}
input, button {
padding: 10px;
border-radius: 8px;
border: none;
margin: 5px;
}
input[type="text"] {
width: 70%;
}
button {
background: #238636;
color: white;
cursor: pointer;
}
button:hover {
background: #2ea043;
}
#output {
background: black;
padding: 15px;
height: 300px;
overflow-y: auto;
border-radius: 10px;
text-align: left;
}
</style>
</head>
<body>
<h1>⚑ Ubuntu Web Control Panel</h1>
<div class="container">
<div class="card">
<h3>πŸ’» Run Command</h3>
<input type="text" id="cmd" placeholder="Enter command">
<button onclick="runCmd()">Run</button>
</div>
<div class="card">
<h3>πŸ“ Upload File (/app)</h3>
<input type="file" id="fileInput">
<button onclick="uploadFile()">Upload</button>
</div>
<div class="card">
<h3>⬇️ Download File (/app)</h3>
<input type="text" id="downloadFile" placeholder="Enter filename">
<button onclick="downloadFile()">Download</button>
</div>
<div class="card">
<h3>πŸ“œ Output</h3>
<pre id="output">Ready...</pre>
</div>
</div>
<script>
async function runCmd() {
const cmd = document.getElementById("cmd").value;
const output = document.getElementById("output");
if (!cmd) {
output.textContent = "❌ Enter command";
return;
}
output.textContent = "⏳ Running...";
const res = await fetch("/run", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({ cmd })
});
const data = await res.json();
output.textContent = data.error
? "❌ " + data.error
: "βœ… " + (data.output || "No output");
}
async function uploadFile() {
const fileInput = document.getElementById("fileInput");
const output = document.getElementById("output");
if (!fileInput.files.length) {
output.textContent = "❌ Select file";
return;
}
const formData = new FormData();
formData.append("file", fileInput.files[0]);
output.textContent = "⏳ Uploading...";
const res = await fetch("/upload", {
method: "POST",
body: formData
});
const data = await res.json();
output.textContent = data.error
? "❌ " + data.error
: "βœ… " + data.output;
}
function downloadFile() {
const filename = document.getElementById("downloadFile").value;
if (!filename) {
alert("Enter file name");
return;
}
window.open(`/download?file=${encodeURIComponent(filename)}`, "_blank");
}
</script>
</body>
</html>