This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| symbolicjs [2025/05/12 03:06] – Yuki | symbolicjs [2025/05/12 21:22] (current) – Yuki | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== |
| Inspired by JSFuck, but here's the rules: | Inspired by JSFuck, but here's the rules: | ||
| Line 33: | Line 33: | ||
| ===== Build a basic alphabet ===== | ===== Build a basic alphabet ===== | ||
| + | |||
| + | We can use variables, but only those whose name contains `$` and `_` so we'll use some sort of morse code-based encoding, with `$`=>`.` and `_`=> | ||
| ^ ^code^ | ^ ^code^ | ||
| Line 55: | Line 57: | ||
| |O|'' | |O|'' | ||
| |space|'' | |space|'' | ||
| + | |||
| + | Actually, we can just use the '' | ||
| <code javascript> | <code javascript> | ||
| - | [, | + | [, |
| - | [$$$_$, | + | [$$$_$, |
| - | [,$$_$,$$$_]=!``+[], | + | [, |
| - | [__$]=-`!`+[], | + | [__$]=-`!`+[], |
| - | [,_$$,$_$,$$$_$,$$$,$_$,,, | + | [, |
| - | [$$$_,, | + | [$$$_,, |
| </ | </ | ||
| - | ===== Build a function | + | Of course, a few of those are not needed, can be removed if you don't need them, and those identifiers can always be shorter. We need at least enough to spell '' |
| + | |||
| + | <code javascript> | ||
| + | [, | ||
| + | [, | ||
| + | [,$$_$]=!``+[], // r | ||
| + | [$$$_, | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | |||
| + | ===== Execute arbitrary code ===== | ||
| + | |||
| + | Now we have enough letters to execute arbitrary code: | ||
| + | |||
| + | <code javascript> | ||
| + | $=(_=> | ||
| + | </ | ||
| <code javascript> | <code javascript> | ||
| $=(_=> | $=(_=> | ||
| </ | </ | ||
| + | |||
| + | ===== Build more letters ===== | ||
| + | |||
| + | We can then use `btoa` to get a lot of the letters we're missing, most notably '' | ||
| + | |||
| + | <code javascript> | ||
| + | [K, | ||
| + | </ | ||
| + | |||
| + | <code javascript> | ||
| + | [, | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | It's useful to save ''" | ||
| + | </ | ||
| ===== Build the global object ===== | ===== Build the global object ===== | ||
| <code javascript> | <code javascript> | ||
| - | [,, | + | _=Function(" |
| - | _=$($$_$+$$+$_+$$$_+$$_$+$_$+____$+$_+$$$$$+$$$+$$$$)() | + | </ |
| + | |||
| + | <code javascript> | ||
| + | _=$(_+$_+$$$$$+$$$+$$$$)() | ||
| + | </ | ||
| + | |||
| + | ===== Access global variables and run some code ===== | ||
| + | |||
| + | <code javascript> | ||
| + | _[" | ||
| + | </ | ||
| + | |||
| + | <code javascript> | ||
| + | _[$_$_$+$___+$_$+$$$$+$___+$$_$$+$$][$$_$$+$___+$__$]($$$$$+$$+$$_$$+$$_$$+$___) | ||
| + | </ | ||
| + | |||
| + | ===== console.log example ===== | ||
| + | |||
| + | <code javascript> | ||
| + | [,$___, | ||
| + | [, | ||
| + | [, | ||
| + | [$$$_, | ||
| + | $=(_=> | ||
| + | [,$$$, | ||
| + | $($$_$+$$+$_+$$$_+$$_$+$_$+____$+$_+$$$$$+$$$+$$$$)() // $(" | ||
| + | [$_$_$+$___+$_$+$$$$+$___+$$_$$+$$][$$_$$+$___+$__$]($$$$$+$$+$$_$$+$$_$$+$___) // console.log(" | ||
| + | </ | ||
| + | |||
| + | <code javascript> | ||
| + | [, | ||
| </ | </ | ||