Advertisement
Guest User

Untitled

a guest
May 26th, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. <html>
  2.  
  3. <head>
  4.  
  5. <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
  6. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  7. <link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
  8. <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
  9. <script src="//cdn.rawgit.com/chjj/term.js/0b10f6c55d5113d50d0ff94b6c38a46375a5f9a5/src/term.js"></script>
  10. <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
  11. <style>
  12. body {
  13. background-color: #000;
  14. }
  15.  
  16. .terminal {
  17. border: #000 solid 5px;
  18. font-family: "DejaVu Sans Mono", "Liberation Mono", monospace;
  19. font-size: 11px;
  20. color: #f0f0f0;
  21. background: #000;
  22. }
  23.  
  24. .terminal-cursor {
  25. color: #000;
  26. background: #f0f0f0;
  27. }
  28. </style>
  29.  
  30. <script type="text/javascript">
  31. $(function() {
  32.  
  33. var websocket = new WebSocket("ws://" + window.location.hostname + ":" + window.location.port + "/exec/" + prompt("cid"));
  34.  
  35. websocket.onopen = function(evt) {
  36. var term = new Terminal({
  37. cols: 100,
  38. rows: 30,
  39. screenKeys: true,
  40. useStyle: true,
  41. cursorBlink: true,
  42. });
  43. term.on('data', function(data) {
  44. websocket.send(data);
  45. });
  46. term.on('title', function(title) {
  47. document.title = title;
  48. });
  49. term.open(document.getElementById('container-terminal'));
  50. websocket.onmessage = function(evt) {
  51. term.write(evt.data);
  52. }
  53. websocket.onclose = function(evt) {
  54. term.write("Session terminated");
  55. term.destroy();
  56. }
  57. websocket.onerror = function(evt) {
  58. if (typeof console.log == "function") {
  59. console.log(evt)
  60. }
  61. }
  62. }
  63. });
  64. </script>
  65. </head>
  66. <div id="container-terminal"></div>
  67.  
  68. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement