| <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> |