File size: 1,584 Bytes
bf504ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Command Runner</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
        }
        input[type="text"] {
            width: 300px;
            padding: 10px;
            margin-right: 10px;
        }
        button {
            padding: 10px 15px;
        }
        pre {
            background-color: #f4f4f4;
            padding: 10px;
            border: 1px solid #ccc;
            white-space: pre-wrap;
            word-wrap: break-word;
        }
    </style>
</head>
<body>
    <h1>Run a Command</h1>
    <form id="command-form">
        <input type="text" id="command" name="command" placeholder="Enter command here" required>
        <button type="submit">Run</button>
    </form>
    <h2>Output:</h2>
    <pre id="output"></pre>

    <script>
        document.getElementById('command-form').addEventListener('submit', function(event) {
            event.preventDefault();
            const command = document.getElementById('command').value;
            fetch(`/run?command=${encodeURIComponent(command)}`)
                .then(response => response.text())
                .then(data => {
                    document.getElementById('output').textContent = data;
                })
                .catch(error => {
                    document.getElementById('output').textContent = `Error: ${error}`;
                });
        });
    </script>
</body>
</html>