在江南研究jsunpack-n(一)
来源:互联网 发布:mac破解游戏网站 编辑:程序博客网 时间:2024/05/04 05:09
要去江北了,很紧张。
=================================
1.疯狂研究文档
COPYING 是关于自由软件的一些相关说明,和jsunpack-n没啥关系。
CHANGELOG 是关于修改记录的一些说明,目前最新的修改是 Updates 2010-07-02 version 0.3.2c。
RULES 是关于规则的文件,有点意思,里面的结构是这样子的:
rule getAnnots: decodedPDF{meta:impact = 3 //Since getAnnots may be legitimate ref = "CVE-2009-1492"hide = truestrings:$cve20091492 = "getAnnots" nocase fullwordcondition:1 of them}有很多类似的rules,在文件一开始的时候有对规则的简介:
Alert modifiers: (does not affect detection)ref = CVE-NAMEimpact = (between 0 - 10, 10 being most severe)hide = (true|false), if hide=true, don't pass detected strings to programuse this if the rule name captures everything of value, or you just don't care about the dataDetection modifiers:decodedPDF = rules that only alert if decoding within a PDF filedecodedOnly = rules that only alert if decoding level > 0 (ie. a decoding and not the original file)(add your own) I will support them (maybe not) ;)警报修饰符:
ref = CVE-NAME
CVE 的英文全称是“Common Vulnerabilities & Exposures”公共漏洞和暴露。CVE就好像是一个字典表,为广泛认同的信息安全漏洞或者已经暴露出来的弱点给出一个公共的名称。
impact 10个等级,10为影响最大的等级
hide 如果 hide = true,不把检测到的strings传递给我们这程序。基本上所有的rule要么 hide = true ,要么就没有hide这一项。说明很多rules不在乎数据。
检测修饰符:
decodedPDF 仅仅在解码一个PDF文件的时候发警报
decodedOnly 只要有解码,就发出警报
debug.py
from time import timeclass DebugStats: '''Used to track performance statistics Within the application being debugged, you should not modify the members directly. Instead, modify those elements by using the add* functions like add_launch and add_detect Attributes: js_launches: One element for each times the SpiderMonkey js was called, could be either because there is a script error, also when evaluating other versions of the environment. rule_detects: One element for each time running YARA detection. '''
from time import time :用import time,下面的函数和数据前面都要加time.XXXXXX 而用from time import time 就可以直接XXXXXX,而不需要time.了
=========================SpiderMonkey的简介====================
SpiderMonkey是Mozilla项目的一部分,是一个用C语言实现的JavaScript脚本引擎,另外还有一个叫做Rhino的Java版本。
为了在SpiderMonkey中运行JavaScript代码,应用程序必须有三个要素:JSRuntime,JSContext和全局对象。
JSContext,就像是一台小机器,它涉及JavaScript代码和对象的很多东西。它可以编译和执行脚本、获取和设置对象属性、调用 JavaScript函数、一种类型转换为另一种JavaScript数据、创建对象,等等。几乎所有JSAPI函数都要一个JSContext*作为其第一个参数,就像<stdio.h>中的大多数函数都需要FILE*一样。
全局对象包含所有可以在JavaScript代码中使用的类、函数和变量。
=========================YARA detection========================
本来以为这个应该是某个东西才对,蓝蓝让我运行下,我当时就郁闷了,运行?哦,对啊,我怎么不先运行下看看效果呢?可是当我打开jsunpackn.py的时候,发现如下错误信息:
Traceback (most recent call last):
File "C:\Users\ouyang\Desktop\jsunpack-n\jsunpackn.py", line 31, in <module>
import detection
File "C:\Users\ouyang\Desktop\jsunpack-n\detection.py", line 9, in <module>
import yara
ImportError: No module named yara
意味着我没导入yara包,detection包。看来这个yara是个运行必须的包啊。
其实我应该早点认识到 :depens文件夹意味着文件夹中的都是必须要先安装的。
看了下INSTALL,发现都是linux下怎么安装yara,郁闷啊,难道大家都是linux下开发的吗?敢不敢来个win啊?
结果google到了yara-python-1.6.win-amd64-py2.7.exe,网址http://code.google.com/p/yara-project/downloads/list
下载地址:
安装完之后果断就能在 python shell 中 :import yara
说明yara已经嵌入到python中啦。。。成功
========================BeautifulSoup for win ====================
BeautifulSoup windows下 的 配置:http://hi.baidu.com/zchare/item/bae3a0302fc4aef7a884282e
下载地址:http://download.csdn.net/detail/xihuanqiqi/4593520
cmd下进入目录然后命令:
python setup.py build
python setup.py install
========================Crypto.Cipher.ARC4======================
C:\Users\ouyang\Desktop\jsunpack-n>python jsunpackn.py
Traceback (most recent call last):
File "jsunpackn.py", line 34, in <module>
import pdf
File "C:\Users\ouyang\Desktop\jsunpack-n\pdf.py", line 13, in <module>
import Crypto.Cipher.ARC4
ImportError: No module named Crypto.Cipher.ARC4
发现还是有这个Crypto.Cipher.ARC4模块没嵌入
要下载 PyCrypto,可是安装的时候不能:
File "setup.py", line 269, in run
raise RuntimeError("chmod error")
RuntimeError: chmod error
妈的。。今天就先这样了。。这个蛋疼的问题,至今没解决。。明天试试Ubuntu下能不能搞定。
=============================================================
一个 js_launches 元素只有在发生js error或者环境版本错误才会调用SpiderMonkey js 引擎而被产生。
一个 rule_detects 元素在每次运行 YARA detection的时候被产生。
def __init__(self, name, tmpdir): self.name = name self.tmpdir = tmpdir self.js_launches = [] self.rule_detects = [] self.html_parsing = [] self.total_js_launches = [] self.total_rule_detects = [] self.ignored_main = 0 self.before_decode = None self.during_decode = None self.responsibility = None self.start = None
self Python 在类的方法必须有个额外的第一个参数 (self )。self在Python里不是关键字。self代表当前对象的地址。self能避免非限定调用造成的全局变量。
- 在江南研究jsunpack-n(一)
- 在江南研究jsunpack-n(二)
- 在江南研究jsunpack-n(四)
- 在江南研究jsunpack-n(五)
- 在江南研究jsunpack-n(三) ubuntu 下 安装中文输入法
- 在江南研究jsunpackn (运行原理)
- 青苹果jsunpack学习(一)windows下安装运行
- 挥一挥笔,江南在素笺上起舞
- JSunpack-n的安装与简单使用
- JSunpack-n模拟WireShark拦截文件传输
- 在江南这四年(成长分享)
- 笑在烟雨江南
- 迷失在江南
- 五一江南游照片集 一
- 认同和研究能同意江南
- 江南(歌词)
- 江南
- 江南
- vec4 <-> float32
- ubuntu下安装google拼音输入法
- Delphi Excel导入 的通用程序
- Using AlphabetIndexer for fastscrolling ListView 快速滚动查找
- OpeCV中常用基本数据类型的定义分析之二
- 在江南研究jsunpack-n(一)
- Delphi Excel导入 的通用程序
- HDU 4416 Good Article Good sentence(12年杭州 后缀数组)
- 使用EditText对ListView进行过滤,并作拼音匹配
- 异常处理的性能问题
- 搭建ubuntu上的git服务器,并用Mac下用Xcode连接进行开发
- 堆和栈的区别在哪里?
- 大型网站的监控、报警与故障转移
- Ubuntu 10.10下安装飞鸽传书-iptux