VideoHelp Forum



Support our site by donate $5 directly to us Thanks!!!

Try StreamFab Downloader and download streaming video from Netflix, Amazon!



+ Reply to Thread
Results 1 to 11 of 11
  1. Member
    Join Date
    Feb 2022
    Location
    Search the forum first!
    Search PM
    The python program below will call node-js (to be installed on your system) and simulate a browser environment to extract the HMAC-SECRET and AES-KEY from My5's current javascript online code.
    To install node see https://nodejs.org/en for install to sut your OS.
    then run
    Code:
    npm install node-fetch
    npm install jsdom
    npm install require.js
    to install needed modules.

    Finally save the python below to autkeys.py and run it in a terminal window.
    It outputs to the command line and a file records the result - output.json


    Code:
    import subprocess
    import json
    import os
    
    js_code = """
    const { JSDOM } = require("jsdom");
    const fs = require("fs");
    
    async function simulateBrowser() {
        const fetch = await import('node-fetch').then(mod => mod.default);
    
        const dom = new JSDOM(`<!DOCTYPE html><body></body>`, {
            url: "https://player.akamaized.net/",
            resources: "usable",
            runScripts: "dangerously"
        });
        const window = dom.window;
    
        window.fetch = fetch;
    
        try {
            const response = await window.fetch("https://player.akamaized.net/html5player/core/html5-c5-player.js");
            const jsCode = await response.text();
            const scriptElement = window.document.createElement("script");
            scriptElement.textContent = jsCode;
            window.document.body.appendChild(scriptElement);
    
            const inlineScript = `
                fetch('https://player.akamaized.net/html5player/core/html5-c5-player.js')
                    .then((r) => r.text())
                    .then((b) => {
                        const dfnm = /\\\\x72\\\\x65\\\\x74\\\\x75\\\\x72\\\\x6e\\\\x20\\\\x74\\\\x79\\\\x70\\\\x65\\\\x6f\\\\x66\\\\x20([a-z0-9]+)\\\\[(\\\\d+)\\\\]\\\\.([a-z0-9]+)\\\\x20\\\\x3d\\\\x3d\\\\x3d\\\\x20\\\\x27\\\\x66\\\\x75\\\\x6e\\\\x63\\\\x74\\\\x69\\\\x6f\\\\x6e\\\\x27/gi.exec(b);
                        const krm = /\\\\x27\\\\\\\\x68\\\\x27:[a-z0-9]+\\\\.[a-z0-9]+\\\\((\\\\d+)\\\\),'\\\\\\\\x61':[a-z0-9]+\\\\.[a-z0-9]+\\\\((\\\\d+)\\\\)/gi.exec(b);
                        if (!dfnm || !krm) {
                            window.simulationResult = { error: 'Regex did not match any content', dfnm, krm };
                            return;
                        }
                        window.simulationResult = {
                            HMAC_SECRET: window[dfnm[1]][dfnm[2]][dfnm[3]](krm[1]),
                            AES_KEY: window[dfnm[1]][dfnm[2]][dfnm[3]](krm[2]),
                        };
                    })
                    .catch((err) => {
                        window.simulationResult = { error: err.message };
                    });
            `;
            const inlineScriptElement = window.document.createElement("script");
            inlineScriptElement.textContent = inlineScript;
            window.document.body.appendChild(inlineScriptElement);
    
            // Wait for the fetch and processing to complete
            await new Promise(resolve => setTimeout(resolve, 3000));
    
            // Write the result to a file
            if (window.simulationResult) {
                fs.writeFileSync("output.json", JSON.stringify(window.simulationResult));
            } else {
                fs.writeFileSync("output.json", JSON.stringify({ error: 'Unknown error' }));
            }
        } catch (err) {
            console.error('Error in simulateBrowser:', err);
            fs.writeFileSync("output.json", JSON.stringify({ error: err.message }));
        }
    }
    
    simulateBrowser().catch((err) => {
        console.error('Error in simulateBrowser:', err);
        fs.writeFileSync("output.json", JSON.stringify({ error: err.message }));
    });
    """
    
    with open("simulate_browser.js", "w") as f:
        f.write(js_code)
    
    result = subprocess.run(["node", "simulate_browser.js"], capture_output=True, text=True)
    
    if result.returncode != 0:
        print("Error executing JavaScript file")
        print(result.stderr)
        exit()
    
    if not os.path.exists("output.json"):
        print("output.json file was not created")
        print("Node.js output:", result.stdout)
        exit()
    
    with open("output.json", "r") as f:
        output = json.load(f)
    
    if "error" in output:
        print("Error in JavaScript execution:", output["error"])
    else:
        print(output)
    The script produces an altered version of Diazole's browser JavaScript that runs via node (node-js) called simulate_browser.js.

    If you wish, node will run simulate_browser.js directly and write output to output.json

    Note there is a wait set in the script
    // Wait for the fetch and processing to complete
    await new Promise(resolve => setTimeout(resolve, 3000)); // 3 seconds

    If 3 seconds isn't enough, make it 5000 (5 seconds) and more til it works

    Image
    [Attachment 79285 - Click to enlarge]


    Thanks to help from Open AI

    https://files.videohelp.com/u/301890/autkeys.py
    Last edited by A_n_g_e_l_a; 20th May 2024 at 06:23.
    Noob Starter Pack. Just download every Widevine mpd! Not kidding!.
    https://files.videohelp.com/u/301890/hellyes6.zip
    Quote Quote  
  2. Got one error after the install when running the autkeys.py

    Code:
    Node.js v20.13.1
    
    PS C:\Scripts\hmac> py .\autkeys.py
    Error executing JavaScript file
    node:internal/modules/cjs/loader:1148
      throw err;
      ^
    
    Error: Cannot find module 'jsdom'
    Require stack:
    - C:\Scripts\hmac\simulate_browser.js
        at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
        at Module._load (node:internal/modules/cjs/loader:986:27)
        at Module.require (node:internal/modules/cjs/loader:1233:19)
        at require (node:internal/modules/helpers:179:18)
        at Object.<anonymous> (C:\Scripts\hmac\simulate_browser.js:2:19)
        at Module._compile (node:internal/modules/cjs/loader:1358:14)
        at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
        at Module.load (node:internal/modules/cjs/loader:1208:32)
        at Module._load (node:internal/modules/cjs/loader:1024:12)
        at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12) {
      code: 'MODULE_NOT_FOUND',
      requireStack: [ 'C:\\Scripts\\hmac\\simulate_browser.js' ]
    }
    
    Node.js v20.13.1
    
    PS C:\Scripts\hmac>

    Reran the installs again

    Code:
    npm install node-fetch
    npm install jsdom
    npm install require.js
    Code:
    found 0 vulnerabilities
    PS C:\Scripts\hmac> py .\autkeys.py
    {'HMAC_SECRET': 'lh8f+vMkRbUGaxRVmkMB6g==', 'AES_KEY': 'jmf6e2n+fgQrfw8DJ34hBg=='}
    PS C:\Scripts\hmac>
    Thank you, A_N_G_E_L_A
    Last edited by PSXman_uk; 20th May 2024 at 08:51.
    Quote Quote  
  3. Member
    Join Date
    Feb 2022
    Location
    Search the forum first!
    Search PM
    Originally Posted by PSXman_uk View Post


    Code:
    found 0 vulnerabilities
    PS C:\Scripts\hmac> py .\autkeys.py
    {'HMAC_SECRET': 'lh8f+vMkRbUGaxRVmkMB6g==', 'AES_KEY': 'jmf6e2n+fgQrfw8DJ34hBg=='}
    PS C:\Scripts\hmac>
    Thank you, A_N_G_E_L_A

    Yeah! Magic innit?
    Noob Starter Pack. Just download every Widevine mpd! Not kidding!.
    https://files.videohelp.com/u/301890/hellyes6.zip
    Quote Quote  
  4. Yes, just need to find out how to implement it should the other one stop working
    Quote Quote  
  5. Member
    Join Date
    Feb 2022
    Location
    Search the forum first!
    Search PM
    Originally Posted by PSXman_uk View Post
    Yes, just need to find out how to implement it should the other one stop working
    That's no contest. The code is already in UK-FTA but uses Selenium. Very easy to make each my5 script read output.json
    Noob Starter Pack. Just download every Widevine mpd! Not kidding!.
    https://files.videohelp.com/u/301890/hellyes6.zip
    Quote Quote  
  6. Where do you change it on yours for example please
    Quote Quote  
  7. Member
    Join Date
    Feb 2022
    Location
    Search the forum first!
    Search PM
    Well I'd run authmac.py from menu to upate output.json.

    Then my5_getter.py I'd add code to read the file 'output json' and extract the dictionary keys therein.

    Something like this
    Code:
    import json
    file = open('./output.json','r')
    
    myjson = json.load(file)
    
    HMAC_SECRET    = myjson["HMAC_SECRET"]
    AES_KEY     = myjson["AES_KEY"]
    
    ## for testing
    print("HMAC_SECRET")
    print(HMAC_SECRET)
    print("AES_KEY")
    print(AES_KEY)
    ##
    
    # and the rest of my5_getter.py........
    Noob Starter Pack. Just download every Widevine mpd! Not kidding!.
    https://files.videohelp.com/u/301890/hellyes6.zip
    Quote Quote  
  8. That works thank you
    Quote Quote  
  9. Got a small error on another machine works but has this error first

    Could not find platform independent libraries <prefix>
    Quote Quote  
  10. Member
    Join Date
    Feb 2022
    Location
    Search the forum first!
    Search PM
    Originally Posted by PSXman_uk View Post
    Got a small error on another machine works but has this error first

    Could not find platform independent libraries <prefix>
    Do you know what it means?
    Noob Starter Pack. Just download every Widevine mpd! Not kidding!.
    https://files.videohelp.com/u/301890/hellyes6.zip
    Quote Quote  
  11. Seems to not be able to find python home so you can use python command not py and it works with no error
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!