如何使用PHP混淆JavaScript? [英] How to obfuscate JavaScript using PHP?

查看:86
本文介绍了如何使用PHP混淆JavaScript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我如何从以下代码中混淆此示例代码:

For example, how could I obfuscate this sample code from:

/*
The code below will write
to a heading and to a paragraph,
and will represent the start of
my homepage:
*/
document.getElementById("myH1").innerHTML="Welcome to my Homepage";
document.getElementById("myP").innerHTML="This is my first paragraph.";

进入表格:


var _0xcc34=["\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C","\x6D\x79\x48\x31","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64","\x57\x65\x6C\x63\x6F\x6D\x65\x20\x74\x6F\x20\x6D\x79\x20\x48\x6F\x6D\x65\x70\x61\x67\x65","\x6D\x79\x50","\x54\x68\x69\x73\x20\x69\x73\x20\x6D\x79\x20\x66\x69\x72\x73\x74\x20\x70\x61\x72\x61\x67\x72\x61\x70\x68\x2E"];document[_0xcc34[2]](_0xcc34[1])[_0xcc34[0]]=_0xcc34[3];document[_0xcc34[2]](_0xcc34[4])[_0xcc34[0]]=_0xcc34[5];


使用PHP?

我知道我可以使用 http://javascriptobfuscator.com/ 来做到这一点,但我需要这样做在我的PHP文件中,因为它会动态更改。

I know that I can do this using http://javascriptobfuscator.com/ but I need to do that inside my PHP file, because it dynamically changes.

推荐答案

好的。关于如何设置障碍的理论。

OK. On theory about how to obsfucate.


  • 你需要知道这种语言,因为你需要一个解析器来获得好的结果。

  • 当你知道什么是什么时,你就可以开始更换东西了。

一个非常愚蠢的例子替换

for a very stupid example replace all instances of

<$ c的所有实例$ c> document.getElementById('string'); with ab(cd('fgevat'); like

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

function cd(s) { /* ROT13 implemented here*/ } function ab(s) { return document.getElementById(s); } ab(cd('fgevat');




  • 你可以使用eval来避免拆包清除文本。然后你可以去

  • 像这样

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

    这是所有r = 1的东西。并且可以通过广告更好地完成对这种语言有更深入的了解,这些也是非常简单的反转

    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

    这篇关于如何使用PHP混淆JavaScript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