读书人

在江南研究jsunpackn (运作原理)

发布时间: 2012-10-10 13:58:11 作者: rapoo

在江南研究jsunpackn (运行原理)

感觉江南这个称呼不错,就到盗用了过来,关于这个jsunpackn是一个decode网页js脚本的东西,因为js脚本挂马需要依赖于浏览器漏洞,主要集中与ie,

而chrome与firefox的漏洞不算特别多,还有就是弹出广告,之类的一些流氓功能。

jsunpack有一个网页版本和一个本地版本,本地版本配置需要python环境和几个python模块,官网介绍如下

This modification is important! If you don't want to make this modification, you should follow step 99 at the bottom of this file.After fetching and spidermonkey and locating the correct file follow steps 1, 2 and 3.$ wget http://ftp.mozilla.org/pub/mozilla.org/js/js-1.8.0-rc1.tar.gz$ cd js/src$ vi jsobj.c1) Add around line 1184 (beginning of function body obj_eval):    size_t n, i;    jschar *s;2) Add around line 1314 (within function obj_eval):|    principals = NULL;|    }    //added    if (JSSTRING_IS_DEPENDENT(str)) {        n = (size_t)JSSTRDEP_LENGTH(str);        s = JSSTRDEP_CHARS(str);    } else {        n = (size_t)str->length;        s = str->u.chars;    }    printf("\n//eval\n");    for (i = 0; i < n; i++){        if (s[i] == '\0'){                break;        }        printf("%c",s[i]);    }    printf("\n");    //end added|    /*|     * Set JSFRAME_EVAL on fp and any frames (e.g., fun_call if eval.call was3) Then build with:$ make BUILD_OPT=1 -f Makefile.refAfter this, you will find a "./Linux_All_OPT.OBJ/js" binary file.99) Note: If you cannot use "./Linux_All_OPT.OBJ/js" as the default 'js' command, then you should uncomment the following code within pre.js below to make it active. (If you just built spidermonkey, you do not want to uncomment the following code)/* //Comment out because spidermonkey handles eval nowvar my_eval = this.eval;this.eval=function (str){        print('\n//eval\n'+str);        return my_eval(str);}*/


pycrypto
这个模块,包含了很多加密解密算法,应该是crypto++的python封装,里面的加密方式比较复杂,都是些RSA,椭圆曲线,不对称加密,分组密码

哈希密码之类的东西,不知道有什么用处。

文档在这里https://www.dlitz.net/software/pycrypto/api/current/

pynids

这个模块,是libnids的python封装,提供了包的重组功能,应该是为了输入文件中的packet captures,不过libnids应该是一个安全方面的工具,

在这里如果只负责,输入文件中的包重组,有些大材小用的感觉。

可能有事嗅探会发现很多平时注意不到的JS,可能是重定向或是跨域回传之类的(只是猜测)

源码包里有一个Demo,不过基本没有注释

yara

这个东西是负责,关键代码的定义的,也是比较核心的模块,也是唯一有用户手册的模块,这里建国做了翻译,我就不赘述了

http://blog.csdn.net/xihuanqiqi


读书人网 >JavaScript

热点推荐