Spaces:
BG5
/
Sleeping

File size: 928 Bytes
643de08
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Interactive WebShell</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js"></script>
</head>
<body>
    <h1>Interactive Web</h1>
    <input type="text" id="command" placeholder="Enter command" style="width: 80%;">
    <button onclick="executeCommand()">Execute</button>
    <h2>Output:</h2>
    <pre id="output"></pre>

    <script>
        var socket = io();

        function executeCommand() {
            var command = document.getElementById('command').value;
            socket.emit('execute_command', command);
        }

        socket.on('command_output', function(data) {
            var output = document.getElementById('output');
            output.innerHTML += data.output + '\n';
        });
    </script>
</body>
</html>