⭠ Back to MegaDB Search

cobalt-green | 170 points | Sep 01 2017 22:31:03

[META] Here is a javascript bookmark to decode base 64 without leaving the page | Megalinks MegaDB [META] Here is a javascript bookmark to decode base 64 without leaving the page

Edit: You should use HA5HBANG's version instead. Glad to see I'm not the only one who wanted something like this.

I thought you guys might like this

javascript:
var encoded = prompt("Input the Base64 text:");
try
{
    var decoded = atob(encoded);
    alert(decoded);
}
catch(error)
{
    alert("Couldn't decode");
}

How to use it - https://my.mixtape.moe/bgvldc.mp4

permalink


[-] HA5HBANG | 34 points | Sep 01 2017 22:57:39

I used to use something similar, but tweaked it to an prompt box instead of an alert. This lets you edit the link in place (to remove #Salt! for instance, or whatever other crap our uploaders are putting in these links). It also gets the currently selected text on the page, so no need to copy and paste. Works in Chrome. Haven't tested in other browsers.

javascript:var x=prompt('Your decoded text:', atob(window.getSelection().toString()));

edit: fixed. tnx u/cobalt-green!

permalink

[-] cobalt-green | 12 points | Sep 01 2017 23:20:17

Wow, that is much better! Turns two clicks into one and makes it easier to clean up the result. But I think you meant to put the var x before the prompt, not inside it.

javascript: var x = prompt('Your decoded text:', atob(window.getSelection().toString()));

permalink

[-] HA5HBANG | 2 points | Sep 02 2017 00:01:49

you're right, didn't look close enough when typing. thanks!

permalink

[-] sigtrap | 1 points | Sep 01 2017 23:24:14

Doesn't seem to work in Firefox.

permalink

[-] DV865 | 2 points | Sep 01 2017 23:38:52

Works fine in my Firefox v55.0.3

permalink

[-] HA5HBANG | 2 points | Sep 02 2017 00:03:50

There was a typo. Try it now?

permalink

[-] sigtrap | 2 points | Sep 02 2017 02:20:58

Yep now it works. Thanks

permalink

[-] Anaron | 1 points | Sep 02 2017 09:49:54

This is great. Thanks!

And thanks OP for the idea.

permalink

[-] chagmed | 1 points | Sep 02 2017 13:53:30

I'm missing something. If, e.g., I need to remove 2017 from the following L+K prior to decoding, how would I do that using the bookmarklet? I highlight, click the bookmarklet, and get the result. How do I remove the above salt prior to conversion?

Link: I0YhSEIx2017Q1FKd0Q=

Key: IWZnSGp4LVY4TEZldz2017JWYVhDQU1aV0E=

permalink

[-] HA5HBANG | 2 points | Sep 02 2017 14:51:35

The first step of this code is to convert selected text from base64. It needs to be proper base64, so if anyone puts extra characters in the middle of encoded text, it will produce partially garbled results. You'd have to edit the original text first to remove 2017.

edit: You'd have to use u/cobalt-green's original code because it lets you edit the text when inputting. Mine lets you edit the output. It would be easy enough to combine the code to allow editing at both ends.

permalink

[-] dylpickles1133 | 1 points | Oct 31 2017 14:45:31

First and foremost, this is awesome. Thank you for this.

I do have a question though. When decoding the link on this post, the result gives this weird "NL" at the end of the string. https://imgur.com/N6Sv6SV Any idea what this is or where it comes from? When I paste the deobfuscated link in the address bar, the "NL" disappears.

permalink

[-] HA5HBANG | 1 points | Oct 31 2017 15:14:22

It's a newline character. Very common to find these in base64 encoded text. There are some base64 encoders that always add a newline at the end of the text. Sometimes, it's the user's fault, ie the person encoding may select text and inadvertently select a newline before and/or after the intended text.

It can be annoying to look at, but harmless.

permalink

[-] WifeKilledMy1stAcct | 6 points | Sep 02 2017 00:19:11

For Chrome, there's this simple extension. It has decrypted all keys for me without even having to right-click or anything! https://chrome.google.com/webstore/detail/base64-encode-and-decode/kcafoaahiffdjffagoegkdiabclnkbha

permalink

[-] TJHookerWithAPenis | 4 points | Sep 02 2017 02:24:36

I think an extension is more likely to affect browser performance, but it's good to know that exists.

permalink

[-] [deleted] | 3 points | Sep 02 2017 15:13:31

This is nice. I've combined both versions by u/cobalt-green and u/HA5HBANG so you can edit both the input & output if need be:

javascript: var encoded = prompt("Input the Base64 text:"); try { var decoded = atob(encoded); prompt('Your decoded text:', decoded); } catch(error) { alert("Couldn't decode"); }

Click cancel when you're done copying/editing the decoded text, otherwise, you'll leave the page.

permalink

[-] HA5HBANG | 1 points | Sep 02 2017 15:32:45

Click cancel when you're done copying/editing the decoded text, otherwise, you'll leave the page.

Nice job. To avoid the navigation problem, just assign the output of the prompt to a dummy variable:

javascript: var encoded = prompt("Input the Base64 text:"); try { var decoded = atob(encoded); var x=prompt('Your decoded text:', decoded); } catch(error) { alert("Couldn't decode"); }

permalink

[-] chagmed | 4 points | Sep 02 2017 16:23:21

Thank you! Small change: automatically copies highlighted text, allows editing.

javascript: var encoded = prompt("Input the Base64 text:",window.getSelection().toString()); try { var decoded = atob(encoded); var x = prompt('Your decoded text:', decoded); } catch(error) { alert("Couldn't decode"); }

permalink

[-] HA5HBANG | 2 points | Sep 02 2017 16:31:03

Even better! I think we've arrived. This is probably the best general-purpose method.

permalink

[-] chagmed | 3 points | Sep 02 2017 16:32:25

I stand on the shoulders of giants. Thank you all.

permalink

[-] TJHookerWithAPenis | 1 points | Feb 17 2018 01:40:51

Good work & thank you /u/HA5HBANG and /u/chagmed this is awesome. I was on this thread early and didn't see what teamwork and a little time would do to improve the script. So glad I came back to it. I would have half a mind to submit it to bestof if we weren't trying to keep a low profile.

permalink

[-] [deleted] | 2 points | Sep 02 2017 15:52:07

Awesome thanks :)

