├── .gitattributes ├── LICENSE ├── README.md ├── background.js ├── content_key_decryption.js ├── content_script.js ├── eme_interception.js ├── inject.js ├── jquery.js ├── lib ├── cryptojs-aes_0.2.0.min.js └── pbf.3.0.5.min.js ├── manifest.json ├── popup.html ├── protobuf-generated └── license_protocol.proto.js ├── script.js ├── style.css └── wasm ├── wasm_gsr.js └── wasm_gsr.wasm /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Tomer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Is a modified version of the orginal extension, it stores all the keys for each website separately, only adds nonexistent keys to the key list, all keys remain saved even if you close the browser, and you can download the entire list as json file. 2 | 3 | ![widevine-gui](https://user-images.githubusercontent.com/50900028/128651243-b55b4e97-90e9-4825-a475-f57b93191f24.png) 4 | -------------------------------------------------------------------------------- /background.js: -------------------------------------------------------------------------------- 1 | var listeners = {}; 2 | var mpdurl = ""; 3 | var sourcedomain = "https://*"; 4 | chrome.tabs.onActivated.addListener( function(info) { 5 | var tabId = info.tabId; 6 | if (Object.keys(listeners).length === 0) { 7 | chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { 8 | var mytab = tabs[0]; 9 | var currenturl = mytab.url; 10 | if(currenturl){ 11 | var domain = (new URL(currenturl)); 12 | sourcedomain = domain.origin; 13 | } 14 | //console.log(mytab); 15 | }); 16 | listeners[tabId] = function(details) { 17 | //console.info("URL :" + details.url); 18 | if(details.url.indexOf(".mpd") != -1){ 19 | console.info("URL :" + details.url); 20 | mpdurl = details.url; 21 | chrome.cookies.set({ url: sourcedomain, name: "last_mpd", value: mpdurl }); 22 | } 23 | }; 24 | chrome.webRequest.onCompleted.addListener(listeners[tabId], { 25 | urls: [''], 26 | tabId: tabId 27 | }, []); 28 | } 29 | }); 30 | 31 | chrome.tabs.onActiveChanged.addListener( function(tabId, info) { 32 | for (var x in listeners){ 33 | if(!listeners[x].hasOwnProperty(tabId)){ 34 | chrome.webRequest.onCompleted.removeListener(listeners[x]); 35 | delete listeners[x]; 36 | } else{ 37 | chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { 38 | var mytab = tabs[0]; 39 | var currenturl = mytab.url; 40 | if(currenturl){ 41 | var domain = (new URL(currenturl)); 42 | sourcedomain = domain.origin; 43 | } 44 | //console.log(mytab); 45 | }); 46 | listeners[tabId] = function(details) { 47 | //console.info("URL :" + details.url); 48 | if(details.url.indexOf(".mpd") != -1){ 49 | console.info("URL :" + details.url); 50 | mpdurl = details.url; 51 | chrome.cookies.set({ url: sourcedomain, name: "last_mpd", value: mpdurl }); 52 | } 53 | }; 54 | chrome.webRequest.onCompleted.addListener(listeners[tabId], { 55 | urls: [''], 56 | tabId: tabId 57 | }, []); 58 | } 59 | } 60 | }); 61 | 62 | chrome.tabs.onRemoved.addListener(function(tabId) { 63 | if (listeners[tabId]) { 64 | chrome.webRequest.onCompleted.removeListener(listeners[tabId]); 65 | delete listeners[tabId]; 66 | } 67 | }); -------------------------------------------------------------------------------- /content_key_decryption.js: -------------------------------------------------------------------------------- 1 | /* 2 | This is where the magic happens 3 | */ 4 | 5 | 6 | var WidevineCrypto = {}; 7 | var _freeStr, stringToUTF8, writeArrayToMemory, UTF8ToString, stackSave, stackRestore, stackAlloc; 8 | 9 | 10 | // Convert a hex string to a byte array 11 | function hexToBytes(hex) { 12 | for (var bytes = [], c = 0; c < hex.length; c += 2) 13 | bytes.push(parseInt(hex.substr(c, 2), 16)); 14 | return bytes; 15 | } 16 | 17 | 18 | window.getCookie = function(name) { 19 | var match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)')); 20 | if (match) return match[2]; 21 | } 22 | 23 | function SaveDataToLocalStorage(data) { 24 | var mpdurl = getCookie("last_mpd"); 25 | if(!data) { 26 | console.error('Console.save: No data') 27 | return; 28 | } 29 | var drm_keys = {}; 30 | drm_keys = JSON.parse(localStorage.getItem('drm_keys')); 31 | if(!drm_keys) { 32 | localStorage.setItem("drm_keys", "{}"); 33 | drm_keys = {}; 34 | } 35 | for (var y in data) { 36 | var kid = [y]; 37 | var key = data[y]; 38 | drm_keys[kid] = [key, mpdurl]; 39 | } 40 | localStorage.setItem('drm_keys', JSON.stringify(drm_keys)); 41 | } 42 | 43 | // Convert a byte array to a hex string 44 | function bytesToHex(bytes) { 45 | for (var hex = [], i = 0; i < bytes.length; i++) { 46 | var current = bytes[i] < 0 ? bytes[i] + 256 : bytes[i]; 47 | hex.push((current >>> 4).toString(16)); 48 | hex.push((current & 0xF).toString(16)); 49 | } 50 | return hex.join(""); 51 | } 52 | 53 | 54 | 55 | (async function() { 56 | 57 | // The public 2048-bit RSA key Widevine uses for Chrome devices in L3, on Windows 58 | WidevineCrypto.initLog=function() 59 | { 60 | try 61 | { 62 | if(document.body) 63 | { 64 | var i = document.createElement('iframe'); i.style.display = 'none'; document.body.appendChild(i); 65 | window.sconsole = i.contentWindow.console; 66 | if (window.sconsole) 67 | this._log=window.sconsole.log; 68 | } 69 | 70 | } 71 | catch 72 | { 73 | console.info("Init log failed"); 74 | } 75 | } 76 | WidevineCrypto._log=null; 77 | WidevineCrypto.log=function() { 78 | if(this._log) 79 | { 80 | this._log.apply(null,arguments); 81 | return; 82 | } 83 | if (window.sconsole) 84 | this._log=window.sconsole.log; 85 | else 86 | this.initLog() 87 | if(this._log) 88 | { 89 | this._log.apply(null,arguments); 90 | } 91 | else 92 | { 93 | //fallback 94 | console.log.apply(null,arguments); 95 | } 96 | } 97 | 98 | WidevineCrypto.Module= await WasmDsp(); 99 | await WidevineCrypto.Module.ready; 100 | _freeStr=WidevineCrypto.Module._freeStr; 101 | stringToUTF8=WidevineCrypto.Module.stringToUTF8; 102 | writeArrayToMemory=WidevineCrypto.Module.writeArrayToMemory; 103 | UTF8ToString=WidevineCrypto.Module.UTF8ToString; 104 | stackSave=WidevineCrypto.Module.stackSave; 105 | stackRestore=WidevineCrypto.Module.stackRestore; 106 | stackAlloc=WidevineCrypto.Module.stackAlloc; 107 | 108 | WidevineCrypto.getCFunc = function (ident) { 109 | return this.Module[`_${ident}`]; // closure exported function 110 | } 111 | WidevineCrypto.scall = function (ident, returnType, argTypes, args, opts) { 112 | const toC = { 113 | string (str) { 114 | let ret = 0; 115 | if (str !== null && str !== undefined && str !== 0) { 116 | const len = (str.length << 2) + 1; 117 | ret = stackAlloc(len); 118 | stringToUTF8(str, ret, len); 119 | } 120 | return ret; 121 | }, 122 | array (arr) { 123 | const ret = stackAlloc(arr.length); 124 | writeArrayToMemory(arr, ret); 125 | return ret; 126 | } 127 | }; 128 | function convertReturnValue (ret) { 129 | if (returnType === 'string') return UTF8ToString(ret); 130 | if (returnType === 'boolean') return Boolean(ret); 131 | return ret; 132 | } 133 | const func = this.getCFunc(ident); 134 | const cArgs = []; 135 | let stack = 0; 136 | if (args) { 137 | for (let i = 0; i < args.length; i++) { 138 | const converter = toC[argTypes[i]]; 139 | if (converter) { 140 | if (stack === 0) stack = stackSave(); 141 | cArgs[i] = converter(args[i]); 142 | } else { 143 | cArgs[i] = args[i]; 144 | } 145 | } 146 | } 147 | const _ret = func.apply(null, cArgs); 148 | const ret = convertReturnValue(_ret); 149 | _freeStr(_ret); 150 | if (stack !== 0) stackRestore(stack); 151 | return ret; 152 | } 153 | WidevineCrypto.swrap=function (ident, returnType, argTypes, opts) { 154 | argTypes = argTypes || []; 155 | const numericArgs = argTypes.every((type) => type === 'number'); 156 | const numericRet = returnType !== 'string'; 157 | if (numericRet && numericArgs && !opts) { 158 | return this.getCFunc(ident); 159 | } 160 | return function () { 161 | 162 | return this.scall(ident, returnType, argTypes, arguments, opts); 163 | }; 164 | } 165 | WidevineCrypto.tryUsingDecoder = WidevineCrypto.swrap('tryUsingDecoder', 'string', ['string']); 166 | 167 | 168 | WidevineCrypto.chromeRSAPublicKey = 169 | `-----BEGIN PUBLIC KEY----- 170 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvKg9eT9JPEnfVYYS50x3 171 | MZirSQHyA2m/rxWY1x42LvE6ub47TU1zxjN4VC0jvrpWrU1YnB5/FR4lz296OPj/ 172 | H/SR1dLfyXFhe22VWUBuOlEnsq693qll4N/PTFCuJByvnoe/4zsNthm1w5XjmG4x 173 | CjJ4+ZC0E5pCGvdLPk4VSCUN7I8XVbA45hBp4lR5g+2Th4VJtKn1+qG+9yp1qZKf 174 | pyQPseRrlYcXDvmTwpw18fFF5Vv+wN6F0rlAnWWZscNIv3bdRBq9UwM0deMmf5Fk 175 | fCWE2XTTrXuMDDNxFVbWws8jv3kFsXpoxiKgWApiPBr59EYpTV8t5Qch2F619Jtw 176 | EwIDAQAB 177 | -----END PUBLIC KEY-----`; 178 | 179 | // The private 2048-bit RSA key Widevine uses for authenticating Chrome devices in L3, on Windows 180 | // Could not extract it completely, so resorted to clumsy code lifting 181 | 182 | 183 | WidevineCrypto.initializeKeys = async function() 184 | { 185 | // load the device RSA keys for various purposes 186 | this.publicKeyEncrypt = await crypto.subtle.importKey('spki', PEM2Binary(this.chromeRSAPublicKey), {name: 'RSA-OAEP', hash: { name: 'SHA-1' },}, true, ['encrypt']); 187 | this.publicKeyVerify = await crypto.subtle.importKey('spki', PEM2Binary(this.chromeRSAPublicKey), {name: 'RSA-PSS', hash: { name: 'SHA-1' },}, true, ['verify']); 188 | 189 | this.keysInitialized = true; 190 | } 191 | WidevineCrypto.tryDecodingKey=async function(encKey) 192 | { 193 | 194 | let hex=bytesToHex(encKey); 195 | let res=this.tryUsingDecoder(hex); 196 | this.log(hex); 197 | 198 | this.log("Output"); 199 | this.log(res); 200 | if(res.length<10) 201 | { 202 | throw "Could not remove padding, probably invalid key or decoding failure" 203 | } 204 | return new Uint8Array(hexToBytes(res)); 205 | } 206 | 207 | WidevineCrypto.decryptContentKey = async function(licenseRequest, licenseResponse) 208 | { 209 | await this.initLog(); 210 | licenseRequest = SignedMessage.read(new Pbf(licenseRequest)); 211 | licenseResponse = SignedMessage.read(new Pbf(licenseResponse)); 212 | //console.log("Decrypting?") 213 | //console.log("Request (from us)") 214 | this.log(licenseRequest) 215 | //console.log("Response") 216 | this.log(licenseResponse) 217 | if (licenseRequest.type != SignedMessage.MessageType.LICENSE_REQUEST.value) return; 218 | 219 | license = License.read(new Pbf(licenseResponse.msg)); 220 | 221 | if (!this.keysInitialized) await this.initializeKeys(); 222 | 223 | // make sure the signature in the license request validates under the private key 224 | var signatureVerified = await window.crypto.subtle.verify({name: "RSA-PSS", saltLength: 20,}, this.publicKeyVerify, 225 | licenseRequest.signature, licenseRequest.msg) 226 | if (!signatureVerified) 227 | { 228 | this.log("Can't verify license request signature; either the platform is wrong or the key has changed!"); 229 | return null; 230 | } 231 | var sessionKey=await this.tryDecodingKey(licenseResponse.session_key); 232 | // decrypt the session key 233 | // = await crypto.subtle.decrypt({name: "RSA-OAEP"}, this.privateKeyDecrypt, licenseResponse.session_key); 234 | 235 | // calculate context_enc 236 | var encoder = new TextEncoder(); 237 | var keySize = 128; 238 | var context_enc = concatBuffers([[0x01], encoder.encode("ENCRYPTION"), [0x00], licenseRequest.msg, intToBuffer(keySize)]); 239 | 240 | // calculate encrypt_key using CMAC 241 | var encryptKey = wordToByteArray( 242 | CryptoJS.CMAC(arrayToWordArray(new Uint8Array(sessionKey)), 243 | arrayToWordArray(new Uint8Array(context_enc))).words); 244 | 245 | // iterate the keys we got to find those we want to decrypt (the content key(s)) 246 | 247 | var contentKeys = []; 248 | var mykeys = {}; 249 | var strkeys = ""; 250 | for (currentKey of license.key) 251 | { 252 | if (currentKey.type != License.KeyContainer.KeyType.CONTENT.value) continue; 253 | 254 | var keyId = currentKey.id; 255 | var keyData = currentKey.key.slice(0, 16); 256 | var keyIv = currentKey.iv.slice(0, 16); 257 | 258 | // finally decrypt the content key 259 | var decryptedKey = wordToByteArray( 260 | CryptoJS.AES.decrypt({ ciphertext: arrayToWordArray(keyData) }, arrayToWordArray(encryptKey), { iv: arrayToWordArray(keyIv) }).words); 261 | 262 | contentKeys.push(decryptedKey); 263 | var hexiv = toHexString (keyId); 264 | var hexkey = toHexString (decryptedKey); 265 | strkeys += "--key " + hexiv + ":" + hexkey + "\r\n"; 266 | mykeys[hexiv] = hexkey; 267 | } 268 | console.log(strkeys); 269 | SaveDataToLocalStorage(mykeys); 270 | return contentKeys[0]; 271 | } 272 | 273 | // 274 | // Helper functions 275 | // 276 | 277 | async function isRSAConsistent(publicKey, privateKey) 278 | { 279 | // See if the data is correctly decrypted after encryption 280 | var testData = new Uint8Array([0x41, 0x42, 0x43, 0x44]); 281 | var encryptedData = await crypto.subtle.encrypt({name: "RSA-OAEP"}, publicKey, testData); 282 | var testDecryptedData = await crypto.subtle.decrypt({name: "RSA-OAEP"}, privateKey, encryptedData); 283 | 284 | return areBuffersEqual(testData, testDecryptedData); 285 | } 286 | 287 | function areBuffersEqual(buf1, buf2) 288 | { 289 | if (buf1.byteLength != buf2.byteLength) return false; 290 | var dv1 = new Int8Array(buf1); 291 | var dv2 = new Int8Array(buf2); 292 | for (var i = 0 ; i != buf1.byteLength ; i++) 293 | { 294 | if (dv1[i] != dv2[i]) return false; 295 | } 296 | return true; 297 | } 298 | 299 | function concatBuffers(arrays) 300 | { 301 | // Get the total length of all arrays. 302 | let length = 0; 303 | arrays.forEach(item => { 304 | length += item.length; 305 | }); 306 | 307 | // Create a new array with total length and merge all source arrays. 308 | let mergedArray = new Uint8Array(length); 309 | let offset = 0; 310 | arrays.forEach(item => { 311 | mergedArray.set(new Uint8Array(item), offset); 312 | offset += item.length; 313 | }); 314 | 315 | return mergedArray; 316 | } 317 | 318 | // CryptoJS format to byte array 319 | function wordToByteArray(wordArray) 320 | { 321 | var byteArray = [], word, i, j; 322 | for (i = 0; i < wordArray.length; ++i) { 323 | word = wordArray[i]; 324 | for (j = 3; j >= 0; --j) { 325 | byteArray.push((word >> 8 * j) & 0xFF); 326 | } 327 | } 328 | return byteArray; 329 | } 330 | 331 | // byte array to CryptoJS format 332 | function arrayToWordArray(u8Array) 333 | { 334 | var words = [], i = 0, len = u8Array.length; 335 | 336 | while (i < len) { 337 | words.push( 338 | (u8Array[i++] << 24) | 339 | (u8Array[i++] << 16) | 340 | (u8Array[i++] << 8) | 341 | (u8Array[i++]) 342 | ); 343 | } 344 | 345 | return { 346 | sigBytes: len, 347 | words: words 348 | }; 349 | } 350 | 351 | const toHexString = bytes => bytes.reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), ''); 352 | 353 | const intToBuffer = num => 354 | { 355 | let b = new ArrayBuffer(4); 356 | new DataView(b).setUint32(0, num); 357 | return Array.from(new Uint8Array(b)); 358 | } 359 | 360 | function PEM2Binary(pem) 361 | { 362 | var encoded = ''; 363 | var lines = pem.split('\n'); 364 | for (var i = 0; i < lines.length; i++) { 365 | if (lines[i].indexOf('-----') < 0) { 366 | encoded += lines[i]; 367 | } 368 | } 369 | var byteStr = atob(encoded); 370 | var bytes = new Uint8Array(byteStr.length); 371 | for (var i = 0; i < byteStr.length; i++) { 372 | bytes[i] = byteStr.charCodeAt(i); 373 | } 374 | return bytes.buffer; 375 | } 376 | 377 | }()); 378 | -------------------------------------------------------------------------------- /content_script.js: -------------------------------------------------------------------------------- 1 | var Cryplo = {}; 2 | injectScripts(); 3 | async function injectScripts() 4 | { 5 | await injectScript('lib/pbf.3.0.5.min.js'); 6 | await injectScript('lib/cryptojs-aes_0.2.0.min.js'); 7 | await injectScript('protobuf-generated/license_protocol.proto.js'); 8 | await injectScript('wasm/wasm_gsr.js'); 9 | await injectScript('content_key_decryption.js'); 10 | await injectScript('eme_interception.js'); 11 | } 12 | 13 | 14 | function injectScript(scriptName) 15 | { 16 | return new Promise(function(resolve, reject) 17 | { 18 | var s = document.createElement('script'); 19 | s.src = chrome.extension.getURL(scriptName); 20 | s.onload = function() { 21 | this.parentNode.removeChild(this); 22 | resolve(true); 23 | }; 24 | (document.head||document.documentElement).appendChild(s); 25 | }); 26 | } 27 | -------------------------------------------------------------------------------- /eme_interception.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Hooks EME calls and forwards them for analysis and decryption. 3 | * 4 | * Most of the code here was borrowed from https://github.com/google/eme_logger/blob/master/eme_listeners.js 5 | */ 6 | 7 | var lastReceivedLicenseRequest = null; 8 | var lastReceivedLicenseResponse = null; 9 | 10 | /** Set up the EME listeners. */ 11 | function startEMEInterception() 12 | { 13 | var listener = new EmeInterception(); 14 | listener.setUpListeners(); 15 | } 16 | 17 | /** 18 | * Gets called whenever an EME method is getting called or an EME event fires 19 | */ 20 | EmeInterception.onOperation = function(operationType, args) 21 | { 22 | //console.log(operationType); 23 | //console.log(args); 24 | if (operationType == "GenerateRequestCall") 25 | { 26 | // got initData 27 | //console.log(args); 28 | //console.log(args[1]); 29 | } 30 | else if (operationType == "MessageEvent") 31 | { 32 | var licenseRequest = args.message; 33 | lastReceivedLicenseRequest = licenseRequest; 34 | } 35 | else if (operationType == "UpdateCall") 36 | { 37 | var licenseResponse = args[0]; 38 | var lmsg=SignedMessage.read(new Pbf(licenseResponse)); 39 | //console.log(lmsg) 40 | lastReceivedLicenseResponse = licenseResponse; 41 | 42 | // OK, let's try to decrypt it, assuming the response correlates to the request 43 | WidevineCrypto.decryptContentKey(lastReceivedLicenseRequest, lastReceivedLicenseResponse); 44 | } 45 | }; 46 | 47 | 48 | /** 49 | * Manager for EME event and method listeners. 50 | * @constructor 51 | */ 52 | function EmeInterception() 53 | { 54 | this.unprefixedEmeEnabled = Navigator.prototype.requestMediaKeySystemAccess ? true : false; 55 | this.prefixedEmeEnabled = HTMLMediaElement.prototype.webkitGenerateKeyRequest ? true : false; 56 | } 57 | 58 | 59 | /** 60 | * The number of types of HTML Media Elements to track. 61 | * @const {number} 62 | */ 63 | EmeInterception.NUM_MEDIA_ELEMENT_TYPES = 3; 64 | 65 | 66 | /** 67 | * Sets up EME listeners for whichever type of EME is enabled. 68 | */ 69 | EmeInterception.prototype.setUpListeners = function() 70 | { 71 | if (!this.unprefixedEmeEnabled && !this.prefixedEmeEnabled) { 72 | // EME is not enabled, just ignore 73 | return; 74 | } 75 | if (this.unprefixedEmeEnabled) { 76 | this.addListenersToNavigator_(); 77 | } 78 | if (this.prefixedEmeEnabled) { 79 | // Prefixed EME is enabled 80 | } 81 | this.addListenersToAllEmeElements_(); 82 | }; 83 | 84 | 85 | /** 86 | * Adds listeners to the EME methods on the Navigator object. 87 | * @private 88 | */ 89 | EmeInterception.prototype.addListenersToNavigator_ = function() 90 | { 91 | if (navigator.listenersAdded_) 92 | return; 93 | console.log('Adding listeners to navigator'); 94 | var originalRequestMediaKeySystemAccessFn = EmeInterception.extendEmeMethod( 95 | navigator, 96 | navigator.requestMediaKeySystemAccess, 97 | "RequestMediaKeySystemAccessCall"); 98 | 99 | navigator.requestMediaKeySystemAccess = function() 100 | { 101 | var options = arguments[1]; 102 | 103 | // slice "It is recommended that a robustness level be specified" warning 104 | var modifiedArguments = arguments; 105 | var modifiedOptions = EmeInterception.addRobustnessLevelIfNeeded(options); 106 | modifiedArguments[1] = modifiedOptions; 107 | 108 | var result = originalRequestMediaKeySystemAccessFn.apply(null, modifiedArguments); 109 | // Attach listeners to returned MediaKeySystemAccess object 110 | return result.then(function(mediaKeySystemAccess) 111 | { 112 | this.addListenersToMediaKeySystemAccess_(mediaKeySystemAccess); 113 | return Promise.resolve(mediaKeySystemAccess); 114 | }.bind(this)); 115 | 116 | }.bind(this); 117 | if(navigator.mediaCapabilities) 118 | { 119 | if(navigator.mediaCapabilities.decodingInfo) 120 | { 121 | var originalDecodingInfoFn = EmeInterception.extendEmeMethod( 122 | navigator.mediaCapabilities, navigator.mediaCapabilities.decodingInfo,"DecodingInfoCall"); 123 | navigator.mediaCapabilities.decodingInfo = function() 124 | { 125 | var self = arguments[0]; 126 | //console.log(arguments); 127 | // slice "It is recommended that a robustness level be specified" warning 128 | var modifiedArguments = arguments; 129 | //var modifiedOptions = EmeInterception.addRobustnessLevelIfNeeded(options); 130 | //modifiedArguments[1] = modifiedOptions; 131 | 132 | var result = originalDecodingInfoFn.apply(null, modifiedArguments); 133 | // Attach listeners to returned MediaKeySystemAccess object 134 | return result.then(function(res) 135 | { 136 | //console.log(res); 137 | if(res.keySystemAccess) 138 | this.addListenersToMediaKeySystemAccess_(res.keySystemAccess); 139 | return Promise.resolve(res); 140 | }.bind(this)); 141 | 142 | }.bind(this); 143 | 144 | } 145 | } 146 | navigator.listenersAdded_ = true; 147 | }; 148 | 149 | 150 | /** 151 | * Adds listeners to the EME methods on a MediaKeySystemAccess object. 152 | * @param {MediaKeySystemAccess} mediaKeySystemAccess A MediaKeySystemAccess 153 | * object to add listeners to. 154 | * @private 155 | */ 156 | EmeInterception.prototype.addListenersToMediaKeySystemAccess_ = function(mediaKeySystemAccess) 157 | { 158 | if (mediaKeySystemAccess.listenersAdded_) { 159 | return; 160 | } 161 | mediaKeySystemAccess.originalGetConfiguration = mediaKeySystemAccess.getConfiguration; 162 | mediaKeySystemAccess.getConfiguration = EmeInterception.extendEmeMethod( 163 | mediaKeySystemAccess, 164 | mediaKeySystemAccess.getConfiguration, 165 | "GetConfigurationCall"); 166 | 167 | var originalCreateMediaKeysFn = EmeInterception.extendEmeMethod( 168 | mediaKeySystemAccess, 169 | mediaKeySystemAccess.createMediaKeys, 170 | "CreateMediaKeysCall"); 171 | 172 | mediaKeySystemAccess.createMediaKeys = function() 173 | { 174 | var result = originalCreateMediaKeysFn.apply(null, arguments); 175 | // Attach listeners to returned MediaKeys object 176 | return result.then(function(mediaKeys) { 177 | mediaKeys.keySystem_ = mediaKeySystemAccess.keySystem; 178 | this.addListenersToMediaKeys_(mediaKeys); 179 | return Promise.resolve(mediaKeys); 180 | }.bind(this)); 181 | 182 | }.bind(this); 183 | 184 | mediaKeySystemAccess.listenersAdded_ = true; 185 | }; 186 | 187 | 188 | /** 189 | * Adds listeners to the EME methods on a MediaKeys object. 190 | * @param {MediaKeys} mediaKeys A MediaKeys object to add listeners to. 191 | * @private 192 | */ 193 | EmeInterception.prototype.addListenersToMediaKeys_ = function(mediaKeys) 194 | { 195 | if (mediaKeys.listenersAdded_) { 196 | return; 197 | } 198 | var originalCreateSessionFn = EmeInterception.extendEmeMethod(mediaKeys, mediaKeys.createSession, "CreateSessionCall"); 199 | mediaKeys.createSession = function() 200 | { 201 | var result = originalCreateSessionFn.apply(null, arguments); 202 | result.keySystem_ = mediaKeys.keySystem_; 203 | // Attach listeners to returned MediaKeySession object 204 | this.addListenersToMediaKeySession_(result); 205 | return result; 206 | }.bind(this); 207 | 208 | mediaKeys.setServerCertificate = EmeInterception.extendEmeMethod(mediaKeys, mediaKeys.setServerCertificate, "SetServerCertificateCall"); 209 | mediaKeys.listenersAdded_ = true; 210 | }; 211 | 212 | 213 | /** Adds listeners to the EME methods and events on a MediaKeySession object. 214 | * @param {MediaKeySession} session A MediaKeySession object to add 215 | * listeners to. 216 | * @private 217 | */ 218 | EmeInterception.prototype.addListenersToMediaKeySession_ = function(session) 219 | { 220 | if (session.listenersAdded_) { 221 | return; 222 | } 223 | 224 | session.generateRequest = EmeInterception.extendEmeMethod(session,session.generateRequest, "GenerateRequestCall"); 225 | session.load = EmeInterception.extendEmeMethod(session, session.load, "LoadCall"); 226 | session.update = EmeInterception.extendEmeMethod(session,session.update, "UpdateCall"); 227 | session.close = EmeInterception.extendEmeMethod(session, session.close, "CloseCall"); 228 | session.remove = EmeInterception.extendEmeMethod(session, session.remove, "RemoveCall"); 229 | 230 | session.addEventListener('message', function(e) 231 | { 232 | e.keySystem = session.keySystem_; 233 | EmeInterception.interceptEvent("MessageEvent", e); 234 | }); 235 | 236 | session.addEventListener('keystatuseschange', EmeInterception.interceptEvent.bind(null, "KeyStatusesChangeEvent")); 237 | 238 | session.listenersAdded_ = true; 239 | }; 240 | 241 | 242 | /** 243 | * Adds listeners to all currently created media elements (audio, video) and sets up a 244 | * mutation-summary observer to add listeners to any newly created media 245 | * elements. 246 | * @private 247 | */ 248 | EmeInterception.prototype.addListenersToAllEmeElements_ = function() 249 | { 250 | this.addEmeInterceptionToInitialMediaElements_(); 251 | 252 | }; 253 | 254 | 255 | /** 256 | * Adds listeners to the EME elements currently in the document. 257 | * @private 258 | */ 259 | EmeInterception.prototype.addEmeInterceptionToInitialMediaElements_ = function() 260 | { 261 | var audioElements = document.getElementsByTagName('audio'); 262 | for (var i = 0; i < audioElements.length; ++i) { 263 | this.addListenersToEmeElement_(audioElements[i], false); 264 | } 265 | var videoElements = document.getElementsByTagName('video'); 266 | for (var i = 0; i < videoElements.length; ++i) { 267 | this.addListenersToEmeElement_(videoElements[i], false); 268 | } 269 | var mediaElements = document.getElementsByTagName('media'); 270 | for (var i = 0; i < mediaElements.length; ++i) { 271 | this.addListenersToEmeElement_(mediaElements[i], false); 272 | } 273 | }; 274 | 275 | 276 | /** 277 | * Adds method and event listeners to media element. 278 | * @param {HTMLMediaElement} element A HTMLMedia element to add listeners to. 279 | * @private 280 | */ 281 | EmeInterception.prototype.addListenersToEmeElement_ = function(element) 282 | { 283 | this.addEmeEventListeners_(element); 284 | this.addEmeMethodListeners_(element); 285 | console.info('EME listeners successfully added to:', element); 286 | }; 287 | 288 | 289 | /** 290 | * Adds event listeners to a media element. 291 | * @param {HTMLMediaElement} element A HTMLMedia element to add listeners to. 292 | * @private 293 | */ 294 | EmeInterception.prototype.addEmeEventListeners_ = function(element) 295 | { 296 | if (element.eventListenersAdded_) { 297 | return; 298 | } 299 | 300 | if (this.prefixedEmeEnabled) 301 | { 302 | element.addEventListener('webkitneedkey', EmeInterception.interceptEvent.bind(null, "NeedKeyEvent")); 303 | element.addEventListener('webkitkeymessage', EmeInterception.interceptEvent.bind(null, "KeyMessageEvent")); 304 | element.addEventListener('webkitkeyadded', EmeInterception.interceptEvent.bind(null, "KeyAddedEvent")); 305 | element.addEventListener('webkitkeyerror', EmeInterception.interceptEvent.bind(null, "KeyErrorEvent")); 306 | } 307 | 308 | element.addEventListener('encrypted', EmeInterception.interceptEvent.bind(null, "EncryptedEvent")); 309 | element.addEventListener('play', EmeInterception.interceptEvent.bind(null, "PlayEvent")); 310 | 311 | element.addEventListener('error', function(e) { 312 | console.error('Error Event'); 313 | EmeInterception.interceptEvent("ErrorEvent", e); 314 | }); 315 | 316 | element.eventListenersAdded_ = true; 317 | }; 318 | 319 | 320 | /** 321 | * Adds method listeners to a media element. 322 | * @param {HTMLMediaElement} element A HTMLMedia element to add listeners to. 323 | * @private 324 | */ 325 | EmeInterception.prototype.addEmeMethodListeners_ = function(element) 326 | { 327 | if (element.methodListenersAdded_) { 328 | return; 329 | } 330 | 331 | element.play = EmeInterception.extendEmeMethod(element, element.play, "PlayCall"); 332 | 333 | if (this.prefixedEmeEnabled) { 334 | element.canPlayType = EmeInterception.extendEmeMethod(element, element.canPlayType, "CanPlayTypeCall"); 335 | 336 | element.webkitGenerateKeyRequest = EmeInterception.extendEmeMethod(element, element.webkitGenerateKeyRequest, "GenerateKeyRequestCall"); 337 | element.webkitAddKey = EmeInterception.extendEmeMethod(element, element.webkitAddKey, "AddKeyCall"); 338 | element.webkitCancelKeyRequest = EmeInterception.extendEmeMethod(element, element.webkitCancelKeyRequest, "CancelKeyRequestCall"); 339 | 340 | } 341 | 342 | if (this.unprefixedEmeEnabled) { 343 | element.setMediaKeys = EmeInterception.extendEmeMethod(element, element.setMediaKeys, "SetMediaKeysCall"); 344 | } 345 | 346 | element.methodListenersAdded_ = true; 347 | }; 348 | 349 | 350 | /** 351 | * Creates a wrapper function that logs calls to the given method. 352 | * @param {!Object} element An element or object whose function 353 | * call will be logged. 354 | * @param {!Function} originalFn The function to log. 355 | * @param {!Function} type The constructor for a logger class that will 356 | * be instantiated to log the originalFn call. 357 | * @return {!Function} The new version, with logging, of orginalFn. 358 | */ 359 | EmeInterception.extendEmeMethod = function(element, originalFn, type) 360 | { 361 | return function() 362 | { 363 | try 364 | { 365 | var result = originalFn.apply(element, arguments); 366 | var args = [].slice.call(arguments); 367 | EmeInterception.interceptCall(type, args, result, element); 368 | } 369 | catch (e) 370 | { 371 | console.error(e); 372 | } 373 | 374 | 375 | return result; 376 | }; 377 | }; 378 | 379 | 380 | /** 381 | * Intercepts a method call to the console and a separate frame. 382 | * @param {!Function} constructor The constructor for a logger class that will 383 | * be instantiated to log this call. 384 | * @param {Array} args The arguments this call was made with. 385 | * @param {Object} result The result of this method call. 386 | * @param {!Object} target The element this method was called on. 387 | * @return {!eme.EmeMethodCall} The data that has been logged. 388 | */ 389 | EmeInterception.interceptCall = function(type, args, result, target) 390 | { 391 | EmeInterception.onOperation(type, args); 392 | return args; 393 | }; 394 | 395 | /** 396 | * Intercepts an event to the console and a separate frame. 397 | * @param {!Function} constructor The constructor for a logger class that will 398 | * be instantiated to log this event. 399 | * @param {!Event} event An EME event. 400 | * @return {!eme.EmeEvent} The data that has been logged. 401 | */ 402 | EmeInterception.interceptEvent = function(type, event) 403 | { 404 | EmeInterception.onOperation(type, event); 405 | return event; 406 | }; 407 | 408 | EmeInterception.addRobustnessLevelIfNeeded = function(options) 409 | { 410 | for (var i = 0; i < options.length; i++) 411 | { 412 | var option = options[i]; 413 | var videoCapabilities = option["videoCapabilities"]; 414 | var audioCapabilties = option["audioCapabilities"]; 415 | if (videoCapabilities != null) 416 | { 417 | for (var j = 0; j < videoCapabilities.length; j++) 418 | if (videoCapabilities[j]["robustness"] == undefined) videoCapabilities[j]["robustness"] = "SW_SECURE_CRYPTO"; 419 | } 420 | 421 | if (audioCapabilties != null) 422 | { 423 | for (var j = 0; j < audioCapabilties.length; j++) 424 | if (audioCapabilties[j]["robustness"] == undefined) audioCapabilties[j]["robustness"] = "SW_SECURE_CRYPTO"; 425 | } 426 | 427 | option["videoCapabilities"] = videoCapabilities; 428 | option["audioCapabilities"] = audioCapabilties; 429 | options[i] = option; 430 | } 431 | 432 | return options; 433 | } 434 | 435 | startEMEInterception(); 436 | -------------------------------------------------------------------------------- /inject.js: -------------------------------------------------------------------------------- 1 | function getStorage() { 2 | var obj = {}; 3 | 4 | if (storage === undefined) { 5 | return; 6 | } 7 | 8 | var specialKeys = [ 9 | 'length', 'key', 'getItem' 10 | ]; 11 | for (var i in storage) { 12 | if (storage.hasOwnProperty(i)) { 13 | if (i == "drm_keys"){ 14 | var x = storage.getItem(i); 15 | x = JSON.parse(x); 16 | //obj[0] = x; 17 | for (var y in x) { 18 | var myindex = [y]; 19 | var myvalue = x[y]; 20 | obj[myindex] = myvalue; 21 | } 22 | } 23 | } 24 | } 25 | 26 | return obj; 27 | } 28 | 29 | 30 | 31 | var storage = msg.type === 'L' ? localStorage : sessionStorage; 32 | var result; 33 | 34 | switch (msg.what) { 35 | 36 | case 'get': 37 | result = getStorage(); 38 | console.table(result); 39 | break; 40 | case 'clear': 41 | storage.removeItem('drm_keys'); 42 | //localStorage.removeItem('drm_keys'); 43 | break; 44 | case 'export': 45 | result = JSON.stringify(getStorage(), null, 4); 46 | break; 47 | 48 | } 49 | 50 | result; 51 | -------------------------------------------------------------------------------- /lib/cryptojs-aes_0.2.0.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | CryptoJS v3.1.2 3 | code.google.com/p/crypto-js 4 | (c) 2009-2013 by Jeff Mott. All rights reserved. 5 | code.google.com/p/crypto-js/wiki/License 6 | */ 7 | var CryptoJS=CryptoJS||function(u,p){var d={},l=d.lib={},s=function(){},t=l.Base={extend:function(a){s.prototype=this;var c=new s;a&&c.mixIn(a);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}}, 8 | r=l.WordArray=t.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=p?c:4*a.length},toString:function(a){return(a||v).stringify(this)},concat:function(a){var c=this.words,e=a.words,j=this.sigBytes;a=a.sigBytes;this.clamp();if(j%4)for(var k=0;k>>2]|=(e[k>>>2]>>>24-8*(k%4)&255)<<24-8*((j+k)%4);else if(65535>>2]=e[k>>>2];else c.push.apply(c,e);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<< 9 | 32-8*(c%4);a.length=u.ceil(c/4)},clone:function(){var a=t.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],e=0;e>>2]>>>24-8*(j%4)&255;e.push((k>>>4).toString(16));e.push((k&15).toString(16))}return e.join("")},parse:function(a){for(var c=a.length,e=[],j=0;j>>3]|=parseInt(a.substr(j, 10 | 2),16)<<24-4*(j%8);return new r.init(e,c/2)}},b=w.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var e=[],j=0;j>>2]>>>24-8*(j%4)&255));return e.join("")},parse:function(a){for(var c=a.length,e=[],j=0;j>>2]|=(a.charCodeAt(j)&255)<<24-8*(j%4);return new r.init(e,c)}},x=w.Utf8={stringify:function(a){try{return decodeURIComponent(escape(b.stringify(a)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(a){return b.parse(unescape(encodeURIComponent(a)))}}, 11 | q=l.BufferedBlockAlgorithm=t.extend({reset:function(){this._data=new r.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=x.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,e=c.words,j=c.sigBytes,k=this.blockSize,b=j/(4*k),b=a?u.ceil(b):u.max((b|0)-this._minBufferSize,0);a=b*k;j=u.min(4*a,j);if(a){for(var q=0;q>>2]>>>24-8*(r%4)&255)<<16|(l[r+1>>>2]>>>24-8*((r+1)%4)&255)<<8|l[r+2>>>2]>>>24-8*((r+2)%4)&255,v=0;4>v&&r+0.75*v>>6*(3-v)&63));if(l=t.charAt(64))for(;d.length%4;)d.push(l);return d.join("")},parse:function(d){var l=d.length,s=this._map,t=s.charAt(64);t&&(t=d.indexOf(t),-1!=t&&(l=t));for(var t=[],r=0,w=0;w< 15 | l;w++)if(w%4){var v=s.indexOf(d.charAt(w-1))<<2*(w%4),b=s.indexOf(d.charAt(w))>>>6-2*(w%4);t[r>>>2]|=(v|b)<<24-8*(r%4);r++}return p.create(t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})(); 16 | (function(u){function p(b,n,a,c,e,j,k){b=b+(n&a|~n&c)+e+k;return(b<>>32-j)+n}function d(b,n,a,c,e,j,k){b=b+(n&c|a&~c)+e+k;return(b<>>32-j)+n}function l(b,n,a,c,e,j,k){b=b+(n^a^c)+e+k;return(b<>>32-j)+n}function s(b,n,a,c,e,j,k){b=b+(a^(n|~c))+e+k;return(b<>>32-j)+n}for(var t=CryptoJS,r=t.lib,w=r.WordArray,v=r.Hasher,r=t.algo,b=[],x=0;64>x;x++)b[x]=4294967296*u.abs(u.sin(x+1))|0;r=r.MD5=v.extend({_doReset:function(){this._hash=new w.init([1732584193,4023233417,2562383102,271733878])}, 17 | _doProcessBlock:function(q,n){for(var a=0;16>a;a++){var c=n+a,e=q[c];q[c]=(e<<8|e>>>24)&16711935|(e<<24|e>>>8)&4278255360}var a=this._hash.words,c=q[n+0],e=q[n+1],j=q[n+2],k=q[n+3],z=q[n+4],r=q[n+5],t=q[n+6],w=q[n+7],v=q[n+8],A=q[n+9],B=q[n+10],C=q[n+11],u=q[n+12],D=q[n+13],E=q[n+14],x=q[n+15],f=a[0],m=a[1],g=a[2],h=a[3],f=p(f,m,g,h,c,7,b[0]),h=p(h,f,m,g,e,12,b[1]),g=p(g,h,f,m,j,17,b[2]),m=p(m,g,h,f,k,22,b[3]),f=p(f,m,g,h,z,7,b[4]),h=p(h,f,m,g,r,12,b[5]),g=p(g,h,f,m,t,17,b[6]),m=p(m,g,h,f,w,22,b[7]), 18 | f=p(f,m,g,h,v,7,b[8]),h=p(h,f,m,g,A,12,b[9]),g=p(g,h,f,m,B,17,b[10]),m=p(m,g,h,f,C,22,b[11]),f=p(f,m,g,h,u,7,b[12]),h=p(h,f,m,g,D,12,b[13]),g=p(g,h,f,m,E,17,b[14]),m=p(m,g,h,f,x,22,b[15]),f=d(f,m,g,h,e,5,b[16]),h=d(h,f,m,g,t,9,b[17]),g=d(g,h,f,m,C,14,b[18]),m=d(m,g,h,f,c,20,b[19]),f=d(f,m,g,h,r,5,b[20]),h=d(h,f,m,g,B,9,b[21]),g=d(g,h,f,m,x,14,b[22]),m=d(m,g,h,f,z,20,b[23]),f=d(f,m,g,h,A,5,b[24]),h=d(h,f,m,g,E,9,b[25]),g=d(g,h,f,m,k,14,b[26]),m=d(m,g,h,f,v,20,b[27]),f=d(f,m,g,h,D,5,b[28]),h=d(h,f, 19 | m,g,j,9,b[29]),g=d(g,h,f,m,w,14,b[30]),m=d(m,g,h,f,u,20,b[31]),f=l(f,m,g,h,r,4,b[32]),h=l(h,f,m,g,v,11,b[33]),g=l(g,h,f,m,C,16,b[34]),m=l(m,g,h,f,E,23,b[35]),f=l(f,m,g,h,e,4,b[36]),h=l(h,f,m,g,z,11,b[37]),g=l(g,h,f,m,w,16,b[38]),m=l(m,g,h,f,B,23,b[39]),f=l(f,m,g,h,D,4,b[40]),h=l(h,f,m,g,c,11,b[41]),g=l(g,h,f,m,k,16,b[42]),m=l(m,g,h,f,t,23,b[43]),f=l(f,m,g,h,A,4,b[44]),h=l(h,f,m,g,u,11,b[45]),g=l(g,h,f,m,x,16,b[46]),m=l(m,g,h,f,j,23,b[47]),f=s(f,m,g,h,c,6,b[48]),h=s(h,f,m,g,w,10,b[49]),g=s(g,h,f,m, 20 | E,15,b[50]),m=s(m,g,h,f,r,21,b[51]),f=s(f,m,g,h,u,6,b[52]),h=s(h,f,m,g,k,10,b[53]),g=s(g,h,f,m,B,15,b[54]),m=s(m,g,h,f,e,21,b[55]),f=s(f,m,g,h,v,6,b[56]),h=s(h,f,m,g,x,10,b[57]),g=s(g,h,f,m,t,15,b[58]),m=s(m,g,h,f,D,21,b[59]),f=s(f,m,g,h,z,6,b[60]),h=s(h,f,m,g,C,10,b[61]),g=s(g,h,f,m,j,15,b[62]),m=s(m,g,h,f,A,21,b[63]);a[0]=a[0]+f|0;a[1]=a[1]+m|0;a[2]=a[2]+g|0;a[3]=a[3]+h|0},_doFinalize:function(){var b=this._data,n=b.words,a=8*this._nDataBytes,c=8*b.sigBytes;n[c>>>5]|=128<<24-c%32;var e=u.floor(a/ 21 | 4294967296);n[(c+64>>>9<<4)+15]=(e<<8|e>>>24)&16711935|(e<<24|e>>>8)&4278255360;n[(c+64>>>9<<4)+14]=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360;b.sigBytes=4*(n.length+1);this._process();b=this._hash;n=b.words;for(a=0;4>a;a++)c=n[a],n[a]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;return b},clone:function(){var b=v.clone.call(this);b._hash=this._hash.clone();return b}});t.MD5=v._createHelper(r);t.HmacMD5=v._createHmacHelper(r)})(Math); 22 | (function(){var u=CryptoJS,p=u.lib,d=p.Base,l=p.WordArray,p=u.algo,s=p.EvpKDF=d.extend({cfg:d.extend({keySize:4,hasher:p.MD5,iterations:1}),init:function(d){this.cfg=this.cfg.extend(d)},compute:function(d,r){for(var p=this.cfg,s=p.hasher.create(),b=l.create(),u=b.words,q=p.keySize,p=p.iterations;u.length>>2]&255}};d.BlockCipher=v.extend({cfg:v.cfg.extend({mode:b,padding:q}),reset:function(){v.reset.call(this);var a=this.cfg,b=a.iv,a=a.mode;if(this._xformMode==this._ENC_XFORM_MODE)var c=a.createEncryptor;else c=a.createDecryptor,this._minBufferSize=1;this._mode=c.call(a, 28 | this,b&&b.words)},_doProcessBlock:function(a,b){this._mode.processBlock(a,b)},_doFinalize:function(){var a=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){a.pad(this._data,this.blockSize);var b=this._process(!0)}else b=this._process(!0),a.unpad(b);return b},blockSize:4});var n=d.CipherParams=l.extend({init:function(a){this.mixIn(a)},toString:function(a){return(a||this.formatter).stringify(this)}}),b=(p.format={}).OpenSSL={stringify:function(a){var b=a.ciphertext;a=a.salt;return(a?s.create([1398893684, 29 | 1701076831]).concat(a).concat(b):b).toString(r)},parse:function(a){a=r.parse(a);var b=a.words;if(1398893684==b[0]&&1701076831==b[1]){var c=s.create(b.slice(2,4));b.splice(0,4);a.sigBytes-=16}return n.create({ciphertext:a,salt:c})}},a=d.SerializableCipher=l.extend({cfg:l.extend({format:b}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var l=a.createEncryptor(c,d);b=l.finalize(b);l=l.cfg;return n.create({ciphertext:b,key:c,iv:l.iv,algorithm:a,mode:l.mode,padding:l.padding,blockSize:a.blockSize,formatter:d.format})}, 30 | decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);return a.createDecryptor(c,d).finalize(b.ciphertext)},_parse:function(a,b){return"string"==typeof a?b.parse(a,this):a}}),p=(p.kdf={}).OpenSSL={execute:function(a,b,c,d){d||(d=s.random(8));a=w.create({keySize:b+c}).compute(a,d);c=s.create(a.words.slice(b),4*c);a.sigBytes=4*b;return n.create({key:a,iv:c,salt:d})}},c=d.PasswordBasedCipher=a.extend({cfg:a.cfg.extend({kdf:p}),encrypt:function(b,c,d,l){l=this.cfg.extend(l);d=l.kdf.execute(d, 31 | b.keySize,b.ivSize);l.iv=d.iv;b=a.encrypt.call(this,b,c,d.key,l);b.mixIn(d);return b},decrypt:function(b,c,d,l){l=this.cfg.extend(l);c=this._parse(c,l.format);d=l.kdf.execute(d,b.keySize,b.ivSize,c.salt);l.iv=d.iv;return a.decrypt.call(this,b,c,d.key,l)}})}(); 32 | (function(){for(var u=CryptoJS,p=u.lib.BlockCipher,d=u.algo,l=[],s=[],t=[],r=[],w=[],v=[],b=[],x=[],q=[],n=[],a=[],c=0;256>c;c++)a[c]=128>c?c<<1:c<<1^283;for(var e=0,j=0,c=0;256>c;c++){var k=j^j<<1^j<<2^j<<3^j<<4,k=k>>>8^k&255^99;l[e]=k;s[k]=e;var z=a[e],F=a[z],G=a[F],y=257*a[k]^16843008*k;t[e]=y<<24|y>>>8;r[e]=y<<16|y>>>16;w[e]=y<<8|y>>>24;v[e]=y;y=16843009*G^65537*F^257*z^16843008*e;b[k]=y<<24|y>>>8;x[k]=y<<16|y>>>16;q[k]=y<<8|y>>>24;n[k]=y;e?(e=z^a[a[a[G^z]]],j^=a[a[j]]):e=j=1}var H=[0,1,2,4,8, 33 | 16,32,64,128,27,54],d=d.AES=p.extend({_doReset:function(){for(var a=this._key,c=a.words,d=a.sigBytes/4,a=4*((this._nRounds=d+6)+1),e=this._keySchedule=[],j=0;j>>24]<<24|l[k>>>16&255]<<16|l[k>>>8&255]<<8|l[k&255]):(k=k<<8|k>>>24,k=l[k>>>24]<<24|l[k>>>16&255]<<16|l[k>>>8&255]<<8|l[k&255],k^=H[j/d|0]<<24);e[j]=e[j-d]^k}c=this._invKeySchedule=[];for(d=0;dd||4>=j?k:b[l[k>>>24]]^x[l[k>>>16&255]]^q[l[k>>> 34 | 8&255]]^n[l[k&255]]},encryptBlock:function(a,b){this._doCryptBlock(a,b,this._keySchedule,t,r,w,v,l)},decryptBlock:function(a,c){var d=a[c+1];a[c+1]=a[c+3];a[c+3]=d;this._doCryptBlock(a,c,this._invKeySchedule,b,x,q,n,s);d=a[c+1];a[c+1]=a[c+3];a[c+3]=d},_doCryptBlock:function(a,b,c,d,e,j,l,f){for(var m=this._nRounds,g=a[b]^c[0],h=a[b+1]^c[1],k=a[b+2]^c[2],n=a[b+3]^c[3],p=4,r=1;r>>24]^e[h>>>16&255]^j[k>>>8&255]^l[n&255]^c[p++],s=d[h>>>24]^e[k>>>16&255]^j[n>>>8&255]^l[g&255]^c[p++],t= 35 | d[k>>>24]^e[n>>>16&255]^j[g>>>8&255]^l[h&255]^c[p++],n=d[n>>>24]^e[g>>>16&255]^j[h>>>8&255]^l[k&255]^c[p++],g=q,h=s,k=t;q=(f[g>>>24]<<24|f[h>>>16&255]<<16|f[k>>>8&255]<<8|f[n&255])^c[p++];s=(f[h>>>24]<<24|f[k>>>16&255]<<16|f[n>>>8&255]<<8|f[g&255])^c[p++];t=(f[k>>>24]<<24|f[n>>>16&255]<<16|f[g>>>8&255]<<8|f[h&255])^c[p++];n=(f[n>>>24]<<24|f[g>>>16&255]<<16|f[h>>>8&255]<<8|f[k&255])^c[p++];a[b]=q;a[b+1]=s;a[b+2]=t;a[b+3]=n},keySize:8});u.AES=p._createHelper(d)})(); 36 | 37 | 38 | /* 39 | * The MIT License 40 | * 41 | * (MIT)Copyright (c) 2015 artjomb 42 | */ 43 | !function(t){t.enc.Bin={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],n=0;r>n;n++)for(var o=e[n>>>2]>>>24-n%4*8&255,s=7;s>=0;s--)i.push((o>>>s&1).toString(2));return i.join("")},parse:function(e){for(var r=[0],i=31,n=0,o=0;oi&&(i=31,r.push(0)))}return t.lib.WordArray.create(r,Math.ceil(n/8))}}}(CryptoJS),function(t){var e;e=t.hasOwnProperty("ext")?t.ext:t.ext={},e.bitshift=function(t,e){var r,i,n=0,o=t.words,s=0;if(e>0){for(;e>31;)o.splice(0,1),o.push(0),e-=32,s++;if(0==e)return n;for(var c=o.length-s-1;c>=0;c--)r=o[c],o[c]<<=e,o[c]|=n,n=r>>>32-e}else if(0>e){for(;-31>e;)o.splice(0,0,0),o.length--,e+=32,s++;if(0==e)return n;e=-e,i=(1<>>=e,o[c]|=n,n=r<<32-e}return n},e.neg=function(t){for(var e=t.words,r=0;ra;a++){s?s=s.slice(c).concat(i._ct):(s=i._iv.slice(0),i._iv=void 0),r||(i._ct=t.slice(e+a*c,e+a*c+c));var f=s.slice(0);n.encryptBlock(f,0);for(var u=0;c>u;u++)t[e+a*c+u]^=f[u];r&&(i._ct=t.slice(e+a*c,e+a*c+c))}i._prevBlock=s}var e=CryptoJS.lib.BlockCipherMode.extend();return e.Encryptor=e.extend({processBlock:function(e,r){t.call(this,e,r,!0)}}),e.Decryptor=e.extend({processBlock:function(e,r){t.call(this,e,r,!1)}}),e}(),function(t){var e;e=t.hasOwnProperty("ext")?t.ext:t.ext={};{var r=(t.lib.Base,t.lib.WordArray);t.algo.AES}e.const_Zero=r.create([0,0,0,0]),e.const_One=r.create([0,0,0,1]),e.const_Rb=r.create([0,0,0,135]),e.const_Rb_Shifted=r.create([2147483648,0,0,67]),e.const_nonMSB=r.create([4294967295,4294967295,2147483647,2147483647]),e.isWordArray=function(t){return t&&"function"==typeof t.clamp&&"function"==typeof t.concat&&"array"==typeof t.words},t.pad.OneZeroPadding={pad:function(t,e){for(var i=4*e,n=i-t.sigBytes%i,o=[],s=0;n>s;s+=4){var c=0;0===s&&(c=2147483648),o.push(c)}var a=r.create(o,n);t.concat(a)},unpad:function(){}},t.pad.NoPadding={pad:function(){},unpad:function(){}},e.leftmostBytes=function(t,e){var r=t.clone();return r.sigBytes=e,r.clamp(),r},e.rightmostBytes=function(t,r){t.clamp();var i=32,n=t.clone(),o=8*(n.sigBytes-r);if(o>=i){var s=Math.floor(o/i);o-=s*i,n.words.splice(0,s),n.sigBytes-=s*i/8}return o>0&&(e.bitshift(n,o),n.sigBytes-=o/8),n},e.popWords=function(t,r){var i=e.leftmostBytes(t,4*r);return t.words=t.words.slice(r),t.sigBytes-=4*r,i},e.shiftBytes=function(t,i){i=i||16;var n=i%4;i-=n;for(var o=r.create(),s=0;i>s;s+=4)o.words.push(t.words.shift()),t.sigBytes-=4,o.sigBytes+=4;return n>0&&(o.words.push(t.words[0]),o.sigBytes+=n,e.bitshift(t,8*n),t.sigBytes-=n),o},e.xorendBytes=function(t,r){return e.leftmostBytes(t,t.sigBytes-r.sigBytes).concat(e.xor(e.rightmostBytes(t,r.sigBytes),r))},e.dbl=function(t){var r=e.msb(t);return e.bitshift(t,1),1===r&&e.xor(t,e.const_Rb),t},e.inv=function(t){var r=1&t.words[4];return e.bitshift(t,-1),1===r&&e.xor(t,e.const_Rb_Shifted),t},e.equals=function(t,e){if(!e||!e.words||t.sigBytes!==e.sigBytes)return!1;t.clamp(),e.clamp();for(var r=0;r>>31}}(CryptoJS),CryptoJS.mode.CFBb=function(){function t(t,e,o){var s,c,a,f=this,u=f._cipher,h=32*u.blockSize,l=f._prevBlock,p=u.cfg.segmentSize,d=[];for(s=31;p>s;s+=32)d.push(4294967295);for(d.push((1<s;s++){if(l){for(l=r.create(l),i(l,p),l=l.words,previousCiphertextSegment=f._ct;previousCiphertextSegment.lengthn;){var s=o.shiftBytes(i,n);o.xor(this._x,s),this._x.clamp(),this._x=e(this._K,this._x),this._counter++}return this},finalize:function(t){this.update(t);var r=this._buffer,i=this._const_Bsize,n=r.clone();return r.sigBytes===i?o.xor(n,this._K1):(s.pad(n,i/4),o.xor(n,this._K2)),o.xor(n,this._x),this.reset(),e(this._K,n)},_isTwo:function(){return!1}});t.CMAC=function(t,e){return c.create(t).finalize(e)},t.algo.OMAC1=c,t.algo.OMAC2=c.extend({_isTwo:function(){return!0}})}(CryptoJS),function(t){{var e=t.lib.Base,r=t.lib.WordArray,i=(t.algo.AES,t.ext),n=t.pad.OneZeroPadding,o=t.algo.CMAC,s=t.algo.S2V=e.extend({init:function(t){this._blockSize=16,this._cmacAD=o.create(t),this._cmacPT=o.create(t),this.reset()},reset:function(){this._buffer=r.create(),this._cmacAD.reset(),this._cmacPT.reset(),this._d=this._cmacAD.finalize(i.const_Zero),this._empty=!0,this._ptStarted=!1},updateAAD:function(e){return this._ptStarted?this:e?("string"==typeof e&&(e=t.enc.Utf8.parse(e)),this._d=i.xor(i.dbl(this._d),this._cmacAD.finalize(e)),this._empty=!1,this):this},update:function(e){if(!e)return this;this._ptStarted=!0;var r=this._buffer,n=this._blockSize,o=n/4,s=this._cmacPT;for("string"==typeof e&&(e=t.enc.Utf8.parse(e)),r.concat(e);r.sigBytes>=2*n;){this._empty=!1;var c=i.popWords(r,o);s.update(c)}return this},finalize:function(t){this.update(t);var e=this._blockSize,r=this._buffer;if(this._empty&&0===r.sigBytes)return this._cmacAD.finalize(i.const_One);var o;return r.sigBytes>=e?o=i.xorendBytes(r,this._d):(n.pad(r,e),o=i.xor(i.dbl(this._d),r)),this._cmacPT.finalize(o)}});t.SIV=e.extend({init:function(t){var e=t.sigBytes/2;this._s2vKey=i.shiftBytes(t,e),this._ctrKey=t},encrypt:function(e,r){!r&&e&&(r=e,e=[]);var n=s.create(this._s2vKey);Array.prototype.forEach.call(e,function(t){n.updateAAD(t)});var o=n.finalize(r),c=i.bitand(o,i.const_nonMSB),a=t.AES.encrypt(r,this._ctrKey,{iv:c,mode:t.mode.CTR,padding:t.pad.NoPadding});return o.concat(a.ciphertext)},decrypt:function(e,r){!r&&e&&(r=e,e=[]);var n=i.shiftBytes(r,16),o=i.bitand(n,i.const_nonMSB),c=t.AES.decrypt({ciphertext:r},this._ctrKey,{iv:o,mode:t.mode.CTR,padding:t.pad.NoPadding}),a=s.create(this._s2vKey);Array.prototype.forEach.call(e,function(t){a.updateAAD(t)});var f=a.finalize(c);return i.equals(n,f)?c:!1}})}}(CryptoJS),function(t){{var e=t.lib.Base,r=t.lib.WordArray,i=t.algo.AES,n=t.ext,o=t.algo.CMAC,s=r.create([0,0,0,0]),c=r.create([0,0,0,1]),a=r.create([0,0,0,2]),f=16;t.EAX=e.extend({init:function(t,e){var r;if(e&&e.splitKey){var i=Math.floor(t.sigBytes/2);r=n.shiftBytes(t,i)}else r=t.clone();this._ctrKey=t,this._mac=o.create(r),this._tagLen=e&&e.tagLength||f,this.reset()},reset:function(){this._mac.update(c),this._ctr&&this._ctr.reset()},updateAAD:function(t){return this._mac.update(t),this},initCrypt:function(e,o){var c=this;return c._tag=c._mac.finalize(),c._isEnc=e,c._mac.update(s),o=c._mac.finalize(o),n.xor(c._tag,o),c._ctr=i.createEncryptor(c._ctrKey,{iv:o,mode:t.mode.CTR,padding:t.pad.NoPadding}),c._buf=r.create(),c._mac.update(a),c},update:function(e){"string"==typeof e&&(e=t.enc.Utf8.parse(e));var i=this,o=i._buf,s=i._isEnc;o.concat(e);var c=s?o.sigBytes:Math.max(o.sigBytes-i._tagLen,0),a=c>0?n.shiftBytes(o,c):r.create(),f=i._ctr.process(a);return i._mac.update(s?f:a),f},finalize:function(t){var e=this,i=t?e.update(t):r.create(),o=e._mac,s=e._ctr.finalize();if(e._isEnc){var c=o.finalize(s);return n.xor(e._tag,c),e.reset(),i.concat(s).concat(e._tag)}var c=o.finalize();return n.xor(e._tag,c),e.reset(),n.equals(e._tag,e._buf)?i.concat(s):!1},encrypt:function(t,e,r){var i=this;return r&&Array.prototype.forEach.call(r,function(t){i.updateAAD(t)}),i.initCrypt(!0,e),i.finalize(t)},decrypt:function(t,e,r){var i=this;return r&&Array.prototype.forEach.call(r,function(t){i.updateAAD(t)}),i.initCrypt(!1,e),i.finalize(t)}})}}(CryptoJS); -------------------------------------------------------------------------------- /lib/pbf.3.0.5.min.js: -------------------------------------------------------------------------------- 1 | !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i;i="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,i.Pbf=t()}}(function(){return function t(i,e,r){function s(o,h){if(!e[o]){if(!i[o]){var a="function"==typeof require&&require;if(!h&&a)return a(o,!0);if(n)return n(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var f=e[o]={exports:{}};i[o][0].call(f.exports,function(t){var e=i[o][1][t];return s(e?e:t)},f,f.exports,t,i,e,r)}return e[o].exports}for(var n="function"==typeof require&&require,o=0;o>4,s<128)return o(t,r,i);if(s=n[e.pos++],r|=(127&s)<<3,s<128)return o(t,r,i);if(s=n[e.pos++],r|=(127&s)<<10,s<128)return o(t,r,i);if(s=n[e.pos++],r|=(127&s)<<17,s<128)return o(t,r,i);if(s=n[e.pos++],r|=(127&s)<<24,s<128)return o(t,r,i);if(s=n[e.pos++],r|=(1&s)<<31,s<128)return o(t,r,i);throw new Error("Expected varint not more than 10 bytes")}function n(t){return t.type===r.Bytes?t.readVarint()+t.pos:t.pos+1}function o(t,i,e){return e?4294967296*i+(t>>>0):4294967296*(i>>>0)+(t>>>0)}function h(t,i){var e,r;if(t>=0?(e=t%4294967296|0,r=t/4294967296|0):(e=~(-t%4294967296),r=~(-t/4294967296),4294967295^e?e=e+1|0:(e=0,r=r+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");i.realloc(10),a(e,r,i),u(r,i)}function a(t,i,e){e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos]=127&t}function u(t,i){var e=(7&t)<<4;i.buf[i.pos++]|=e|((t>>>=3)?128:0),t&&(i.buf[i.pos++]=127&t|((t>>>=7)?128:0),t&&(i.buf[i.pos++]=127&t|((t>>>=7)?128:0),t&&(i.buf[i.pos++]=127&t|((t>>>=7)?128:0),t&&(i.buf[i.pos++]=127&t|((t>>>=7)?128:0),t&&(i.buf[i.pos++]=127&t)))))}function f(t,i,e){var r=i<=16383?1:i<=2097151?2:i<=268435455?3:Math.ceil(Math.log(i)/(7*Math.LN2));e.realloc(r);for(var s=e.pos-1;s>=t;s--)e.buf[s+r]=e.buf[s]}function d(t,i){for(var e=0;e>>8,t[e+2]=i>>>16,t[e+3]=i>>>24}function y(t,i){return(t[i]|t[i+1]<<8|t[i+2]<<16)+(t[i+3]<<24)}function M(t,i,e){for(var r="",s=i;s239?4:n>223?3:n>191?2:1;if(s+h>e)break;var a,u,f;1===h?n<128&&(o=n):2===h?(a=t[s+1],128===(192&a)&&(o=(31&n)<<6|63&a,o<=127&&(o=null))):3===h?(a=t[s+1],u=t[s+2],128===(192&a)&&128===(192&u)&&(o=(15&n)<<12|(63&a)<<6|63&u,(o<=2047||o>=55296&&o<=57343)&&(o=null))):4===h&&(a=t[s+1],u=t[s+2],f=t[s+3],128===(192&a)&&128===(192&u)&&128===(192&f)&&(o=(15&n)<<18|(63&a)<<12|(63&u)<<6|63&f,(o<=65535||o>=1114112)&&(o=null))),null===o?(o=65533,h=1):o>65535&&(o-=65536,r+=String.fromCharCode(o>>>10&1023|55296),o=56320|1023&o),r+=String.fromCharCode(o),s+=h}return r}function S(t,i,e){for(var r,s,n=0;n55295&&r<57344){if(!s){r>56319||n+1===i.length?(t[e++]=239,t[e++]=191,t[e++]=189):s=r;continue}if(r<56320){t[e++]=239,t[e++]=191,t[e++]=189,s=r;continue}r=s-55296<<10|r-56320|65536,s=null}else s&&(t[e++]=239,t[e++]=191,t[e++]=189,s=null);r<128?t[e++]=r:(r<2048?t[e++]=r>>6|192:(r<65536?t[e++]=r>>12|224:(t[e++]=r>>18|240,t[e++]=r>>12&63|128),t[e++]=r>>6&63|128),t[e++]=63&r|128)}return e}i.exports=r;var B=t("ieee754");r.Varint=0,r.Fixed64=1,r.Bytes=2,r.Fixed32=5;var k=4294967296,P=1/k;r.prototype={destroy:function(){this.buf=null},readFields:function(t,i,e){for(e=e||this.length;this.pos>3,n=this.pos;this.type=7&r,t(s,i,this),this.pos===n&&this.skip(r)}return i},readMessage:function(t,i){return this.readFields(t,i,this.readVarint()+this.pos)},readFixed32:function(){var t=x(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=y(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=x(this.buf,this.pos)+x(this.buf,this.pos+4)*k;return this.pos+=8,t},readSFixed64:function(){var t=x(this.buf,this.pos)+y(this.buf,this.pos+4)*k;return this.pos+=8,t},readFloat:function(){var t=B.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=B.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var i,e,r=this.buf;return e=r[this.pos++],i=127&e,e<128?i:(e=r[this.pos++],i|=(127&e)<<7,e<128?i:(e=r[this.pos++],i|=(127&e)<<14,e<128?i:(e=r[this.pos++],i|=(127&e)<<21,e<128?i:(e=r[this.pos],i|=(15&e)<<28,s(i,t,this)))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2===1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,i=M(this.buf,this.pos,t);return this.pos=t,i},readBytes:function(){var t=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,t);return this.pos=t,i},readPackedVarint:function(t,i){var e=n(this);for(t=t||[];this.pos127;);else if(i===r.Bytes)this.pos=this.readVarint()+this.pos;else if(i===r.Fixed32)this.pos+=4;else{if(i!==r.Fixed64)throw new Error("Unimplemented type: "+i);this.pos+=8}},writeTag:function(t,i){this.writeVarint(t<<3|i)},realloc:function(t){for(var i=this.length||16;i268435455||t<0?void h(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),void(t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127)))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var i=this.pos;this.pos=S(this.buf,t,this.pos);var e=this.pos-i;e>=128&&f(i,e,this),this.pos=i-1,this.writeVarint(e),this.pos+=e},writeFloat:function(t){this.realloc(4),B.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),B.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var i=t.length;this.writeVarint(i),this.realloc(i);for(var e=0;e=128&&f(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,i,e){this.writeTag(t,r.Bytes),this.writeRawMessage(i,e)},writePackedVarint:function(t,i){this.writeMessage(t,d,i)},writePackedSVarint:function(t,i){this.writeMessage(t,p,i)},writePackedBoolean:function(t,i){this.writeMessage(t,w,i)},writePackedFloat:function(t,i){this.writeMessage(t,c,i)},writePackedDouble:function(t,i){this.writeMessage(t,l,i)},writePackedFixed32:function(t,i){this.writeMessage(t,F,i)},writePackedSFixed32:function(t,i){this.writeMessage(t,b,i)},writePackedFixed64:function(t,i){this.writeMessage(t,v,i)},writePackedSFixed64:function(t,i){this.writeMessage(t,g,i)},writeBytesField:function(t,i){this.writeTag(t,r.Bytes),this.writeBytes(i)},writeFixed32Field:function(t,i){this.writeTag(t,r.Fixed32),this.writeFixed32(i)},writeSFixed32Field:function(t,i){this.writeTag(t,r.Fixed32),this.writeSFixed32(i)},writeFixed64Field:function(t,i){this.writeTag(t,r.Fixed64),this.writeFixed64(i)},writeSFixed64Field:function(t,i){this.writeTag(t,r.Fixed64),this.writeSFixed64(i)},writeVarintField:function(t,i){this.writeTag(t,r.Varint),this.writeVarint(i)},writeSVarintField:function(t,i){this.writeTag(t,r.Varint),this.writeSVarint(i)},writeStringField:function(t,i){this.writeTag(t,r.Bytes),this.writeString(i)},writeFloatField:function(t,i){this.writeTag(t,r.Fixed32),this.writeFloat(i)},writeDoubleField:function(t,i){this.writeTag(t,r.Fixed64),this.writeDouble(i)},writeBooleanField:function(t,i){this.writeVarintField(t,Boolean(i))}}},{ieee754:2}],2:[function(t,i,e){e.read=function(t,i,e,r,s){var n,o,h=8*s-r-1,a=(1<>1,f=-7,d=e?s-1:0,p=e?-1:1,c=t[i+d];for(d+=p,n=c&(1<<-f)-1,c>>=-f,f+=h;f>0;n=256*n+t[i+d],d+=p,f-=8);for(o=n&(1<<-f)-1,n>>=-f,f+=r;f>0;o=256*o+t[i+d],d+=p,f-=8);if(0===n)n=1-u;else{if(n===a)return o?NaN:(c?-1:1)*(1/0);o+=Math.pow(2,r),n-=u}return(c?-1:1)*o*Math.pow(2,n-r)},e.write=function(t,i,e,r,s,n){var o,h,a,u=8*n-s-1,f=(1<>1,p=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,c=r?0:n-1,l=r?1:-1,w=i<0||0===i&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(h=isNaN(i)?1:0,o=f):(o=Math.floor(Math.log(i)/Math.LN2),i*(a=Math.pow(2,-o))<1&&(o--,a*=2),i+=o+d>=1?p/a:p*Math.pow(2,1-d),i*a>=2&&(o++,a/=2),o+d>=f?(h=0,o=f):o+d>=1?(h=(i*a-1)*Math.pow(2,s),o+=d):(h=i*Math.pow(2,d-1)*Math.pow(2,s),o=0));s>=8;t[e+c]=255&h,c+=l,h/=256,s-=8);for(o=o<0;t[e+c]=255&o,c+=l,o/=256,u-=8);t[e+c-l]|=128*w}},{}]},{},[1])(1)}); -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "Widevine Guesser", 4 | "short_name": "WidevineGuesser", 5 | "description": "Guesses at session key input and logs media keys from websites that use Widevine DRM", 6 | "version": "1.0.0", 7 | "permissions": ["webRequest", "", "tabs", "cookies"], 8 | "icons": 9 | { 10 | 11 | }, 12 | "background": { 13 | "scripts": ["background.js"] 14 | }, 15 | "browser_action": { 16 | "default_popup": "popup.html" 17 | }, 18 | "content_scripts": 19 | [ 20 | { 21 | "matches": ["https://*/*"], 22 | "js": ["content_script.js"], 23 | "css": [], 24 | "run_at": "document_start", 25 | "all_frames": true 26 | } 27 | ], 28 | "content_security_policy": "script-src 'self' 'wasm-eval'; object-src 'self'", 29 | "web_accessible_resources": ["content_key_decryption.js", "eme_interception.js", "lib/*", "protobuf-generated/*","wasm/*"] 30 | } 31 | -------------------------------------------------------------------------------- /popup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | - 6 | 7 | 8 | 9 | 10 |
11 |
12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 |
21 | 22 |
23 | 24 |
25 |

Loading...

26 | 43 |
44 |
45 |
46 | 47 |
48 | 49 |

50 |         
51 | 52 |
53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /protobuf-generated/license_protocol.proto.js: -------------------------------------------------------------------------------- 1 | 'use strict'; // code generated by pbf v3.2.1 2 | 3 | var LicenseType = self.LicenseType = { 4 | "STREAMING": { 5 | "value": 1, 6 | "options": {} 7 | }, 8 | "OFFLINE": { 9 | "value": 2, 10 | "options": {} 11 | } 12 | }; 13 | 14 | var ProtocolVersion = self.ProtocolVersion = { 15 | "VERSION_2_0": { 16 | "value": 20, 17 | "options": {} 18 | }, 19 | "VERSION_2_1": { 20 | "value": 21, 21 | "options": {} 22 | } 23 | }; 24 | 25 | // LicenseIdentification ======================================== 26 | 27 | var LicenseIdentification = self.LicenseIdentification = {}; 28 | 29 | LicenseIdentification.read = function (pbf, end) { 30 | return pbf.readFields(LicenseIdentification._readField, {request_id: null, session_id: null, purchase_id: null, type: 0, version: 0, provider_session_token: null}, end); 31 | }; 32 | LicenseIdentification._readField = function (tag, obj, pbf) { 33 | if (tag === 1) obj.request_id = pbf.readBytes(); 34 | else if (tag === 2) obj.session_id = pbf.readBytes(); 35 | else if (tag === 3) obj.purchase_id = pbf.readBytes(); 36 | else if (tag === 4) obj.type = pbf.readVarint(); 37 | else if (tag === 5) obj.version = pbf.readVarint(true); 38 | else if (tag === 6) obj.provider_session_token = pbf.readBytes(); 39 | }; 40 | LicenseIdentification.write = function (obj, pbf) { 41 | if (obj.request_id) pbf.writeBytesField(1, obj.request_id); 42 | if (obj.session_id) pbf.writeBytesField(2, obj.session_id); 43 | if (obj.purchase_id) pbf.writeBytesField(3, obj.purchase_id); 44 | if (obj.type) pbf.writeVarintField(4, obj.type); 45 | if (obj.version) pbf.writeVarintField(5, obj.version); 46 | if (obj.provider_session_token) pbf.writeBytesField(6, obj.provider_session_token); 47 | }; 48 | 49 | // License ======================================== 50 | 51 | var License = self.License = {}; 52 | 53 | License.read = function (pbf, end) { 54 | return pbf.readFields(License._readField, {id: null, policy: null, key: [], license_start_time: 0, remote_attestation_verified: false, provider_client_token: null}, end); 55 | }; 56 | License._readField = function (tag, obj, pbf) { 57 | if (tag === 1) obj.id = LicenseIdentification.read(pbf, pbf.readVarint() + pbf.pos); 58 | else if (tag === 2) obj.policy = License.Policy.read(pbf, pbf.readVarint() + pbf.pos); 59 | else if (tag === 3) obj.key.push(License.KeyContainer.read(pbf, pbf.readVarint() + pbf.pos)); 60 | else if (tag === 4) obj.license_start_time = pbf.readVarint(true); 61 | else if (tag === 5) obj.remote_attestation_verified = pbf.readBoolean(); 62 | else if (tag === 6) obj.provider_client_token = pbf.readBytes(); 63 | }; 64 | License.write = function (obj, pbf) { 65 | if (obj.id) pbf.writeMessage(1, LicenseIdentification.write, obj.id); 66 | if (obj.policy) pbf.writeMessage(2, License.Policy.write, obj.policy); 67 | if (obj.key) for (var i = 0; i < obj.key.length; i++) pbf.writeMessage(3, License.KeyContainer.write, obj.key[i]); 68 | if (obj.license_start_time) pbf.writeVarintField(4, obj.license_start_time); 69 | if (obj.remote_attestation_verified) pbf.writeBooleanField(5, obj.remote_attestation_verified); 70 | if (obj.provider_client_token) pbf.writeBytesField(6, obj.provider_client_token); 71 | }; 72 | 73 | // License.Policy ======================================== 74 | 75 | License.Policy = {}; 76 | 77 | License.Policy.read = function (pbf, end) { 78 | return pbf.readFields(License.Policy._readField, {can_play: false, can_persist: false, can_renew: false, rental_duration_seconds: 0, playback_duration_seconds: 0, license_duration_seconds: 0, renewal_recovery_duration_seconds: 0, renewal_server_url: "", renewal_delay_seconds: 0, renewal_retry_interval_seconds: 0, renew_with_usage: false, renew_with_client_id: false}, end); 79 | }; 80 | License.Policy._readField = function (tag, obj, pbf) { 81 | if (tag === 1) obj.can_play = pbf.readBoolean(); 82 | else if (tag === 2) obj.can_persist = pbf.readBoolean(); 83 | else if (tag === 3) obj.can_renew = pbf.readBoolean(); 84 | else if (tag === 4) obj.rental_duration_seconds = pbf.readVarint(true); 85 | else if (tag === 5) obj.playback_duration_seconds = pbf.readVarint(true); 86 | else if (tag === 6) obj.license_duration_seconds = pbf.readVarint(true); 87 | else if (tag === 7) obj.renewal_recovery_duration_seconds = pbf.readVarint(true); 88 | else if (tag === 8) obj.renewal_server_url = pbf.readString(); 89 | else if (tag === 9) obj.renewal_delay_seconds = pbf.readVarint(true); 90 | else if (tag === 10) obj.renewal_retry_interval_seconds = pbf.readVarint(true); 91 | else if (tag === 11) obj.renew_with_usage = pbf.readBoolean(); 92 | else if (tag === 12) obj.renew_with_client_id = pbf.readBoolean(); 93 | }; 94 | License.Policy.write = function (obj, pbf) { 95 | if (obj.can_play) pbf.writeBooleanField(1, obj.can_play); 96 | if (obj.can_persist) pbf.writeBooleanField(2, obj.can_persist); 97 | if (obj.can_renew) pbf.writeBooleanField(3, obj.can_renew); 98 | if (obj.rental_duration_seconds) pbf.writeVarintField(4, obj.rental_duration_seconds); 99 | if (obj.playback_duration_seconds) pbf.writeVarintField(5, obj.playback_duration_seconds); 100 | if (obj.license_duration_seconds) pbf.writeVarintField(6, obj.license_duration_seconds); 101 | if (obj.renewal_recovery_duration_seconds) pbf.writeVarintField(7, obj.renewal_recovery_duration_seconds); 102 | if (obj.renewal_server_url) pbf.writeStringField(8, obj.renewal_server_url); 103 | if (obj.renewal_delay_seconds) pbf.writeVarintField(9, obj.renewal_delay_seconds); 104 | if (obj.renewal_retry_interval_seconds) pbf.writeVarintField(10, obj.renewal_retry_interval_seconds); 105 | if (obj.renew_with_usage) pbf.writeBooleanField(11, obj.renew_with_usage); 106 | if (obj.renew_with_client_id) pbf.writeBooleanField(12, obj.renew_with_client_id); 107 | }; 108 | 109 | // License.KeyContainer ======================================== 110 | 111 | License.KeyContainer = {}; 112 | 113 | License.KeyContainer.read = function (pbf, end) { 114 | return pbf.readFields(License.KeyContainer._readField, {id: null, iv: null, key: null, type: 0, level: {"value":1,"options":{}}, required_protection: null, requested_protection: null, key_control: null, operator_session_key_permissions: null, video_resolution_constraints: [], anti_rollback_usage_table: false}, end); 115 | }; 116 | License.KeyContainer._readField = function (tag, obj, pbf) { 117 | if (tag === 1) obj.id = pbf.readBytes(); 118 | else if (tag === 2) obj.iv = pbf.readBytes(); 119 | else if (tag === 3) obj.key = pbf.readBytes(); 120 | else if (tag === 4) obj.type = pbf.readVarint(); 121 | else if (tag === 5) obj.level = pbf.readVarint(); 122 | else if (tag === 6) obj.required_protection = License.KeyContainer.OutputProtection.read(pbf, pbf.readVarint() + pbf.pos); 123 | else if (tag === 7) obj.requested_protection = License.KeyContainer.OutputProtection.read(pbf, pbf.readVarint() + pbf.pos); 124 | else if (tag === 8) obj.key_control = License.KeyContainer.KeyControl.read(pbf, pbf.readVarint() + pbf.pos); 125 | else if (tag === 9) obj.operator_session_key_permissions = License.KeyContainer.OperatorSessionKeyPermissions.read(pbf, pbf.readVarint() + pbf.pos); 126 | else if (tag === 10) obj.video_resolution_constraints.push(License.KeyContainer.VideoResolutionConstraint.read(pbf, pbf.readVarint() + pbf.pos)); 127 | else if (tag === 11) obj.anti_rollback_usage_table = pbf.readBoolean(); 128 | }; 129 | License.KeyContainer.write = function (obj, pbf) { 130 | if (obj.id) pbf.writeBytesField(1, obj.id); 131 | if (obj.iv) pbf.writeBytesField(2, obj.iv); 132 | if (obj.key) pbf.writeBytesField(3, obj.key); 133 | if (obj.type) pbf.writeVarintField(4, obj.type); 134 | if (obj.level != undefined && obj.level !== {"value":1,"options":{}}) pbf.writeVarintField(5, obj.level); 135 | if (obj.required_protection) pbf.writeMessage(6, License.KeyContainer.OutputProtection.write, obj.required_protection); 136 | if (obj.requested_protection) pbf.writeMessage(7, License.KeyContainer.OutputProtection.write, obj.requested_protection); 137 | if (obj.key_control) pbf.writeMessage(8, License.KeyContainer.KeyControl.write, obj.key_control); 138 | if (obj.operator_session_key_permissions) pbf.writeMessage(9, License.KeyContainer.OperatorSessionKeyPermissions.write, obj.operator_session_key_permissions); 139 | if (obj.video_resolution_constraints) for (var i = 0; i < obj.video_resolution_constraints.length; i++) pbf.writeMessage(10, License.KeyContainer.VideoResolutionConstraint.write, obj.video_resolution_constraints[i]); 140 | if (obj.anti_rollback_usage_table) pbf.writeBooleanField(11, obj.anti_rollback_usage_table); 141 | }; 142 | 143 | License.KeyContainer.KeyType = { 144 | "SIGNING": { 145 | "value": 1, 146 | "options": {} 147 | }, 148 | "CONTENT": { 149 | "value": 2, 150 | "options": {} 151 | }, 152 | "KEY_CONTROL": { 153 | "value": 3, 154 | "options": {} 155 | }, 156 | "OPERATOR_SESSION": { 157 | "value": 4, 158 | "options": {} 159 | } 160 | }; 161 | 162 | License.KeyContainer.SecurityLevel = { 163 | "SW_SECURE_CRYPTO": { 164 | "value": 1, 165 | "options": {} 166 | }, 167 | "SW_SECURE_DECODE": { 168 | "value": 2, 169 | "options": {} 170 | }, 171 | "HW_SECURE_CRYPTO": { 172 | "value": 3, 173 | "options": {} 174 | }, 175 | "HW_SECURE_DECODE": { 176 | "value": 4, 177 | "options": {} 178 | }, 179 | "HW_SECURE_ALL": { 180 | "value": 5, 181 | "options": {} 182 | } 183 | }; 184 | 185 | // License.KeyContainer.KeyControl ======================================== 186 | 187 | License.KeyContainer.KeyControl = {}; 188 | 189 | License.KeyContainer.KeyControl.read = function (pbf, end) { 190 | return pbf.readFields(License.KeyContainer.KeyControl._readField, {key_control_block: null, iv: null}, end); 191 | }; 192 | License.KeyContainer.KeyControl._readField = function (tag, obj, pbf) { 193 | if (tag === 1) obj.key_control_block = pbf.readBytes(); 194 | else if (tag === 2) obj.iv = pbf.readBytes(); 195 | }; 196 | License.KeyContainer.KeyControl.write = function (obj, pbf) { 197 | if (obj.key_control_block) pbf.writeBytesField(1, obj.key_control_block); 198 | if (obj.iv) pbf.writeBytesField(2, obj.iv); 199 | }; 200 | 201 | // License.KeyContainer.OutputProtection ======================================== 202 | 203 | License.KeyContainer.OutputProtection = {}; 204 | 205 | License.KeyContainer.OutputProtection.read = function (pbf, end) { 206 | return pbf.readFields(License.KeyContainer.OutputProtection._readField, {hdcp: {"value":0,"options":{}}, cgms_flags: {"value":42,"options":{}}}, end); 207 | }; 208 | License.KeyContainer.OutputProtection._readField = function (tag, obj, pbf) { 209 | if (tag === 1) obj.hdcp = pbf.readVarint(); 210 | else if (tag === 2) obj.cgms_flags = pbf.readVarint(); 211 | }; 212 | License.KeyContainer.OutputProtection.write = function (obj, pbf) { 213 | if (obj.hdcp != undefined && obj.hdcp !== {"value":0,"options":{}}) pbf.writeVarintField(1, obj.hdcp); 214 | if (obj.cgms_flags != undefined && obj.cgms_flags !== {"value":42,"options":{}}) pbf.writeVarintField(2, obj.cgms_flags); 215 | }; 216 | 217 | License.KeyContainer.OutputProtection.HDCP = { 218 | "HDCP_NONE": { 219 | "value": 0, 220 | "options": {} 221 | }, 222 | "HDCP_V1": { 223 | "value": 1, 224 | "options": {} 225 | }, 226 | "HDCP_V2": { 227 | "value": 2, 228 | "options": {} 229 | }, 230 | "HDCP_V2_1": { 231 | "value": 3, 232 | "options": {} 233 | }, 234 | "HDCP_V2_2": { 235 | "value": 4, 236 | "options": {} 237 | }, 238 | "HDCP_NO_DIGITAL_OUTPUT": { 239 | "value": 255, 240 | "options": {} 241 | } 242 | }; 243 | 244 | License.KeyContainer.OutputProtection.CGMS = { 245 | "CGMS_NONE": { 246 | "value": 42, 247 | "options": {} 248 | }, 249 | "COPY_FREE": { 250 | "value": 0, 251 | "options": {} 252 | }, 253 | "COPY_ONCE": { 254 | "value": 2, 255 | "options": {} 256 | }, 257 | "COPY_NEVER": { 258 | "value": 3, 259 | "options": {} 260 | } 261 | }; 262 | 263 | // License.KeyContainer.VideoResolutionConstraint ======================================== 264 | 265 | License.KeyContainer.VideoResolutionConstraint = {}; 266 | 267 | License.KeyContainer.VideoResolutionConstraint.read = function (pbf, end) { 268 | return pbf.readFields(License.KeyContainer.VideoResolutionConstraint._readField, {min_resolution_pixels: 0, max_resolution_pixels: 0, required_protection: null}, end); 269 | }; 270 | License.KeyContainer.VideoResolutionConstraint._readField = function (tag, obj, pbf) { 271 | if (tag === 1) obj.min_resolution_pixels = pbf.readVarint(); 272 | else if (tag === 2) obj.max_resolution_pixels = pbf.readVarint(); 273 | else if (tag === 3) obj.required_protection = License.KeyContainer.OutputProtection.read(pbf, pbf.readVarint() + pbf.pos); 274 | }; 275 | License.KeyContainer.VideoResolutionConstraint.write = function (obj, pbf) { 276 | if (obj.min_resolution_pixels) pbf.writeVarintField(1, obj.min_resolution_pixels); 277 | if (obj.max_resolution_pixels) pbf.writeVarintField(2, obj.max_resolution_pixels); 278 | if (obj.required_protection) pbf.writeMessage(3, License.KeyContainer.OutputProtection.write, obj.required_protection); 279 | }; 280 | 281 | // License.KeyContainer.OperatorSessionKeyPermissions ======================================== 282 | 283 | License.KeyContainer.OperatorSessionKeyPermissions = {}; 284 | 285 | License.KeyContainer.OperatorSessionKeyPermissions.read = function (pbf, end) { 286 | return pbf.readFields(License.KeyContainer.OperatorSessionKeyPermissions._readField, {allow_encrypt: false, allow_decrypt: false, allow_sign: false, allow_signature_verify: false}, end); 287 | }; 288 | License.KeyContainer.OperatorSessionKeyPermissions._readField = function (tag, obj, pbf) { 289 | if (tag === 1) obj.allow_encrypt = pbf.readBoolean(); 290 | else if (tag === 2) obj.allow_decrypt = pbf.readBoolean(); 291 | else if (tag === 3) obj.allow_sign = pbf.readBoolean(); 292 | else if (tag === 4) obj.allow_signature_verify = pbf.readBoolean(); 293 | }; 294 | License.KeyContainer.OperatorSessionKeyPermissions.write = function (obj, pbf) { 295 | if (obj.allow_encrypt) pbf.writeBooleanField(1, obj.allow_encrypt); 296 | if (obj.allow_decrypt) pbf.writeBooleanField(2, obj.allow_decrypt); 297 | if (obj.allow_sign) pbf.writeBooleanField(3, obj.allow_sign); 298 | if (obj.allow_signature_verify) pbf.writeBooleanField(4, obj.allow_signature_verify); 299 | }; 300 | 301 | // LicenseRequest ======================================== 302 | 303 | var LicenseRequest = self.LicenseRequest = {}; 304 | 305 | LicenseRequest.read = function (pbf, end) { 306 | return pbf.readFields(LicenseRequest._readField, {client_id: null, content_id: null, type: 0, request_time: 0, key_control_nonce_deprecated: null, protocol_version: {"value":20,"options":{}}, key_control_nonce: 0, encrypted_client_id: null}, end); 307 | }; 308 | LicenseRequest._readField = function (tag, obj, pbf) { 309 | if (tag === 1) obj.client_id = ClientIdentification.read(pbf, pbf.readVarint() + pbf.pos); 310 | else if (tag === 2) obj.content_id = LicenseRequest.ContentIdentification.read(pbf, pbf.readVarint() + pbf.pos); 311 | else if (tag === 3) obj.type = pbf.readVarint(); 312 | else if (tag === 4) obj.request_time = pbf.readVarint(true); 313 | else if (tag === 5) obj.key_control_nonce_deprecated = pbf.readBytes(); 314 | else if (tag === 6) obj.protocol_version = pbf.readVarint(); 315 | else if (tag === 7) obj.key_control_nonce = pbf.readVarint(); 316 | else if (tag === 8) obj.encrypted_client_id = EncryptedClientIdentification.read(pbf, pbf.readVarint() + pbf.pos); 317 | }; 318 | LicenseRequest.write = function (obj, pbf) { 319 | if (obj.client_id) pbf.writeMessage(1, ClientIdentification.write, obj.client_id); 320 | if (obj.content_id) pbf.writeMessage(2, LicenseRequest.ContentIdentification.write, obj.content_id); 321 | if (obj.type) pbf.writeVarintField(3, obj.type); 322 | if (obj.request_time) pbf.writeVarintField(4, obj.request_time); 323 | if (obj.key_control_nonce_deprecated) pbf.writeBytesField(5, obj.key_control_nonce_deprecated); 324 | if (obj.protocol_version != undefined && obj.protocol_version !== {"value":20,"options":{}}) pbf.writeVarintField(6, obj.protocol_version); 325 | if (obj.key_control_nonce) pbf.writeVarintField(7, obj.key_control_nonce); 326 | if (obj.encrypted_client_id) pbf.writeMessage(8, EncryptedClientIdentification.write, obj.encrypted_client_id); 327 | }; 328 | 329 | LicenseRequest.RequestType = { 330 | "NEW": { 331 | "value": 1, 332 | "options": {} 333 | }, 334 | "RENEWAL": { 335 | "value": 2, 336 | "options": {} 337 | }, 338 | "RELEASE": { 339 | "value": 3, 340 | "options": {} 341 | } 342 | }; 343 | 344 | // LicenseRequest.ContentIdentification ======================================== 345 | 346 | LicenseRequest.ContentIdentification = {}; 347 | 348 | LicenseRequest.ContentIdentification.read = function (pbf, end) { 349 | return pbf.readFields(LicenseRequest.ContentIdentification._readField, {cenc_id: null, webm_id: null, license: null}, end); 350 | }; 351 | LicenseRequest.ContentIdentification._readField = function (tag, obj, pbf) { 352 | if (tag === 1) obj.cenc_id = LicenseRequest.ContentIdentification.CENC.read(pbf, pbf.readVarint() + pbf.pos); 353 | else if (tag === 2) obj.webm_id = LicenseRequest.ContentIdentification.WebM.read(pbf, pbf.readVarint() + pbf.pos); 354 | else if (tag === 3) obj.license = LicenseRequest.ContentIdentification.ExistingLicense.read(pbf, pbf.readVarint() + pbf.pos); 355 | }; 356 | LicenseRequest.ContentIdentification.write = function (obj, pbf) { 357 | if (obj.cenc_id) pbf.writeMessage(1, LicenseRequest.ContentIdentification.CENC.write, obj.cenc_id); 358 | if (obj.webm_id) pbf.writeMessage(2, LicenseRequest.ContentIdentification.WebM.write, obj.webm_id); 359 | if (obj.license) pbf.writeMessage(3, LicenseRequest.ContentIdentification.ExistingLicense.write, obj.license); 360 | }; 361 | 362 | // LicenseRequest.ContentIdentification.CENC ======================================== 363 | 364 | LicenseRequest.ContentIdentification.CENC = {}; 365 | 366 | LicenseRequest.ContentIdentification.CENC.read = function (pbf, end) { 367 | return pbf.readFields(LicenseRequest.ContentIdentification.CENC._readField, {pssh: [], license_type: 0, request_id: null}, end); 368 | }; 369 | LicenseRequest.ContentIdentification.CENC._readField = function (tag, obj, pbf) { 370 | if (tag === 1) obj.pssh.push(pbf.readBytes()); 371 | else if (tag === 2) obj.license_type = pbf.readVarint(); 372 | else if (tag === 3) obj.request_id = pbf.readBytes(); 373 | }; 374 | LicenseRequest.ContentIdentification.CENC.write = function (obj, pbf) { 375 | if (obj.pssh) for (var i = 0; i < obj.pssh.length; i++) pbf.writeBytesField(1, obj.pssh[i]); 376 | if (obj.license_type) pbf.writeVarintField(2, obj.license_type); 377 | if (obj.request_id) pbf.writeBytesField(3, obj.request_id); 378 | }; 379 | 380 | // LicenseRequest.ContentIdentification.WebM ======================================== 381 | 382 | LicenseRequest.ContentIdentification.WebM = {}; 383 | 384 | LicenseRequest.ContentIdentification.WebM.read = function (pbf, end) { 385 | return pbf.readFields(LicenseRequest.ContentIdentification.WebM._readField, {header: null, license_type: 0, request_id: null}, end); 386 | }; 387 | LicenseRequest.ContentIdentification.WebM._readField = function (tag, obj, pbf) { 388 | if (tag === 1) obj.header = pbf.readBytes(); 389 | else if (tag === 2) obj.license_type = pbf.readVarint(); 390 | else if (tag === 3) obj.request_id = pbf.readBytes(); 391 | }; 392 | LicenseRequest.ContentIdentification.WebM.write = function (obj, pbf) { 393 | if (obj.header) pbf.writeBytesField(1, obj.header); 394 | if (obj.license_type) pbf.writeVarintField(2, obj.license_type); 395 | if (obj.request_id) pbf.writeBytesField(3, obj.request_id); 396 | }; 397 | 398 | // LicenseRequest.ContentIdentification.ExistingLicense ======================================== 399 | 400 | LicenseRequest.ContentIdentification.ExistingLicense = {}; 401 | 402 | LicenseRequest.ContentIdentification.ExistingLicense.read = function (pbf, end) { 403 | return pbf.readFields(LicenseRequest.ContentIdentification.ExistingLicense._readField, {license_id: null, seconds_since_started: 0, seconds_since_last_played: 0, session_usage_table_entry: null}, end); 404 | }; 405 | LicenseRequest.ContentIdentification.ExistingLicense._readField = function (tag, obj, pbf) { 406 | if (tag === 1) obj.license_id = LicenseIdentification.read(pbf, pbf.readVarint() + pbf.pos); 407 | else if (tag === 2) obj.seconds_since_started = pbf.readVarint(true); 408 | else if (tag === 3) obj.seconds_since_last_played = pbf.readVarint(true); 409 | else if (tag === 4) obj.session_usage_table_entry = pbf.readBytes(); 410 | }; 411 | LicenseRequest.ContentIdentification.ExistingLicense.write = function (obj, pbf) { 412 | if (obj.license_id) pbf.writeMessage(1, LicenseIdentification.write, obj.license_id); 413 | if (obj.seconds_since_started) pbf.writeVarintField(2, obj.seconds_since_started); 414 | if (obj.seconds_since_last_played) pbf.writeVarintField(3, obj.seconds_since_last_played); 415 | if (obj.session_usage_table_entry) pbf.writeBytesField(4, obj.session_usage_table_entry); 416 | }; 417 | 418 | // LicenseError ======================================== 419 | 420 | var LicenseError = self.LicenseError = {}; 421 | 422 | LicenseError.read = function (pbf, end) { 423 | return pbf.readFields(LicenseError._readField, {error_code: 0}, end); 424 | }; 425 | LicenseError._readField = function (tag, obj, pbf) { 426 | if (tag === 1) obj.error_code = pbf.readVarint(); 427 | }; 428 | LicenseError.write = function (obj, pbf) { 429 | if (obj.error_code) pbf.writeVarintField(1, obj.error_code); 430 | }; 431 | 432 | LicenseError.Error = { 433 | "INVALID_DEVICE_CERTIFICATE": { 434 | "value": 1, 435 | "options": {} 436 | }, 437 | "REVOKED_DEVICE_CERTIFICATE": { 438 | "value": 2, 439 | "options": {} 440 | }, 441 | "SERVICE_UNAVAILABLE": { 442 | "value": 3, 443 | "options": {} 444 | } 445 | }; 446 | 447 | // RemoteAttestation ======================================== 448 | 449 | var RemoteAttestation = self.RemoteAttestation = {}; 450 | 451 | RemoteAttestation.read = function (pbf, end) { 452 | return pbf.readFields(RemoteAttestation._readField, {certificate: null, salt: null, signature: null}, end); 453 | }; 454 | RemoteAttestation._readField = function (tag, obj, pbf) { 455 | if (tag === 1) obj.certificate = EncryptedClientIdentification.read(pbf, pbf.readVarint() + pbf.pos); 456 | else if (tag === 2) obj.salt = pbf.readBytes(); 457 | else if (tag === 3) obj.signature = pbf.readBytes(); 458 | }; 459 | RemoteAttestation.write = function (obj, pbf) { 460 | if (obj.certificate) pbf.writeMessage(1, EncryptedClientIdentification.write, obj.certificate); 461 | if (obj.salt) pbf.writeBytesField(2, obj.salt); 462 | if (obj.signature) pbf.writeBytesField(3, obj.signature); 463 | }; 464 | 465 | // SignedMessage ======================================== 466 | 467 | var SignedMessage = self.SignedMessage = {}; 468 | 469 | SignedMessage.read = function (pbf, end) { 470 | return pbf.readFields(SignedMessage._readField, {type: 0, msg: null, signature: null, session_key: null, remote_attestation: null}, end); 471 | }; 472 | SignedMessage._readField = function (tag, obj, pbf) { 473 | if (tag === 1) obj.type = pbf.readVarint(); 474 | else if (tag === 2) obj.msg = pbf.readBytes(); 475 | else if (tag === 3) obj.signature = pbf.readBytes(); 476 | else if (tag === 4) obj.session_key = pbf.readBytes(); 477 | else if (tag === 5) obj.remote_attestation = RemoteAttestation.read(pbf, pbf.readVarint() + pbf.pos); 478 | }; 479 | SignedMessage.write = function (obj, pbf) { 480 | if (obj.type) pbf.writeVarintField(1, obj.type); 481 | if (obj.msg) pbf.writeBytesField(2, obj.msg); 482 | if (obj.signature) pbf.writeBytesField(3, obj.signature); 483 | if (obj.session_key) pbf.writeBytesField(4, obj.session_key); 484 | if (obj.remote_attestation) pbf.writeMessage(5, RemoteAttestation.write, obj.remote_attestation); 485 | }; 486 | 487 | SignedMessage.MessageType = { 488 | "LICENSE_REQUEST": { 489 | "value": 1, 490 | "options": {} 491 | }, 492 | "LICENSE": { 493 | "value": 2, 494 | "options": {} 495 | }, 496 | "ERROR_RESPONSE": { 497 | "value": 3, 498 | "options": {} 499 | }, 500 | "SERVICE_CERTIFICATE_REQUEST": { 501 | "value": 4, 502 | "options": {} 503 | }, 504 | "SERVICE_CERTIFICATE": { 505 | "value": 5, 506 | "options": {} 507 | } 508 | }; 509 | 510 | // ProvisioningOptions ======================================== 511 | 512 | var ProvisioningOptions = self.ProvisioningOptions = {}; 513 | 514 | ProvisioningOptions.read = function (pbf, end) { 515 | return pbf.readFields(ProvisioningOptions._readField, {certificate_type: 0, certificate_authority: ""}, end); 516 | }; 517 | ProvisioningOptions._readField = function (tag, obj, pbf) { 518 | if (tag === 1) obj.certificate_type = pbf.readVarint(); 519 | else if (tag === 2) obj.certificate_authority = pbf.readString(); 520 | }; 521 | ProvisioningOptions.write = function (obj, pbf) { 522 | if (obj.certificate_type) pbf.writeVarintField(1, obj.certificate_type); 523 | if (obj.certificate_authority) pbf.writeStringField(2, obj.certificate_authority); 524 | }; 525 | 526 | ProvisioningOptions.CertificateType = { 527 | "WIDEVINE_DRM": { 528 | "value": 0, 529 | "options": {} 530 | }, 531 | "X509": { 532 | "value": 1, 533 | "options": {} 534 | } 535 | }; 536 | 537 | // ProvisioningRequest ======================================== 538 | 539 | var ProvisioningRequest = self.ProvisioningRequest = {}; 540 | 541 | ProvisioningRequest.read = function (pbf, end) { 542 | return pbf.readFields(ProvisioningRequest._readField, {client_id: null, nonce: null, options: null, stable_id: null}, end); 543 | }; 544 | ProvisioningRequest._readField = function (tag, obj, pbf) { 545 | if (tag === 1) obj.client_id = ClientIdentification.read(pbf, pbf.readVarint() + pbf.pos); 546 | else if (tag === 2) obj.nonce = pbf.readBytes(); 547 | else if (tag === 3) obj.options = ProvisioningOptions.read(pbf, pbf.readVarint() + pbf.pos); 548 | else if (tag === 4) obj.stable_id = pbf.readBytes(); 549 | }; 550 | ProvisioningRequest.write = function (obj, pbf) { 551 | if (obj.client_id) pbf.writeMessage(1, ClientIdentification.write, obj.client_id); 552 | if (obj.nonce) pbf.writeBytesField(2, obj.nonce); 553 | if (obj.options) pbf.writeMessage(3, ProvisioningOptions.write, obj.options); 554 | if (obj.stable_id) pbf.writeBytesField(4, obj.stable_id); 555 | }; 556 | 557 | // ProvisioningResponse ======================================== 558 | 559 | var ProvisioningResponse = self.ProvisioningResponse = {}; 560 | 561 | ProvisioningResponse.read = function (pbf, end) { 562 | return pbf.readFields(ProvisioningResponse._readField, {device_rsa_key: null, device_rsa_key_iv: null, device_certificate: null, nonce: null}, end); 563 | }; 564 | ProvisioningResponse._readField = function (tag, obj, pbf) { 565 | if (tag === 1) obj.device_rsa_key = pbf.readBytes(); 566 | else if (tag === 2) obj.device_rsa_key_iv = pbf.readBytes(); 567 | else if (tag === 3) obj.device_certificate = pbf.readBytes(); 568 | else if (tag === 4) obj.nonce = pbf.readBytes(); 569 | }; 570 | ProvisioningResponse.write = function (obj, pbf) { 571 | if (obj.device_rsa_key) pbf.writeBytesField(1, obj.device_rsa_key); 572 | if (obj.device_rsa_key_iv) pbf.writeBytesField(2, obj.device_rsa_key_iv); 573 | if (obj.device_certificate) pbf.writeBytesField(3, obj.device_certificate); 574 | if (obj.nonce) pbf.writeBytesField(4, obj.nonce); 575 | }; 576 | 577 | // SignedProvisioningMessage ======================================== 578 | 579 | var SignedProvisioningMessage = self.SignedProvisioningMessage = {}; 580 | 581 | SignedProvisioningMessage.read = function (pbf, end) { 582 | return pbf.readFields(SignedProvisioningMessage._readField, {message: null, signature: null}, end); 583 | }; 584 | SignedProvisioningMessage._readField = function (tag, obj, pbf) { 585 | if (tag === 1) obj.message = pbf.readBytes(); 586 | else if (tag === 2) obj.signature = pbf.readBytes(); 587 | }; 588 | SignedProvisioningMessage.write = function (obj, pbf) { 589 | if (obj.message) pbf.writeBytesField(1, obj.message); 590 | if (obj.signature) pbf.writeBytesField(2, obj.signature); 591 | }; 592 | 593 | // ClientIdentification ======================================== 594 | 595 | var ClientIdentification = self.ClientIdentification = {}; 596 | 597 | ClientIdentification.read = function (pbf, end) { 598 | return pbf.readFields(ClientIdentification._readField, {type: {"value":0,"options":{}}, token: null, client_info: [], provider_client_token: null, license_counter: 0, client_capabilities: null}, end); 599 | }; 600 | ClientIdentification._readField = function (tag, obj, pbf) { 601 | if (tag === 1) obj.type = pbf.readVarint(); 602 | else if (tag === 2) obj.token = pbf.readBytes(); 603 | else if (tag === 3) obj.client_info.push(ClientIdentification.NameValue.read(pbf, pbf.readVarint() + pbf.pos)); 604 | else if (tag === 4) obj.provider_client_token = pbf.readBytes(); 605 | else if (tag === 5) obj.license_counter = pbf.readVarint(); 606 | else if (tag === 6) obj.client_capabilities = ClientIdentification.ClientCapabilities.read(pbf, pbf.readVarint() + pbf.pos); 607 | }; 608 | ClientIdentification.write = function (obj, pbf) { 609 | if (obj.type != undefined && obj.type !== {"value":0,"options":{}}) pbf.writeVarintField(1, obj.type); 610 | if (obj.token) pbf.writeBytesField(2, obj.token); 611 | if (obj.client_info) for (var i = 0; i < obj.client_info.length; i++) pbf.writeMessage(3, ClientIdentification.NameValue.write, obj.client_info[i]); 612 | if (obj.provider_client_token) pbf.writeBytesField(4, obj.provider_client_token); 613 | if (obj.license_counter) pbf.writeVarintField(5, obj.license_counter); 614 | if (obj.client_capabilities) pbf.writeMessage(6, ClientIdentification.ClientCapabilities.write, obj.client_capabilities); 615 | }; 616 | 617 | ClientIdentification.TokenType = { 618 | "KEYBOX": { 619 | "value": 0, 620 | "options": {} 621 | }, 622 | "DEVICE_CERTIFICATE": { 623 | "value": 1, 624 | "options": {} 625 | }, 626 | "REMOTE_ATTESTATION_CERTIFICATE": { 627 | "value": 2, 628 | "options": {} 629 | } 630 | }; 631 | 632 | // ClientIdentification.NameValue ======================================== 633 | 634 | ClientIdentification.NameValue = {}; 635 | 636 | ClientIdentification.NameValue.read = function (pbf, end) { 637 | return pbf.readFields(ClientIdentification.NameValue._readField, {name: "", value: ""}, end); 638 | }; 639 | ClientIdentification.NameValue._readField = function (tag, obj, pbf) { 640 | if (tag === 1) obj.name = pbf.readString(); 641 | else if (tag === 2) obj.value = pbf.readString(); 642 | }; 643 | ClientIdentification.NameValue.write = function (obj, pbf) { 644 | if (obj.name) pbf.writeStringField(1, obj.name); 645 | if (obj.value) pbf.writeStringField(2, obj.value); 646 | }; 647 | 648 | // ClientIdentification.ClientCapabilities ======================================== 649 | 650 | ClientIdentification.ClientCapabilities = {}; 651 | 652 | ClientIdentification.ClientCapabilities.read = function (pbf, end) { 653 | return pbf.readFields(ClientIdentification.ClientCapabilities._readField, {client_token: false, session_token: false, video_resolution_constraints: false, max_hdcp_version: {"value":0,"options":{}}, oem_crypto_api_version: 0, anti_rollback_usage_table: false}, end); 654 | }; 655 | ClientIdentification.ClientCapabilities._readField = function (tag, obj, pbf) { 656 | if (tag === 1) obj.client_token = pbf.readBoolean(); 657 | else if (tag === 2) obj.session_token = pbf.readBoolean(); 658 | else if (tag === 3) obj.video_resolution_constraints = pbf.readBoolean(); 659 | else if (tag === 4) obj.max_hdcp_version = pbf.readVarint(); 660 | else if (tag === 5) obj.oem_crypto_api_version = pbf.readVarint(); 661 | else if (tag === 6) obj.anti_rollback_usage_table = pbf.readBoolean(); 662 | }; 663 | ClientIdentification.ClientCapabilities.write = function (obj, pbf) { 664 | if (obj.client_token) pbf.writeBooleanField(1, obj.client_token); 665 | if (obj.session_token) pbf.writeBooleanField(2, obj.session_token); 666 | if (obj.video_resolution_constraints) pbf.writeBooleanField(3, obj.video_resolution_constraints); 667 | if (obj.max_hdcp_version != undefined && obj.max_hdcp_version !== {"value":0,"options":{}}) pbf.writeVarintField(4, obj.max_hdcp_version); 668 | if (obj.oem_crypto_api_version) pbf.writeVarintField(5, obj.oem_crypto_api_version); 669 | if (obj.anti_rollback_usage_table) pbf.writeBooleanField(6, obj.anti_rollback_usage_table); 670 | }; 671 | 672 | ClientIdentification.ClientCapabilities.HdcpVersion = { 673 | "HDCP_NONE": { 674 | "value": 0, 675 | "options": {} 676 | }, 677 | "HDCP_V1": { 678 | "value": 1, 679 | "options": {} 680 | }, 681 | "HDCP_V2": { 682 | "value": 2, 683 | "options": {} 684 | }, 685 | "HDCP_V2_1": { 686 | "value": 3, 687 | "options": {} 688 | }, 689 | "HDCP_V2_2": { 690 | "value": 4, 691 | "options": {} 692 | }, 693 | "HDCP_NO_DIGITAL_OUTPUT": { 694 | "value": 255, 695 | "options": {} 696 | } 697 | }; 698 | 699 | // EncryptedClientIdentification ======================================== 700 | 701 | var EncryptedClientIdentification = self.EncryptedClientIdentification = {}; 702 | 703 | EncryptedClientIdentification.read = function (pbf, end) { 704 | return pbf.readFields(EncryptedClientIdentification._readField, {service_id: "", service_certificate_serial_number: null, encrypted_client_id: null, encrypted_client_id_iv: null, encrypted_privacy_key: null}, end); 705 | }; 706 | EncryptedClientIdentification._readField = function (tag, obj, pbf) { 707 | if (tag === 1) obj.service_id = pbf.readString(); 708 | else if (tag === 2) obj.service_certificate_serial_number = pbf.readBytes(); 709 | else if (tag === 3) obj.encrypted_client_id = pbf.readBytes(); 710 | else if (tag === 4) obj.encrypted_client_id_iv = pbf.readBytes(); 711 | else if (tag === 5) obj.encrypted_privacy_key = pbf.readBytes(); 712 | }; 713 | EncryptedClientIdentification.write = function (obj, pbf) { 714 | if (obj.service_id) pbf.writeStringField(1, obj.service_id); 715 | if (obj.service_certificate_serial_number) pbf.writeBytesField(2, obj.service_certificate_serial_number); 716 | if (obj.encrypted_client_id) pbf.writeBytesField(3, obj.encrypted_client_id); 717 | if (obj.encrypted_client_id_iv) pbf.writeBytesField(4, obj.encrypted_client_id_iv); 718 | if (obj.encrypted_privacy_key) pbf.writeBytesField(5, obj.encrypted_privacy_key); 719 | }; 720 | 721 | // DeviceCertificate ======================================== 722 | 723 | var DeviceCertificate = self.DeviceCertificate = {}; 724 | 725 | DeviceCertificate.read = function (pbf, end) { 726 | return pbf.readFields(DeviceCertificate._readField, {type: 0, serial_number: null, creation_time_seconds: 0, public_key: null, system_id: 0, test_device_deprecated: false, service_id: ""}, end); 727 | }; 728 | DeviceCertificate._readField = function (tag, obj, pbf) { 729 | if (tag === 1) obj.type = pbf.readVarint(); 730 | else if (tag === 2) obj.serial_number = pbf.readBytes(); 731 | else if (tag === 3) obj.creation_time_seconds = pbf.readVarint(); 732 | else if (tag === 4) obj.public_key = pbf.readBytes(); 733 | else if (tag === 5) obj.system_id = pbf.readVarint(); 734 | else if (tag === 6) obj.test_device_deprecated = pbf.readBoolean(); 735 | else if (tag === 7) obj.service_id = pbf.readString(); 736 | }; 737 | DeviceCertificate.write = function (obj, pbf) { 738 | if (obj.type) pbf.writeVarintField(1, obj.type); 739 | if (obj.serial_number) pbf.writeBytesField(2, obj.serial_number); 740 | if (obj.creation_time_seconds) pbf.writeVarintField(3, obj.creation_time_seconds); 741 | if (obj.public_key) pbf.writeBytesField(4, obj.public_key); 742 | if (obj.system_id) pbf.writeVarintField(5, obj.system_id); 743 | if (obj.test_device_deprecated) pbf.writeBooleanField(6, obj.test_device_deprecated); 744 | if (obj.service_id) pbf.writeStringField(7, obj.service_id); 745 | }; 746 | 747 | DeviceCertificate.CertificateType = { 748 | "ROOT": { 749 | "value": 0, 750 | "options": {} 751 | }, 752 | "INTERMEDIATE": { 753 | "value": 1, 754 | "options": {} 755 | }, 756 | "USER_DEVICE": { 757 | "value": 2, 758 | "options": {} 759 | }, 760 | "SERVICE": { 761 | "value": 3, 762 | "options": {} 763 | } 764 | }; 765 | 766 | // SignedDeviceCertificate ======================================== 767 | 768 | var SignedDeviceCertificate = self.SignedDeviceCertificate = {}; 769 | 770 | SignedDeviceCertificate.read = function (pbf, end) { 771 | return pbf.readFields(SignedDeviceCertificate._readField, {device_certificate: null, signature: null, signer: null}, end); 772 | }; 773 | SignedDeviceCertificate._readField = function (tag, obj, pbf) { 774 | if (tag === 1) obj.device_certificate = pbf.readBytes(); 775 | else if (tag === 2) obj.signature = pbf.readBytes(); 776 | else if (tag === 3) obj.signer = SignedDeviceCertificate.read(pbf, pbf.readVarint() + pbf.pos); 777 | }; 778 | SignedDeviceCertificate.write = function (obj, pbf) { 779 | if (obj.device_certificate) pbf.writeBytesField(1, obj.device_certificate); 780 | if (obj.signature) pbf.writeBytesField(2, obj.signature); 781 | if (obj.signer) pbf.writeMessage(3, SignedDeviceCertificate.write, obj.signer); 782 | }; 783 | 784 | // ProvisionedDeviceInfo ======================================== 785 | 786 | var ProvisionedDeviceInfo = self.ProvisionedDeviceInfo = {}; 787 | 788 | ProvisionedDeviceInfo.read = function (pbf, end) { 789 | return pbf.readFields(ProvisionedDeviceInfo._readField, {system_id: 0, soc: "", manufacturer: "", model: "", device_type: "", model_year: 0, security_level: {"value":0,"options":{}}, test_device: false}, end); 790 | }; 791 | ProvisionedDeviceInfo._readField = function (tag, obj, pbf) { 792 | if (tag === 1) obj.system_id = pbf.readVarint(); 793 | else if (tag === 2) obj.soc = pbf.readString(); 794 | else if (tag === 3) obj.manufacturer = pbf.readString(); 795 | else if (tag === 4) obj.model = pbf.readString(); 796 | else if (tag === 5) obj.device_type = pbf.readString(); 797 | else if (tag === 6) obj.model_year = pbf.readVarint(); 798 | else if (tag === 7) obj.security_level = pbf.readVarint(); 799 | else if (tag === 8) obj.test_device = pbf.readBoolean(); 800 | }; 801 | ProvisionedDeviceInfo.write = function (obj, pbf) { 802 | if (obj.system_id) pbf.writeVarintField(1, obj.system_id); 803 | if (obj.soc) pbf.writeStringField(2, obj.soc); 804 | if (obj.manufacturer) pbf.writeStringField(3, obj.manufacturer); 805 | if (obj.model) pbf.writeStringField(4, obj.model); 806 | if (obj.device_type) pbf.writeStringField(5, obj.device_type); 807 | if (obj.model_year) pbf.writeVarintField(6, obj.model_year); 808 | if (obj.security_level != undefined && obj.security_level !== {"value":0,"options":{}}) pbf.writeVarintField(7, obj.security_level); 809 | if (obj.test_device) pbf.writeBooleanField(8, obj.test_device); 810 | }; 811 | 812 | ProvisionedDeviceInfo.WvSecurityLevel = { 813 | "LEVEL_UNSPECIFIED": { 814 | "value": 0, 815 | "options": {} 816 | }, 817 | "LEVEL_1": { 818 | "value": 1, 819 | "options": {} 820 | }, 821 | "LEVEL_2": { 822 | "value": 2, 823 | "options": {} 824 | }, 825 | "LEVEL_3": { 826 | "value": 3, 827 | "options": {} 828 | } 829 | }; 830 | 831 | // DeviceCertificateStatus ======================================== 832 | 833 | var DeviceCertificateStatus = self.DeviceCertificateStatus = {}; 834 | 835 | DeviceCertificateStatus.read = function (pbf, end) { 836 | return pbf.readFields(DeviceCertificateStatus._readField, {serial_number: null, status: {"value":0,"options":{}}, device_info: null}, end); 837 | }; 838 | DeviceCertificateStatus._readField = function (tag, obj, pbf) { 839 | if (tag === 1) obj.serial_number = pbf.readBytes(); 840 | else if (tag === 2) obj.status = pbf.readVarint(); 841 | else if (tag === 4) obj.device_info = ProvisionedDeviceInfo.read(pbf, pbf.readVarint() + pbf.pos); 842 | }; 843 | DeviceCertificateStatus.write = function (obj, pbf) { 844 | if (obj.serial_number) pbf.writeBytesField(1, obj.serial_number); 845 | if (obj.status != undefined && obj.status !== {"value":0,"options":{}}) pbf.writeVarintField(2, obj.status); 846 | if (obj.device_info) pbf.writeMessage(4, ProvisionedDeviceInfo.write, obj.device_info); 847 | }; 848 | 849 | DeviceCertificateStatus.CertificateStatus = { 850 | "VALID": { 851 | "value": 0, 852 | "options": {} 853 | }, 854 | "REVOKED": { 855 | "value": 1, 856 | "options": {} 857 | } 858 | }; 859 | 860 | // DeviceCertificateStatusList ======================================== 861 | 862 | var DeviceCertificateStatusList = self.DeviceCertificateStatusList = {}; 863 | 864 | DeviceCertificateStatusList.read = function (pbf, end) { 865 | return pbf.readFields(DeviceCertificateStatusList._readField, {creation_time_seconds: 0, certificate_status: []}, end); 866 | }; 867 | DeviceCertificateStatusList._readField = function (tag, obj, pbf) { 868 | if (tag === 1) obj.creation_time_seconds = pbf.readVarint(); 869 | else if (tag === 2) obj.certificate_status.push(DeviceCertificateStatus.read(pbf, pbf.readVarint() + pbf.pos)); 870 | }; 871 | DeviceCertificateStatusList.write = function (obj, pbf) { 872 | if (obj.creation_time_seconds) pbf.writeVarintField(1, obj.creation_time_seconds); 873 | if (obj.certificate_status) for (var i = 0; i < obj.certificate_status.length; i++) pbf.writeMessage(2, DeviceCertificateStatus.write, obj.certificate_status[i]); 874 | }; 875 | 876 | // SignedCertificateStatusList ======================================== 877 | 878 | var SignedCertificateStatusList = self.SignedCertificateStatusList = {}; 879 | 880 | SignedCertificateStatusList.read = function (pbf, end) { 881 | return pbf.readFields(SignedCertificateStatusList._readField, {certificate_status_list: null, signature: null}, end); 882 | }; 883 | SignedCertificateStatusList._readField = function (tag, obj, pbf) { 884 | if (tag === 1) obj.certificate_status_list = pbf.readBytes(); 885 | else if (tag === 2) obj.signature = pbf.readBytes(); 886 | }; 887 | SignedCertificateStatusList.write = function (obj, pbf) { 888 | if (obj.certificate_status_list) pbf.writeBytesField(1, obj.certificate_status_list); 889 | if (obj.signature) pbf.writeBytesField(2, obj.signature); 890 | }; 891 | -------------------------------------------------------------------------------- /script.js: -------------------------------------------------------------------------------- 1 | (function(window, document, $, chrome) { 2 | 'use strict'; 3 | 4 | var scrollPosition; 5 | 6 | function htmlEscape(str, noQuotes) { 7 | var map = []; 8 | map['&'] = '&'; 9 | map['<'] = '<'; 10 | map['>'] = '>'; 11 | 12 | var regex; 13 | 14 | if (noQuotes) { 15 | regex = /[&<>]/g; 16 | } 17 | else { 18 | map['"'] = '"'; 19 | map["'"] = '''; 20 | regex = /[&<>"']/g; 21 | } 22 | 23 | return ('' + str).replace(regex, function(match) { 24 | return map[match]; 25 | }); 26 | } 27 | 28 | function loading(value) { 29 | var $loading = $('#loading'); 30 | var $html = $('html'); 31 | 32 | if (value) { 33 | $loading.width($html.width()); 34 | $loading.height($html.height()); 35 | $loading.show(); 36 | } 37 | else { 38 | $loading.hide(); 39 | } 40 | } 41 | 42 | function getTab(callback) { 43 | chrome.tabs.query({ active: true, currentWindow: true }, function(tab) { 44 | callback(tab[0].id, tab[0].url); 45 | }); 46 | } 47 | 48 | function executeScript(msg, callback) { 49 | getTab(function(tabId) { 50 | var exec = chrome.tabs.executeScript; 51 | 52 | exec(tabId, { code: 'var msg = ' + JSON.stringify(msg) }, function() { 53 | if (chrome.runtime.lastError) { 54 | console.log(chrome.runtime.lastError.message); 55 | callback && callback(undefined); 56 | return; 57 | } 58 | 59 | exec(tabId, { file: 'inject.js' }, function(response) { 60 | callback && callback(response[0]); 61 | }); 62 | }); 63 | }); 64 | } 65 | 66 | function noData() { 67 | var pClass; 68 | var promptText; 69 | 70 | if (type === 'L') { 71 | pClass = 'localstorage'; 72 | promptText = 'local'; 73 | } 74 | else { 75 | pClass = 'sessionstorage'; 76 | promptText = 'session'; 77 | } 78 | return '

No ' + promptText + ' storage data found

'; 79 | } 80 | 81 | function parseDeepJSON(str) { 82 | if (typeof str !== 'string') { 83 | return str; 84 | } 85 | 86 | try { 87 | var obj = JSON.parse(str); 88 | 89 | if (obj === null || typeof obj !== 'object') { 90 | return str; 91 | } 92 | } 93 | catch(e) { 94 | return str; 95 | } 96 | 97 | var tempObj; 98 | 99 | if (Array.isArray(obj)) { 100 | tempObj = []; 101 | } 102 | else { 103 | tempObj = {}; 104 | } 105 | 106 | for (var i in obj) { 107 | tempObj[i] = parseDeepJSON(obj[i]); 108 | } 109 | 110 | return tempObj; 111 | } 112 | 113 | 114 | // https://stackoverflow.com/a/7220510 115 | function syntaxHighlight(json) { 116 | json = htmlEscape(json, true); 117 | 118 | return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) { 119 | var cls = 'number'; 120 | if (/^"/.test(match)) { 121 | if (/:$/.test(match)) { 122 | cls = 'key'; 123 | } else { 124 | cls = 'string'; 125 | } 126 | } else if (/true|false/.test(match)) { 127 | cls = 'boolean'; 128 | } else if (/null/.test(match)) { 129 | cls = 'null'; 130 | } 131 | return '' + match + ''; 132 | }); 133 | } 134 | //------------------------------------------------------------------------------ 135 | 136 | var type; 137 | var $type = $('#type'); 138 | 139 | if (localStorage['type'] === 'L' || localStorage['type'] === undefined) { 140 | type = 'L'; 141 | $type.attr('class', 'localstorage').html('L'); 142 | } 143 | else { 144 | type = 'S'; 145 | $type.attr('class', 'sessionstorage').html('S'); 146 | } 147 | 148 | executeScript({ what: 'get', type: type }, function(response) { 149 | var storage = response; 150 | var str = ''; 151 | var key; 152 | var value; 153 | var size = 0; 154 | var tableClass = type === 'L' ? 'localstorage' : 'sessionstorage'; 155 | 156 | if (storage === undefined) { 157 | str = '

Could not read data from this page

'; 158 | } 159 | 160 | else { 161 | str += ''; 162 | str += ''; 163 | str += ''; 164 | str += ''; 165 | str += ''; 166 | str += ''; 167 | str += ''; 168 | str += ''; 169 | str += ''; 170 | 171 | for (var i in storage) { 172 | key = htmlEscape(i); 173 | value = htmlEscape(storage[i]); 174 | var arrayvalue = value.split(',') 175 | str += ''; 176 | str += ''; 178 | str += ''; 180 | str += ''; 182 | str += ''; 183 | str += ''; 184 | 185 | 186 | size++; 187 | } 188 | 189 | str += '
KIDKEYMPD URL
+
'; 190 | 191 | if (!size) { 192 | str = noData(); 193 | } 194 | } 195 | 196 | $('#table').html(str); 197 | }); 198 | 199 | $('#type').click(function() { 200 | if ($(this).html() === 'L') { 201 | localStorage['type'] = 'S'; 202 | } 203 | else { 204 | localStorage['type'] = 'L'; 205 | } 206 | 207 | location.reload(); 208 | }); 209 | 210 | 211 | $('#add').click(function(e) { 212 | e.preventDefault(); 213 | 214 | var key; 215 | var value; 216 | 217 | key = prompt('Key:'); 218 | 219 | if (key === null) { 220 | return; 221 | } 222 | 223 | value = prompt('Value:'); 224 | 225 | if (value === null) { 226 | return; 227 | } 228 | 229 | var message = { 230 | type: type, 231 | what: 'set', 232 | key: key, 233 | value: value 234 | }; 235 | 236 | executeScript(message, function() { 237 | location.reload(); 238 | }); 239 | }); 240 | 241 | $('#reload').click(function(e) { 242 | e.preventDefault(); 243 | location.reload(); 244 | }); 245 | 246 | 247 | $('#clear').click(function(e) { 248 | e.preventDefault(); 249 | executeScript({ type: type, what: 'clear' }, function() { 250 | location.reload(); 251 | }); 252 | }); 253 | 254 | 255 | 256 | $('#download').click(function(e) { 257 | e.preventDefault(); 258 | 259 | loading(true); 260 | 261 | getTab(function(tabId, tabUrl) { 262 | var host = tabUrl.split('/')[2]; 263 | 264 | /* function zero(n) { 265 | return n < 10 ? '0' + n : n; 266 | } 267 | 268 | var d = new Date; 269 | var date = [zero(d.getFullYear()), zero(d.getMonth() + 1), 270 | zero(d.getDate())].join('-') + '_' + [zero(d.getHours()), 271 | zero(d.getMinutes()), zero(d.getSeconds())].join('-'); */ 272 | 273 | //var filename = host + '-' + date + '.txt'; 274 | var filename = host + '.json'; 275 | 276 | executeScript({ type: type, what: 'export' }, function(response) { 277 | 278 | if (response === undefined) { 279 | loading(false); 280 | return; 281 | } 282 | 283 | /* 284 | var file = new Blob([response]); 285 | var a = document.createElement('a'); 286 | a.href = window.URL.createObjectURL(file); 287 | a.download = filename; 288 | a.style.display = 'none'; 289 | document.body.appendChild(a); 290 | a.click(); 291 | document.body.removeChild(a); 292 | */ 293 | 294 | var iframe = document.createElement('iframe'); 295 | iframe.style.display = 'none'; 296 | iframe.onload = function() { 297 | var doc = this.contentDocument; 298 | var file = new Blob([response]); 299 | var a = doc.createElement('a'); 300 | a.href = window.URL.createObjectURL(file); 301 | a.download = filename; 302 | a.style.display = 'none'; 303 | doc.body.appendChild(a); 304 | a.click(); 305 | document.body.removeChild(a); 306 | }; 307 | document.body.appendChild(iframe); 308 | 309 | loading(false); 310 | }); 311 | }); 312 | 313 | }); 314 | 315 | 316 | $('#copy').click(function(e) { 317 | e.preventDefault(); 318 | 319 | loading(true); 320 | 321 | executeScript({ type: type, what: 'export' }, function(response) { 322 | 323 | if (response === undefined) { 324 | loading(false); 325 | return; 326 | } 327 | 328 | var e = document.createElement('textarea'); 329 | e.style.position = 'fixed'; 330 | e.style.opacity = 0; 331 | e.value = response; 332 | document.body.appendChild(e); 333 | e.select(); 334 | document.execCommand('copy'); 335 | document.body.removeChild(e); 336 | 337 | loading(false); 338 | }); 339 | }); 340 | 341 | 342 | 343 | $('#table').on('input', 'input', function() { 344 | var $this = $(this); 345 | var $parent = $this.parent(); 346 | 347 | var oldKey; 348 | var key; 349 | var value; 350 | 351 | // Editing the value 352 | if ($parent.attr('class') === 'td-value') { 353 | key = $parent.prev().find('input').val(); 354 | value = $this.val(); 355 | } 356 | 357 | // Editing the key 358 | else { 359 | oldKey = $this.data('key'); 360 | key = $this.val(); 361 | $this.data('key', key); 362 | value = $parent.next().find('input').val(); 363 | } 364 | 365 | var message = { 366 | type: type, 367 | what: 'set', 368 | oldKey: oldKey, 369 | key: key, 370 | value: value 371 | }; 372 | 373 | executeScript(message); 374 | }); 375 | 376 | $('#table').on('click', 'td.td-icon', function() { 377 | var $this = $(this); 378 | 379 | // minus / open 380 | var icon = $this.attr('class').split(' ')[1]; 381 | 382 | if (icon === 'minus') { 383 | 384 | var $parent = $this.parent(); 385 | var key = $this.prev().prev().find('input').val(); 386 | 387 | executeScript({ type: type, what: 'remove', key: key }, function() { 388 | $parent.fadeOut(100, function() { 389 | 390 | var siblingsLen = $parent.siblings().length; 391 | 392 | $parent.remove(); 393 | // If removed all, removes the table too 394 | if (!siblingsLen) { 395 | $('#table').html(noData()) 396 | } 397 | }); 398 | }); 399 | } 400 | 401 | else if (icon === 'open') { 402 | var $siblings = $this.siblings(); 403 | var $inputValue = $siblings.eq(-1).find('input'); 404 | var value = $inputValue.val(); 405 | var json = parseDeepJSON(value); 406 | 407 | if (typeof json === 'object') { 408 | value = syntaxHighlight(JSON.stringify(json, null, 4)); 409 | } 410 | else { 411 | value = htmlEscape(value); 412 | } 413 | 414 | scrollPosition = document.body.scrollTop; 415 | 416 | $('#main').hide(); 417 | $('#code').html(value); 418 | $('#json').show(); 419 | 420 | scroll(0, 0); 421 | } 422 | }); 423 | 424 | $('#back').click(function(e) { 425 | $('#json').hide(); 426 | $('#code').html(''); 427 | $('#main').show(); 428 | 429 | scroll(0, scrollPosition); 430 | }); 431 | 432 | })(window, document, jQuery, chrome); 433 | -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | /* CSS reset ---------------------------------------------------------------- */ 2 | body, div, p, img, 3 | form, input, button { 4 | padding: 0; 5 | margin: 0; 6 | font: inherit 7 | } 8 | 9 | input { 10 | font-family: inherit; 11 | font-size: 100%; 12 | vertical-align: baseline; 13 | background-color: #FFF 14 | } 15 | 16 | img, iframe { 17 | border: 0; 18 | vertical-align: middle 19 | } 20 | 21 | .clear { 22 | clear: both 23 | } 24 | .clearfix:after { 25 | visibility: hidden; 26 | display: block; 27 | font-size: 0; 28 | content: " "; 29 | clear: both; 30 | height: 0 31 | } 32 | * { 33 | box-sizing: border-box 34 | } 35 | 36 | :focus { 37 | outline-color: #0A2BED 38 | } 39 | /* Fim CSS reset ------------------------------------------------------------ */ 40 | 41 | 42 | body { 43 | margin: 0; 44 | padding: 5px; 45 | width: 600px; 46 | font: 13px droid sans, segoe ui, ubuntu, arial, sans serif 47 | } 48 | 49 | #main { 50 | display: block 51 | } 52 | 53 | #json { 54 | display: none 55 | } 56 | 57 | #loading { 58 | position: absolute; 59 | top: 0; 60 | left: 0; 61 | background-color: #FFF; 62 | opacity: .8 63 | } 64 | 65 | #type { 66 | padding: 3px; 67 | margin: 2px 0 10px 10px; 68 | width: 25px; 69 | height: 25px; 70 | float: left; 71 | color: #888; 72 | border-radius: 50%; 73 | text-align: center; 74 | font-weight: bold; 75 | cursor: pointer; 76 | user-select: none 77 | } 78 | 79 | #type.localstorage { 80 | background-color: #FFEB3B; 81 | border: 1px solid #FFEB3B 82 | } 83 | 84 | #type.sessionstorage { 85 | background-color: #B2FF59; 86 | border: 1px solid #B2FF59 87 | } 88 | 89 | #buttons { 90 | margin-left: 80px; 91 | float: left 92 | } 93 | 94 | button { 95 | padding: 4px 18px; 96 | margin: 2px 0 10px 10px; 97 | box-shadow: inset 0px 1px 0px 0px #ffffff; 98 | background: linear-gradient(to bottom, #ffffff 5%, #f6f6f6 100%); 99 | border-radius: 3px; 100 | border: 1px solid #dcdcdc; 101 | display: inline-block; 102 | color: #555; 103 | text-decoration: none; 104 | text-shadow: 0px 1px 0px #ffffff 105 | } 106 | 107 | button:hover { 108 | background: linear-gradient(to bottom, #f6f6f6 5%, #ffffff 100%); 109 | } 110 | 111 | button:active { 112 | position: relative; 113 | top: 1px 114 | } 115 | 116 | button:focus { 117 | outline: none 118 | } 119 | 120 | table { 121 | border-collapse: collapse; 122 | border-spacing: 0 123 | } 124 | 125 | th { 126 | padding: 5px; 127 | font-weight: normal; 128 | } 129 | 130 | table.localstorage th { 131 | background-color: #FFF59D 132 | } 133 | 134 | table.sessionstorage th { 135 | background-color: #CCFF90 136 | } 137 | 138 | input[type="text"] { 139 | width: 100%; 140 | padding: 7px; 141 | border: 0 142 | } 143 | 144 | th, td { 145 | border: 1px solid #DDD; 146 | width : 186px 147 | } 148 | 149 | .td-nome { 150 | width: 250px 151 | } 152 | 153 | .td-value { 154 | width: 250px 155 | } 156 | 157 | .td-icon { 158 | font-size:24px; 159 | font-weight:bold; 160 | width: 30px; 161 | text-align: center 162 | } 163 | 164 | td.td-icon { 165 | cursor: pointer 166 | } 167 | 168 | p { 169 | font-size: 15px; 170 | font-style: italic 171 | } 172 | 173 | p.localstorage { 174 | color: #E65100 175 | } 176 | 177 | p.sessionstorage { 178 | color: #33691E 179 | } 180 | 181 | p.error { 182 | color: #d50000 183 | } 184 | 185 | #back { 186 | position: fixed; 187 | top: 2px; 188 | right: 2px 189 | } 190 | 191 | #code { 192 | margin-top: 30px; 193 | white-space: pre-wrap; 194 | word-wrap: break-word 195 | } 196 | 197 | .string { 198 | color: #DF0101 199 | } 200 | 201 | .number { 202 | color: #0B610B 203 | } 204 | 205 | .boolean { 206 | color: #5F04B4 207 | } 208 | 209 | .null { 210 | color: #FF8000 211 | } 212 | 213 | .key { 214 | color: #0000FF 215 | } 216 | -------------------------------------------------------------------------------- /wasm/wasm_gsr.js: -------------------------------------------------------------------------------- 1 | 2 | var WasmDsp = (function() { 3 | var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; 4 | if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename; 5 | return ( 6 | function(WasmDsp) { 7 | WasmDsp = WasmDsp || {}; 8 | 9 | var Module=typeof WasmDsp!=="undefined"?WasmDsp:{};var readyPromiseResolve,readyPromiseReject;Module["ready"]=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject});var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var arguments_=[];var thisProgram="./this.program";var quit_=function(status,toThrow){throw toThrow};var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;var nodeFS;var nodePath;if(ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){scriptDirectory=require("path").dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}read_=function shell_read(filename,binary){if(!nodeFS)nodeFS=require("fs");if(!nodePath)nodePath=require("path");filename=nodePath["normalize"](filename);return nodeFS["readFileSync"](filename,binary?null:"utf8")};readBinary=function readBinary(filename){var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};readAsync=function readAsync(filename,onload,onerror){if(!nodeFS)nodeFS=require("fs");if(!nodePath)nodePath=require("path");filename=nodePath["normalize"](filename);nodeFS["readFile"](filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})};if(process["argv"].length>1){thisProgram=process["argv"][1].replace(/\\/g,"/")}arguments_=process["argv"].slice(2);process["on"]("uncaughtException",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process["on"]("unhandledRejection",abort);quit_=function(status,toThrow){if(keepRuntimeAlive()){process["exitCode"]=status;throw toThrow}process["exit"](status)};Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!=="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=function(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=function(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=function(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=function(title){document.title=title}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!=="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}var UTF8Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(heap,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heap[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heap.subarray&&UTF8Decoder){return UTF8Decoder.decode(heap.subarray(idx,endPtr))}else{var str="";while(idx>10,56320|ch&1023)}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127)++len;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else len+=4}return len}function writeArrayToMemory(array,buffer){HEAP8.set(array,buffer)}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||18743296;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeKeepaliveCounter=0;function keepRuntimeAlive(){return noExitRuntime||runtimeKeepaliveCounter>0}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module["preloadedImages"]={};Module["preloadedAudios"]={};function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what+="";err(what);ABORT=true;EXITSTATUS=1;what="abort("+what+"). Build with -s ASSERTIONS=1 for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="wasm_gsr.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}else{throw"both async and sync fetching of the wasm failed"}}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch==="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(wasmBinaryFile)})}else{if(readAsync){return new Promise(function(resolve,reject){readAsync(wasmBinaryFile,function(response){resolve(new Uint8Array(response))},reject)})}}}return Promise.resolve().then(function(){return getBinary(wasmBinaryFile)})}function createWasm(){var info={"a":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmMemory=Module["asm"]["i"];updateGlobalBufferAndViews(wasmMemory.buffer);wasmTable=Module["asm"]["l"];addOnInit(Module["asm"]["j"]);removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){var result=WebAssembly.instantiate(binary,info);return result}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming==="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch==="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiationResult,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiationResult)})})}else{return instantiateArrayBuffer(receiveInstantiationResult)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync().catch(readyPromiseReject);return{}}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback=="function"){callback(Module);continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){wasmTable.get(func)()}else{wasmTable.get(func)(callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}function ___cxa_allocate_exception(size){return _malloc(size+16)+16}function ExceptionInfo(excPtr){this.excPtr=excPtr;this.ptr=excPtr-16;this.set_type=function(type){HEAP32[this.ptr+4>>2]=type};this.get_type=function(){return HEAP32[this.ptr+4>>2]};this.set_destructor=function(destructor){HEAP32[this.ptr+8>>2]=destructor};this.get_destructor=function(){return HEAP32[this.ptr+8>>2]};this.set_refcount=function(refcount){HEAP32[this.ptr>>2]=refcount};this.set_caught=function(caught){caught=caught?1:0;HEAP8[this.ptr+12>>0]=caught};this.get_caught=function(){return HEAP8[this.ptr+12>>0]!=0};this.set_rethrown=function(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13>>0]=rethrown};this.get_rethrown=function(){return HEAP8[this.ptr+13>>0]!=0};this.init=function(type,destructor){this.set_type(type);this.set_destructor(destructor);this.set_refcount(0);this.set_caught(false);this.set_rethrown(false)};this.add_ref=function(){var value=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=value+1};this.release_ref=function(){var prev=HEAP32[this.ptr>>2];HEAP32[this.ptr>>2]=prev-1;return prev===1}}var exceptionLast=0;var uncaughtExceptionCount=0;function ___cxa_throw(ptr,type,destructor){var info=new ExceptionInfo(ptr);info.init(type,destructor);exceptionLast=ptr;uncaughtExceptionCount++;throw ptr}function _abort(){abort()}function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function abortOnCannotGrowMemory(requestedSize){abort("OOM")}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;abortOnCannotGrowMemory(requestedSize)}var ENV={};function getExecutableName(){return thisProgram||"./this.program"}function getEnvStrings(){if(!getEnvStrings.strings){var lang=(typeof navigator==="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={"USER":"web_user","LOGNAME":"web_user","PATH":"/","PWD":"/","HOME":"/home/web_user","LANG":lang,"_":getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(x+"="+env[x])}getEnvStrings.strings=strings}return getEnvStrings.strings}var SYSCALLS={mappings:{},buffers:[null,[],[]],printChar:function(stream,curr){var buffer=SYSCALLS.buffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},get64:function(low,high){return low}};function _environ_get(__environ,environ_buf){var bufSize=0;getEnvStrings().forEach(function(string,i){var ptr=environ_buf+bufSize;HEAP32[__environ+i*4>>2]=ptr;writeAsciiToMemory(string,ptr);bufSize+=string.length+1});return 0}function _environ_sizes_get(penviron_count,penviron_buf_size){var strings=getEnvStrings();HEAP32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(function(string){bufSize+=string.length+1});HEAP32[penviron_buf_size>>2]=bufSize;return 0}function __isLeapYear(year){return year%4===0&&(year%100!==0||year%400===0)}function __arraySum(array,index){var sum=0;for(var i=0;i<=index;sum+=array[i++]){}return sum}var __MONTH_DAYS_LEAP=[31,29,31,30,31,30,31,31,30,31,30,31];var __MONTH_DAYS_REGULAR=[31,28,31,30,31,30,31,31,30,31,30,31];function __addDays(date,days){var newDate=new Date(date.getTime());while(days>0){var leap=__isLeapYear(newDate.getFullYear());var currentMonth=newDate.getMonth();var daysInCurrentMonth=(leap?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR)[currentMonth];if(days>daysInCurrentMonth-newDate.getDate()){days-=daysInCurrentMonth-newDate.getDate()+1;newDate.setDate(1);if(currentMonth<11){newDate.setMonth(currentMonth+1)}else{newDate.setMonth(0);newDate.setFullYear(newDate.getFullYear()+1)}}else{newDate.setDate(newDate.getDate()+days);return newDate}}return newDate}function _strftime(s,maxsize,format,tm){var tm_zone=HEAP32[tm+40>>2];var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?UTF8ToString(tm_zone):""};var pattern=UTF8ToString(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value==="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}else{return thisDate.getFullYear()}}else{return thisDate.getFullYear()-1}}var EXPANSION_RULES_2={"%a":function(date){return WEEKDAYS[date.tm_wday].substring(0,3)},"%A":function(date){return WEEKDAYS[date.tm_wday]},"%b":function(date){return MONTHS[date.tm_mon].substring(0,3)},"%B":function(date){return MONTHS[date.tm_mon]},"%C":function(date){var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":function(date){return leadingNulls(date.tm_mday,2)},"%e":function(date){return leadingSomething(date.tm_mday,2," ")},"%g":function(date){return getWeekBasedYear(date).toString().substring(2)},"%G":function(date){return getWeekBasedYear(date)},"%H":function(date){return leadingNulls(date.tm_hour,2)},"%I":function(date){var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)},"%j":function(date){return leadingNulls(date.tm_mday+__arraySum(__isLeapYear(date.tm_year+1900)?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,date.tm_mon-1),3)},"%m":function(date){return leadingNulls(date.tm_mon+1,2)},"%M":function(date){return leadingNulls(date.tm_min,2)},"%n":function(){return"\n"},"%p":function(date){if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}else{return"PM"}},"%S":function(date){return leadingNulls(date.tm_sec,2)},"%t":function(){return"\t"},"%u":function(date){return date.tm_wday||7},"%U":function(date){var janFirst=new Date(date.tm_year+1900,0,1);var firstSunday=janFirst.getDay()===0?janFirst:__addDays(janFirst,7-janFirst.getDay());var endDate=new Date(date.tm_year+1900,date.tm_mon,date.tm_mday);if(compareByDay(firstSunday,endDate)<0){var februaryFirstUntilEndMonth=__arraySum(__isLeapYear(endDate.getFullYear())?__MONTH_DAYS_LEAP:__MONTH_DAYS_REGULAR,endDate.getMonth()-1)-31;var firstSundayUntilEndJanuary=31-firstSunday.getDate();var days=firstSundayUntilEndJanuary+februaryFirstUntilEndMonth+endDate.getDate();return leadingNulls(Math.ceil(days/7),2)}return compareByDay(firstSunday,janFirst)===0?"01":"00"},"%V":function(date){var janFourthThisYear=new Date(date.tm_year+1900,0,4);var janFourthNextYear=new Date(date.tm_year+1901,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);var endDate=__addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);if(compareByDay(endDate,firstWeekStartThisYear)<0){return"53"}if(compareByDay(firstWeekStartNextYear,endDate)<=0){return"01"}var daysDifference;if(firstWeekStartThisYear.getFullYear()=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":function(date){return date.tm_zone},"%%":function(){return"%"}};for(var rule in EXPANSION_RULES_2){if(pattern.includes(rule)){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1}function _strftime_l(s,maxsize,format,tm){return _strftime(s,maxsize,format,tm)}function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var asmLibraryArg={"b":___cxa_allocate_exception,"a":___cxa_throw,"c":_abort,"d":_emscripten_memcpy_big,"e":_emscripten_resize_heap,"g":_environ_get,"h":_environ_sizes_get,"f":_strftime_l};var asm=createWasm();var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["j"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["k"]).apply(null,arguments)};var _freeStr=Module["_freeStr"]=function(){return(_freeStr=Module["_freeStr"]=Module["asm"]["m"]).apply(null,arguments)};var _tryUsingDecoder=Module["_tryUsingDecoder"]=function(){return(_tryUsingDecoder=Module["_tryUsingDecoder"]=Module["asm"]["n"]).apply(null,arguments)};var stackSave=Module["stackSave"]=function(){return(stackSave=Module["stackSave"]=Module["asm"]["o"]).apply(null,arguments)};var stackRestore=Module["stackRestore"]=function(){return(stackRestore=Module["stackRestore"]=Module["asm"]["p"]).apply(null,arguments)};var stackAlloc=Module["stackAlloc"]=function(){return(stackAlloc=Module["stackAlloc"]=Module["asm"]["q"]).apply(null,arguments)};Module["UTF8ToString"]=UTF8ToString;Module["stringToUTF8"]=stringToUTF8;Module["writeArrayToMemory"]=writeArrayToMemory;Module["stackSave"]=stackSave;Module["stackRestore"]=stackRestore;Module["stackAlloc"]=stackAlloc;var calledRun;function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}Module["run"]=run;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run(); 10 | 11 | 12 | return WasmDsp.ready 13 | } 14 | ); 15 | })(); 16 | if (typeof exports === 'object' && typeof module === 'object') 17 | module.exports = WasmDsp; 18 | else if (typeof define === 'function' && define['amd']) 19 | define([], function() { return WasmDsp; }); 20 | else if (typeof exports === 'object') 21 | exports["WasmDsp"] = WasmDsp; 22 | -------------------------------------------------------------------------------- /wasm/wasm_gsr.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/invisiblecoder99/widevine-l3-guesser-gui/57b7092398cddfb0f9c3e3282f071e67964fd344/wasm/wasm_gsr.wasm --------------------------------------------------------------------------------