This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
symbolicjs [2025/05/12 00:37] – created Yuki | symbolicjs [2025/05/12 18:56] (current) – Yuki | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
Inspired by JSFuck, but here's the rules: | Inspired by JSFuck, but here's the rules: | ||
Line 21: | Line 21: | ||
^number^code^ | ^number^code^ | ||
- | |-3|'' | + | |-4|'' |
- | |-2|'' | + | |-3|'' |
- | |-1|'' | + | |-2|'' |
- | |0|'' | + | |-1|'' |
- | |1|'' | + | |-0|'' |
- | |2|'' | + | |0|'' |
- | |3|'' | + | |1|'' |
- | + | |2|'' | |
- | <note tip>'' | + | |3|'' |
+ | |4|'' | ||
===== 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^ | ||
- | |a|'' | + | |a|'' |
- | |b|'' | + | |b|'' |
- | |c|'' | + | |c|'' |
- | |d|'' | + | |d|'' |
- | |e|'' | + | |e|'' |
- | |f|'' | + | |f|'' |
- | |i|'' | + | |i|'' |
- | |j|'' | + | |j|'' |
- | |l|'' | + | |l|'' |
- | |n|'' | + | |n|'' |
- | |o|'' | + | |o|'' |
- | |r|'' | + | |r|'' |
- | |s|'' | + | |s|'' |
- | |t|'' | + | |t|'' |
- | |u|'' | + | |u|'' |
- | |y|'' | + | |y|'' |
- | |I|'' | + | |I|'' |
- | |N|'' | + | |N|'' |
- | |O|'' | + | |O|'' |
- | |space|'' | + | |space|'' |
+ | |||
+ | Actually, we can just use the '' | ||
+ | |||
+ | <code javascript> | ||
+ | [, | ||
+ | [$$$_$, | ||
+ | [, | ||
+ | [__$]=-`!`+[], // N | ||
+ | [, | ||
+ | [$$$_,, | ||
+ | </ | ||
+ | |||
+ | Of course, a few of those are not needed, and 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> | ||
+ | [, | ||
+ | [, | ||
+ | [, | ||
+ | [$$$_, | ||
+ | </ | ||
+ | |||
+ | ===== Execute arbitrary code ===== | ||
+ | |||
+ | Now we have enough letters to execute arbitrary code: | ||
+ | |||
+ | <code javascript> | ||
+ | $=(_=> | ||
+ | </ | ||
+ | |||
+ | <code javascript> | ||
+ | $=(_=> | ||
+ | </ | ||
+ | |||
+ | ===== Build more letters ===== | ||
+ | |||
+ | We can then use `btoa` to get a lot of the letters we're missing: | ||
+ | |||
+ | <code javascript> | ||
+ | [K, | ||
+ | </ | ||
+ | |||
+ | <code javascript> | ||
+ | [, | ||
+ | </ | ||
+ | |||
+ | ===== Build the global object ===== | ||
+ | |||
+ | <code javascript> | ||
+ | _=Function(" | ||
+ | </ | ||
+ | |||
+ | <code javascript> | ||
+ | _=$($$_$+$$+$_+$$$_+$$_$+$_$+____$+$_+$$$$$+$$$+$$$$)() | ||
+ | </ | ||
+ | |||
+ | ===== Access global variables and run some code ===== | ||
+ | |||
+ | <code javascript> | ||
+ | _[" | ||
+ | </ | ||
+ | |||
+ | <code javascript> | ||
+ | _[$_$_$+$___+$_$+$$$$+$___+$$_$$+$$][$$_$$+$___+$__$]($$$$$+$$+$$_$$+$$_$$+$___) | ||
+ | </ | ||
+ | |||
+ | ===== Final result ===== | ||
+ | |||
+ | <code javascript> | ||
+ | [, | ||
+ | [, | ||
+ | [, | ||
+ | [$$$_, | ||
+ | $=(_=> | ||
+ | [, | ||
+ | $($$_$+$$+$_+$$$_+$$_$+$_$+____$+$_+$$$$$+$$$+$$$$)() // $(" | ||
+ | [$_$_$+$___+$_$+$$$$+$___+$$_$$+$$][$$_$$+$___+$__$]($$$$$+$$+$$_$$+$$_$$+$___) // console.log(" | ||
+ | </ | ||
+ | |||
+ | <code javascript> | ||
+ | [, | ||
+ | </ |