Newer
Older
DirtyScripts / WSSSnoop.html
root on 2 Feb 2022 4 KB added WSSSnoop
  1. <html>
  2. <head>
  3. <title>WSSSnoop</title>
  4. <style type="text/css">
  5. body{
  6. background-color: #333;
  7. color:#bbb;
  8. margin:0;
  9.  
  10. }
  11. .topBar {
  12. background-color: #444;
  13. position:fixed;
  14. top:0;
  15. width:100%;
  16. z-index:100;
  17. padding: 10px;
  18. }
  19. .topTitle{
  20. position:absolute;
  21. top:10px;
  22. left:10px;
  23. color:#7fffd4;
  24. }
  25. .topcorner{
  26. position:absolute;
  27. top:10px;
  28. right:30px;
  29. }
  30. #cswsh-output{
  31. margin-top: 50px !important;
  32. font-family: 'Source Code Pro',
  33. sans-serif;font-size: 0.7em;
  34. padding-bottom: 50px;
  35. padding-left: 10px;
  36. }
  37. .bottomBar {
  38. background-color: #444;
  39. position:fixed;
  40. bottom:0;
  41. width:100%;
  42. z-index:100;
  43. padding: 10px;
  44. height: 20px;
  45. }
  46. .bottomClear{
  47. position:absolute;
  48. bottom:10px;
  49. right:30px;
  50. }
  51. a:link,a:visited {
  52. color: #00ccff;
  53. text-decoration: none;
  54. }
  55. /* mouse over link */
  56. a:hover, a:active {
  57. color: #99ebff;
  58. text-decoration: none;
  59. }
  60. </style>
  61. <link href='http://fonts.googleapis.com/css?family=Source+Code+Pro' rel='stylesheet' type='text/css'>
  62. </head>
  63. <body>
  64. <div class="topBar">
  65. <div class="topTitle">
  66. WSSSnoop
  67. </div>
  68. <center>
  69. <input type="text" name="cswshURL" id="cswshURL" value="" placeholder="wss://snoop.me">
  70. <input type="button" id="startSnoop" value="start snooping" onclick="checkCSWSH()"/>
  71. <input type="button" id="stopSnoop" value="stop snooping" style="display:none" onclick="stopSnooping()"/>
  72. <br />
  73. <div class="topcorner">
  74. Status: <div id="status" style="display:inline-block; color:red"/>Offline</div>
  75. </div>
  76. </center>
  77. </div>
  78.  
  79. <div id="cswsh-output" ></div>
  80. <div class="bottomBar">
  81. By <a href="https://rossmarks.uk" target="_new">Ross Marks</a>
  82. <div class="bottomClear">
  83. <input type="button" id="clearPage" value="clear page" onclick="clearPage();"/>
  84. </div>
  85. </div>
  86.  
  87. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
  88. <script>
  89. function clearPage(){
  90. $('#cswsh-output').empty();
  91. $('html, body').scrollTop($(document).height());
  92. }
  93.  
  94. function stopSnooping(){
  95. $('#startSnoop').show();
  96. $('#stopSnoop').hide();
  97. websocket.close();
  98. }
  99.  
  100. function checkCSWSH(){
  101. var wsUri = $("#cswshURL").val();
  102. $('#startSnoop').hide();
  103. $('#stopSnoop').show();
  104. statusWaiting();
  105. websocket = new WebSocket(wsUri);
  106. websocket.onopen = function(evt) { onOpen(evt) };
  107. websocket.onclose = function(evt) { onClose(evt) };
  108. websocket.onmessage = function(evt) { onMessage(evt) };
  109. websocket.onerror = function(evt) { onError(evt) };
  110. }
  111.  
  112. function onOpen(evt){
  113. writeToScreen("CONNECTED");
  114. statusConnected()
  115. doSend("origin policy unchecked!");
  116. }
  117.  
  118. function onClose(evt){
  119. writeToScreen("DISCONNECTED");
  120. statusOffline()
  121. if( $('#stopSnoop').css('display') != 'none' ){
  122. checkCSWSH()
  123. }
  124. }
  125.  
  126. function onMessage(evt){
  127. writeToScreen('<span style="color: #A7E734;">RESPONSE: ' + evt.data+'</span>');
  128. //websocket.close();
  129. }
  130.  
  131. function onError(evt){
  132. writeToScreen('<span style="color: red;">ERROR:</span> ' + evt.data);
  133. }
  134.  
  135. function doSend(message){
  136. writeToScreen("SENT: " + message);
  137. websocket.send(message);
  138. }
  139.  
  140. function writeToScreen(message){
  141. output = document.getElementById("cswsh-output");
  142. var pre = document.createElement("div");
  143. pre.style.wordWrap = "break-word";
  144. pre.innerHTML = message;
  145. output.appendChild(pre);
  146. $('html, body').scrollTop($(document).height());
  147. }
  148.  
  149. function statusConnected(){
  150. $('#status').html("Connected");
  151. $('#status').css("color","lightgreen");
  152. }
  153. function statusOffline(){
  154. $('#status').html("Offline");
  155. $('#status').css("color","red");
  156. }
  157. function statusWaiting(){
  158. $('#status').html("Waiting...");
  159. $('#status').css("color","yellow");
  160. }
  161. </script>
  162. </body>
  163. </html>
Buy Me A Coffee