JS解包器通过PHP - 函数(p,a,c,k,e,r) [英] JS Unpacker via PHP - function(p,a,c,k,e,r)

查看:104
本文介绍了JS解包器通过PHP - 函数(p,a,c,k,e,r)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在互联网上搜索但到目前为止找不到任何解决方案。

I searched over the internet but found no solution so far.

我必须抓取一页压缩的页面内容(包含视频流) a href =http://dean.edwards.name/packer/ =nofollow> Dean Edwards打包工具,实时。

I have to scrape the content of a page (that has a video stream) compressed with the Dean Edwards packer tool, in real time.

因此,我只需要通过PHP解码压缩的JS。 (完整场景:卷曲页面内容,找到JS内容并实时解码,这样我就可以得到动态视频流。)

Therefore, I need to decode the compressed JS via PHP only. (The full scenario: curl the content of the page, find the JS content and decode it in real time so I can get the dynamic video stream).

所以,是有没有办法只通过PHP解码这个压缩的js例子?

So, is there any way to decode this compressed js example via PHP only?

压缩代码的示例

eval(function(p,a,c,k,e,r){e=String;if(!''.replace(/^/,String)){while(c--)r[c]=k[c]||c;k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(0(){4 1="5 6 7 8";0 2(3){9(3)}2(1)})();',10,10,'function|b|something|a|var|some|sample|packed|code|alert'.split('|'),0,{}))

谢谢

推荐答案

首先,你必须将打包的javascript拆分为相关部分。

First of all, you have to split the packed javascript into the relevant parts.

从eval到}('的第一部分与你无关:

The first part from "eval" to "}('" is not relevant to you:

eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('

第二部分是你的最小化函数(有效载荷):

The second part is your minimized function (payload):

(0(){4 1="5 6 7 8";0 2(3){9(3)}2(1)})();

第三部分是基数,当你解码有效载荷时,你将用作基数:

The third part is the radix, that you'll use as your base when you decode the payload:

10

第四部分是字数:

10

第五个相关部分是您的关键字(以|分隔):

The fifth relevant part are your keywords (separated by |):

function|b|something|a|var|some|sample|packed|code|alert

最后一部分也无关紧要:

The last part is also irrelevant:

'.split('|'),0,{})) 

所以基本上你现在拥有解码所需的所有部分:

So basically you now have all the parts you need for the decoding:

$payload = '(0(){4 1="5 6 7 8";0 2(3){9(3)}2(1)})()';
$radix = 10;
$wordCount = 10;
$words = array("function","b","something","a","var","some","sample","packed","code","alert);

现在你必须用你的单词数组中的相应单词替换有效载荷中的所有单词字符。在您的示例中很容易,因为您的源javascript只包含10个单词。

Now you have to replace the all word characters within your payload with the corresponding word within your words array. It's easy in your example, because your source javascript just contains 10 words.

第一个字charahter为0,将其替换为$ words [0] = function

The first word charahter is 0, replace it with $words[0] = function

第二个字符是4,用$ words替换它[4] = var

The second word character is 4, replace it with $words[4] = var

等等...

当你完成后你的结果应该是:

When you're done your result should be:

(function(){var b="some sample packed code";function something(a){alert(a)}something(b)})();

当谈到单词> 10时,它当然有点复杂。

Of course it's a little bit more complex, when it comes to words > 10.

但为此,你可以查看我的解包器类 PHP JavaScript解包器

But for that, you can check out my unpacker class PHP JavaScript unpacker.

特别是来源中的Unbaser类。

Especially the Unbaser class within the source.

这篇关于JS解包器通过PHP - 函数(p,a,c,k,e,r)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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