Last active
November 14, 2025 08:29
-
-
Save sevenissimo/d2bc51e041998f1e2812db83ba852947 to your computer and use it in GitHub Desktop.
A bookmarklet to automate secrets.json creation for dnigamer/TeraboxUploaderCLI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (async (url, doc, win) => { | |
| if (win.location.href.split('?')[0] !== url) win.location.href = url; | |
| if (typeof jsToken === 'undefined') { | |
| alert("❌ jsToken not found. Abort."); | |
| return; | |
| } | |
| let cookies = {}; | |
| doc.cookie.split(';').forEach(cookie => { | |
| let [name, value] = cookie.trim().split('=').map(s => s.trim()); | |
| if (["csrfToken", "browserid", "lang", "ndut_fmt"].includes(name)) { | |
| cookies[name] = value; | |
| } | |
| }); | |
| // Re-enable F12/Ctrl+Shit+I shortcuts to open DevTools | |
| Event.prototype.preventDefault=()=>{}; | |
| // HttpOnly cookies cannot be retrived from JS to avoid XSS | |
| alert("Copy 'ndus' from DevTools → Application → Cookies"); | |
| await new Promise(r => setTimeout(r, 5e3)); // 5" to press F12 | |
| let ndus = prompt("New 'ndus' (or cached will be used):"); | |
| if (ndus) win.localStorage.setItem('__ndus', ndus); // Save it | |
| cookies['ndus'] = ndus || win.localStorage.getItem('__ndus') || ''; | |
| let secrets = { | |
| "jstoken": jsToken, // Global variable defined by Terabox | |
| "cookies": cookies // Just built cookies object | |
| }, | |
| a = doc.createElement('a'); | |
| a.href = URL.createObjectURL( | |
| new Blob([ | |
| JSON.stringify(secrets, null, 2) | |
| ], { type: 'application/json' }) | |
| ); | |
| a.download = 'secrets.json'; | |
| a.click(); | |
| })('https://www.terabox.com/main', document, window); | |
| // A bookmarklet to automate secrets.json creation for https://github.com/dnigamer/TeraboxUploaderCLI | |
| // javascript:(async(e,t,o)=>{if(o.location.href.split("?")[0]!==e&&(o.location.href=e),"undefined"==typeof jsToken)return void alert("❌ jsToken not found. Abort.");let n={};t.cookie.split(";").forEach((e=>{let[t,o]=e.trim().split("=").map((e=>e.trim()));["csrfToken","browserid","lang","ndut_fmt"].includes(t)&&(n[t]=o)})),Event.prototype.preventDefault=()=>{},alert("Copy %27ndus%27 from DevTools → Application → Cookies"),await new Promise((e=>setTimeout(e,5e3)));let l=prompt("New %27ndus%27 (or cached will be used):");l&&o.localStorage.setItem("__ndus",l),n.ndus=l||o.localStorage.getItem("__ndus")||"";let s={jstoken:jsToken,cookies:n},i=t.createElement("a");i.href=URL.createObjectURL(new Blob([JSON.stringify(s,null,2)],{type:"application/json"})),i.download="secrets.json",i.click()})("https://www.terabox.com/main",document,window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment