티스토리 뷰

Immunity Debugger PyCommands를 활용하여 분석에 도움을 주기 위해 정리하는 글로 필자가 만든 코드가 아니며 Immunity Debugger를 설치하게 되면 'Immunity Debugger - PyCommands' 폴더에 존재하는 코드들이다. 최종 목표로는 기존 플러그인을 자유롭게 활용하고 새로운 나만의 플러그인들을 개발하여 정적 분석을 자동화 하는 것이다.

스크립트는 아래와 같다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
 
"""
(c) Immunity, Inc. 2004 - 2007
U{Immunity Inc.<http://www.immunityinc.com>}
"""
 
 
__VERSION__ = '1.0'
 
import immlib
 
DESC = "Return the usage information for a python command"
 
def usage(imm):
    imm.log("!usage  Returns the usage information for a pytho command")
 
def main(args):
    imm = immlib.Debugger()
    ret_str = None
 
    if args:
        try:
            mod = __import__(args[0]) # 첫 번째 인자(궁금한 스크립트 이름)를 import 시킨 후 mod에 넣는다.
        except ImportError:
            return "Error: %s is not a python command" % args[0]
        try:
            ret_str = mod.usage(imm) # import 된 스크립트에서 usage 함수를 찾아 리턴한다.
        except AttributeError:
            return "Sorry, no usage available for this command"
    else:
        return "No arguments given"
 
    if ret_str is None:
        return "See log window for usage information"
 
cs


실습 (환경 : WindowsXP)

Immunity Debugger의 Command 창에서 '!usage' + '검색하고 싶은 스크립트' 작성 후 Enter를 치면 Log(Ctrl+L)창에 해당 스크립트의 도움말이 나온다. 해당 예시로 openfile.py 스크립트에 대한 도움말을 검색하고 싶어 '!usage openfile'을 검색 하면 위와 같이 "!openfile c:\boot.ini" 이런 식으로 작성하면 된다고 출력된다. 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함