diff --git a/scripts/straightup_dontknow.js b/scripts/straightup_dontknow.js new file mode 100644 index 0000000..dc5c5c7 --- /dev/null +++ b/scripts/straightup_dontknow.js @@ -0,0 +1,100 @@ +self['tp_pjgudQvFAcE_func'] = function(frame){ + if (frame === null) { + console.error("Frame is null"); + return; + } + + if (!frame['tp_pjgudQvFAcE_done']) { + (function(frame, settings){ + if (!frame.navigator) return; + + function doUpdateProp(obj, prop, newVal){ + let props = Object.getOwnPropertyDescriptor(obj, prop) || {configurable:true}; + + if (!props["configurable"]) { + //console.warn("Issue with property not being able to be configured."); + return; + } + + props["value"] = newVal; + Object.defineProperty(obj, prop, props); + + return props; + } + + if (settings["deviceEnumeration"]["enabled"]){ + doUpdateProp(frame.navigator, "webkitGetUserMedia", undefined); + + if (frame.navigator.mediaDevices){ + doUpdateProp(frame.navigator.mediaDevices, "enumerateDevices", undefined); + } + + if (frame.MediaStreamTrack){ + doUpdateProp(frame.MediaStreamTrack, "getSources", undefined); + doUpdateProp(frame.MediaStreamTrack, "getMediaDevices", undefined); + } + } + + if (settings["wrtcPeerConnection"]["enabled"] === true && frame.RTCPeerConnection){ + doUpdateProp(frame, "RTCPeerConnection", function(){ + //window.top.postMessage("trace-protection::ran::webrtcpeerconnection::main", '*'); + console.log("%c [Tr]->Protected[RTCPeerConnection] ","font-size:1em;line-height:2em;color:#1a1a1a;background-color:#ffffff;border:.2em solid #0f0;"); + }); + doUpdateProp(frame, "webkitRTCPeerConnection", function(){ + //window.top.postMessage("trace-protection::ran::webrtcpeerconnection::main", '*'); + console.log("%c [Tr]->Protected[RTCPeerConnection] ","font-size:1em;line-height:2em;color:#1a1a1a;background-color:#ffffff;border:.2em solid #0f0;"); + }); + } + + if (settings["wrtcDataChannel"]["enabled"] === true && frame.RTCDataChannel){ + doUpdateProp(frame, "RTCDataChannel", function(){ + //window.top.postMessage("trace-protection::ran::webrtcdataconnection::main", '*'); + console.log("%c [Tr]->Protected[RTCDataChannel] ","font-size:1em;line-height:2em;color:#1a1a1a;background-color:#ffffff;border:.2em solid #0f0;"); + }); + } + + if (settings["wrtcRtpReceiver"]["enabled"] === true && frame.RTCRtpReceiver){ + doUpdateProp(frame, "RTCRtpReceiver", function(){ + //window.top.postMessage("trace-protection::ran::webrtcrtpreceiver::main", '*'); + console.log("%c [Tr]->Protected[RTCRtpReceiver] ","font-size:1em;line-height:2em;color:#1a1a1a;background-color:#ffffff;border:.2em solid #0f0;"); + }); + } + })(frame,{"deviceEnumeration":{"enabled":true},"enabled":true,"wrtcDataChannel":{"enabled":false},"wrtcInternal":{"enabled":true},"wrtcPeerConnection":{"enabled":false},"wrtcRtpReceiver":{"enabled":false}}); + } else { + frame['tp_pjgudQvFAcE_done'] = true; + //console.log(frame); + } + }; + + //console.log(window); + //console.log(self); + self['tp_pjgudQvFAcE_func'](window); + //self['tp_pjgudQvFAcE_func'](self); + + ["HTMLIFrameElement","HTMLFrameElement"].forEach(function(el) { + var wind = self[el].prototype.__lookupGetter__('contentWindow'), + cont = self[el].prototype.__lookupGetter__('contentDocument'); + + Object.defineProperties(self[el].prototype,{ + contentWindow:{ + get:function(){ + if (this.src && this.src.indexOf('//') !== -1 && location.host !== this.src.split('/')[2]) return wind.apply(this); + + let frame = wind.apply(this); + if (frame) self['tp_pjgudQvFAcE_func'](frame); + + return frame; + } + }, + contentDocument:{ + get:function(){ + if (this.src && this.src.indexOf('//') !== -1 && location.host !== this.src.split('/')[2]) return cont.apply(this); + + let frame = cont.apply(this); + if (frame) self['tp_pjgudQvFAcE_func'](frame); + + return frame; + } + } + }); + }); \ No newline at end of file