Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name WebSocket Inspector
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description try to take over the world!
- // @author kmccord1
- // @match *://*.io*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- window.console = console;
- window.WsI = {
- settings: {
- canSend: 1,
- logSend: 0,
- logRecieve: 0
- },
- sockets: []
- };
- WebSocket.prototype._send = WebSocket.prototype.send;
- WebSocket.prototype.send = function (data) {
- window.WsI.sockets.push(this);
- console.log("WebSocket Captured");
- if (window.WsI.settings.canSend == 1)
- {
- this._send(data);
- if (window.WsI.settings.logSend == 1)
- {
- var datas = new Uint8Array(data);
- console.log("%cSent:", "color: #009900");
- console.log(datas);
- }
- };
- this.addEventListener('message', function (msg) {
- if (window.WsI.settings.logRecieve == 1)
- {
- var datas = new Uint8Array(msg.data);
- console.log("%cRecieved:", "color: #FF4444");
- console.log(datas);
- }
- }, false);
- this.addEventListener('close', function () {
- console.log("WebSocket Closed");
- let i = window.WsI.sockets.indexOf(this);
- window.WsI.sockets.splice(i, 1);
- }, false);
- this.addEventListener('error', function () {
- console.error("WebSocket Had An Error And Closed");
- let i = window.WsI.sockets.indexOf(this);
- window.WsI.sockets.splice(i, 1);
- }, false);
- this.send = function (data) {
- if (window.WsI.settings.canSend == 1)
- {
- this._send(data);
- if (window.WsI.settings.logSend == 1)
- {
- var datas = new Uint8Array(data);
- console.log("%cSent:", "color: #009900");
- console.log(datas);
- }
- }else{
- if (window.WsI.settings.logSend == 1)
- {
- var dat = new Uint8Array(data);
- console.log("%cTried to send:", "color: #009900");
- console.log(dat);
- }
- }
- };
- }
- console.log("WebSocket Inspector by kmccord1 loaded");
- console.log("Type WsI in the console for settings");
- })();
- (window.bruteforce = {
- _running : 0,
- _stopped_at : "",
- sleep : function(ms){
- return new Promise(resolve => setTimeout(resolve, ms));
- },
- stop : async function(){
- this._running = 0;
- await this.sleep(1000);
- return "Stopped at " + this._stopped_at;
- },
- run : async function(name,start,end){
- this._running = 1;
- for(var i=window.encoder.toNumber(start);i++<=window.encoder.toNumber(end);){
- try{
- window.WsI.sockets[0].send("* /team join "+name+" "+window.encoder.fromNumber(i));
- }catch(err){
- this._stopped_at=window.encoder.fromNumber(i);
- return this._stopped_at;
- }
- if(i%100==0){
- await this.sleep(2);
- if(this._running==0){
- this._stopped_at=window.encoder.fromNumber(i);
- return;
- }
- }
- }
- },
- readpwlist : function(link){
- if(link==""){
- link="https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Leaked-Databases/rockyou-75.txt";
- }
- var rawFile = new XMLHttpRequest();
- rawFile.open("GET", link, false);
- rawFile.onreadystatechange = function ()
- {
- if(rawFile.readyState === 4)
- {
- if(rawFile.status === 200 || rawFile.status == 0)
- {
- //var allText = rawFile.responseText;
- window.pws = rawFile.responseText.split("\n");
- }
- }
- }
- rawFile.send(null);
- },
- trypws : async function(name,start,end){this._running = 1;
- if(end>window.pws.length){
- end=window.pws.length;
- }
- for(var i=start;i++<=end;){
- try{
- window.WsI.sockets[0].send("* /team join "+name+" "+window.pws[i]);
- }catch(err){
- this._stopped_at=i;
- return this._stopped_at;
- }
- if(i%100==0){
- await this.sleep(2);
- if(this._running==0){
- this._stopped_at=i;
- return;
- }
- }
- }
- },
- });
- (window.encoder = {
- _FullRixits :
- // 0 8 16 24 32 40 48 56 63
- // v v v v v v v v v
- "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_",
- _Rixits :
- // 0 8 16 24 32 40 48 56 63
- // v v v v v v v v v
- "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_",
- // You have the freedom, here, to choose the glyphs you want for
- // representing your base-64 numbers. The ASCII encoding guys usually
- // choose a set of glyphs beginning with ABCD..., but, looking at
- // your update #2, I deduce that you want glyphs beginning with
- // 0123..., which is a fine choice and aligns the first ten numbers
- // in base 64 with the first ten numbers in decimal.
- // This cannot handle negative numbers and only works on the
- // integer part, discarding the fractional part.
- // Doing better means deciding on whether you're just representing
- // the subset of javascript numbers of twos-complement 32-bit integers
- // or going with base-64 representations for the bit pattern of the
- // underlying IEEE floating-point number, or representing the mantissae
- // and exponents separately, or some other possibility. For now, bail
- _base : 63,
- updatebase : function(base){
- if(base>this._FullRixits.length){
- return false;
- }
- this._base = base;
- this._Rixits = this._FullRixits.slice(0,base);
- return this._Rixits;
- },
- fromNumber : function(number) {
- if (isNaN(Number(number)) || number === null ||
- number === Number.POSITIVE_INFINITY)
- {throw "The input is not valid";}
- if (number < 0)
- {throw "Can't represent negative numbers now";}
- var rixit; // like 'digit', only in some non-decimal radix
- var residual = Math.floor(number);
- var result = '';
- while (true) {
- rixit = residual % this._base
- // console.log("rixit : " + rixit);
- // console.log("result before : " + result);
- result = this._Rixits.charAt(rixit) + result;
- // console.log("result after : " + result);
- // console.log("residual before : " + residual);
- residual = Math.floor(residual / this._base);
- // console.log("residual after : " + residual);
- if (residual == 0){
- break;
- }
- }
- return result;
- },
- toNumber : function(rixits) {
- var result = 0;
- // console.log("rixits : " + rixits);
- // console.log("rixits.split('') : " + rixits.split(''));
- rixits = rixits.split('');
- for (var e = 0; e < rixits.length; e++) {
- // console.log("_Rixits.indexOf(" + rixits[e] + ") : " +
- // this._Rixits.indexOf(rixits[e]));
- // console.log("result before : " + result);
- result = (result * this._base) + this._Rixits.indexOf(rixits[e]);
- // console.log("result after : " + result);
- }
- return result;
- }
- });
- (window.spam = {
- _running : 0,
- start : async function(command){
- this._running = 1;
- i=0
- while(this._running){
- i++;
- window.WsI.sockets[0].send("* " + command);
- if(i%200==0){
- await bruteforce.sleep(1);
- if(this._running==0){
- return;
- }
- }
- }
- },
- stop : async function() {
- this._running = 0;
- },
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement