加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

Immunity Debugger使用基础

(2012-08-07 21:20:27)
标签:

immunity

debugger

pycommands

it

分类: 测试之魂
最近在学习《灰冒python》,用到了Immunity Debugger,刚开始用它,感觉不知如何下手,而且很多功能是基于python的,找了些资料,发现他很强大,在你调试,分析漏洞,编写漏洞代码时非常方便。
这是一篇不错的文章,虽然是E文。
http://www.h4ck.org.cn/2012/08/starting-to-write-immunity-debugger-pycommands-my-cheatsheet-『rw』/
下面是我整理的代码,可以再pycommands下使用。
from immlib import *
import re

imm = Debugger()

def usage():
    imm.log("  ** No arguments specified ** ",focus=1, highlight=1)
    imm.log("  Usage : ",focus=1, highlight=1)
    imm.log("       blah blah",focus=1, highlight=1)

def tohex(intAddress):
    return "X" % intAddress

def main(args):
    if not args:
        usage()

    #print "Number of arguments : " + str(len(args))
    imm.log("Number of arguments : %d " % len(args))
    cnt=0
    while (cnt < len(args)):
        imm.log(" Argument %d : %s" % (cnt+1,args[cnt]))
        if (args[cnt] == "test"):
            imm.log("  You said %s !" % (args[cnt]),focus=1, highlight=1)
        cnt=cnt+1

    #create table
    table=imm.createTable('Argument table',['Number','Argument'])
    imm.log("Number of arguments : %d " % len(args))
    cnt=0
    while (cnt < len(args)):
        table.add(0,["%d"%(cnt+1),"%s"%(args[cnt])])
        cnt=cnt+1

    #integer address
    myAddress=1234567 #this integer's address
    imm.log(" Integer         : %d " % myAddress,address=myAddress)
    imm.log(" Readable hex    : 0xX" % myAddress,address=myAddress)
    hexAddress = tohex(myAddress)
    imm.log(" Readable string : 0x%s" % hexAddress,address=myAddress)
    imm.log(" Back to integer : %d" % int(hexAddress,16),address=int(hexAddress,16))

    #assemble and disassemble and searchjing memory
    if (args[0]=="assemble"):
        if (len(args) < 2):
            imm.log("  Usage : !plugin1 compare instructions")
            imm.log("           separate multiple instructions with #")
        else:
            cnt=1
            cmdInput=""
            while (cnt < len(args)):
                cmdInput=cmdInput+args[cnt]+" "
                cnt=cnt+1
            cmdInput=cmdInput.replace("'","")
            cmdInput=cmdInput.replace('"','')
            splitter=re.compile('#')
            instructions=splitter.split(cmdInput)
            for instruct in instructions:
                try:
                    assembled=imm.assemble( instruct )
                    strAssembled=""
                    for assemOpc in assembled:
                        strAssembled =  strAssembled+hex(ord(assemOpc)).replace('0x', '\\x')
                    imm.log(" %s = %s" % (instruct,strAssembled))
                except:
                    imm.log("   Could not assemble %s " % instruct)
                    continue
在下面的命令行里输入如下数据:
!1 assemble jmp esp#xor eax,eax#mov edx,esi#retn 4#mov eax,fs:[eax+0x18]
如图:
http://s4/middle/714c124ftc6ad0d67d1b3&690Debugger使用基础" TITLE="Immunity Debugger使用基础" />



0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有