JS - 如何不用 a-zA-Z0-9 寫 console.log(1) - 資安

Table of Contents

剛好看到有人分享文章[0] 分享 JavaScript 的優秀規格

其中提到如何不用 英文字母跟數字寫出 console.log(1)

當然這類型問題已經出現很多了 甚至都有線上服務[1]

將你的 JavaScript code 變成僅用 []()!+ 來呈現 (某種程度壓縮率應該蠻高的)


整體的核心概念是

- 0 可用 ![]+![] 1 可用 !![]+![]
- 字母可以用 []+[]

之後就再透過 prototype 的方式 用 [] 找到需要的函數來執行


[0]: https://blog.techbridge.cc/2020/11/28/how-to-write-console-log-1-without-alphanumeric/
[1]: http://www.jsfuck.com/

--

All Comments

Eartha avatarEartha2020-12-04
同理 在 Python 的世界裡面可以用 ''.__class__ 當作橋
Regina avatarRegina2020-12-09
接方式呼叫其他函數