permalink

[-] madwilliamflint | 2 points | Sep 02 2017 13:16:53

Oh thank god you magnificent bastard. This shit should be gilded.

permalink

[-] EposVox | 1 points | Sep 01 2017 22:44:11

Woah sweet. If only it could somehow translate it on the page, haha

permalink

[-] thesunmustdie | 2 points | Sep 02 2017 01:34:40

Easy enough to write an extension app that detects base-64 strings on Megalinks threads (using regex) and replaces it with decoded content — if you know some JavaScript. I might do it myself tomorrow if I have time, because it would be a pretty handy tool to have.

permalink

[-] douhaveanygreypoupon | 3 points | Sep 02 2017 10:53:36

There was a bookmarklet posted for making plain-text mega ids/decryption keys into urls, you could probably use it as a base

[META] JavaScript bookmarklet to automatically link-ify MEGA IDs (and decryption keys if present)

permalink

[-] thesunmustdie | 1 points | Sep 02 2017 12:28:49

Excellent. Thank you.

permalink

[-] [deleted] | 1 points | Sep 02 2017 08:58:48

Thank you!

permalink

[-] 1231231231231232131 | 1 points | Sep 02 2017 11:39:00

So you guys are trying to automatize the anti bot measurements. what could possibly go wrong...

Granted base64 is a retarded solution, and I've no idea why it was revived.

echo "passphrase" | base64 --decode

permalink

[-] thesunmustdie | 1 points | Sep 02 2017 12:28:07

Playing devil's advocate:

"So you guys are trying to automatize the anti bot measurements"

We just need to stay one step ahead of them.

"what could possibly go wrong..."

The bots catch up and we modify the code slightly to compensate.

permalink

[-] madwilliamflint | 1 points | Sep 02 2017 13:17:43

This will always be what happens. Always. It is the way of things.

permalink

[-] HA5HBANG | 1 points | Sep 02 2017 15:03:24

I deleted my first comment accidentally. Here's the gist again:

IMO, I really don't think this helps bots. It's difficult to write general code to recognize base64 on a page, because the character set is just the alphabet in upper and lower case and a few extra characters. If someone does code a bot to recognize base 64 links, then converting those links into the proper format will be the simplest step of the code.

Providing a tool such as the one in this thread for easier link conversion | Megalinks MegaDB link conversion isn't going to make a difference in link recognition | Megalinks MegaDB link recognition, and that is the step we are trying to address on this sub when obfuscating links.

I would love to hear from others more knowledgeable than I.

permalink

[-] 1231231231231232131 | 1 points | Sep 02 2017 15:41:08

true. People were claiming the sub is invested with bots. I still think it's manual labor, otherwise all the old posts would be affected as well, but there are year old uploads that still work fine. But who knows...

permalink

[-] MRCAB | 1 points | Sep 03 2017 02:03:58

Cool.

permalink

[-] MyBarcode | 1 points | Sep 03 2017 08:09:51

How did you make that gif so smooth :o

permalink

[-] MrTattyBojangles | 1 points | Sep 03 2017 17:02:05

This and none of the ones in the comments seem to get the job done any faster, at least not for me. But I appreciate you all trying.

permalink