How to obfuscate JavaScript using PHP? [closed]

怎甘沉沦 提交于 2019-12-06 00:57:50

OK. On theory about how to obsfucate.

  • you need to know the language, as you will need a parser for good results.
  • when you know what is what, then you can start replacing things.

for a very stupid example replace all instances of

document.getElementById('string'); with ab(cd('fgevat'); like

function cd(s) { /* ROT13 implemented here*/ } function ab(s) { return document.getElementById(s); } ab(cd('fgevat');
  • you can use eval to avoid unpacking to clear text. and then you can go

like this

function h(s) { /*implement hexdecode in an ugly way, and run eval() on the resulting string */} h('2020202066756e6374696f6e206364287329207b202f2a20524f54313320696d706c656d656e74656420686572652a2f207d2066756e6374696f6e206162287329207b2072657475726e20646f63756d656e742e676574456c656d656e74427949642873293b207d206162286364282766676576617427293b'); // which is the above code.

this is all r=1 stuff. And can be done waay better with a deeper understanding of the language, also these are absolutely trivial to reverse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!