본문 바로가기

IDA

IDA Python 찾기(immediate, text, code 등)

반응형

IDA Python 찾기(immediate, text, code 등)


ida_search 모듈 도큐먼트를 보면 find 관련 함수들이 많이 있다.

인자들만 봐도 사용법이 감이 올 것이다.

몇가지만 사용해 보자.


1) Immediate 값 검색

ida_search 모듈의 find_imm()함수를 이용.

ex)

print find_imm(MinEA(), SEARCH_DOWN, 0xff)


해석)

MinEA() : base주소부터

SEARCH_DOWN :  아래 방향으로 서치 하면서

0xff : 0xff 값을 찾겠다.




2) Text 검색

 ida_search 모듈의 find_text()함수를 이용.


ex)

string = "error"

start = MinEA() #base addr

end = MaxEA() #end addr


while start < end: #entire range

start = find_text(start, SEARCH_DOWN | SEARCH_NEXT, 0, 0, string)

if start == idc.BADADDR:

break

else:

print hex(start), idc.GetDisasm(start)

start = idc.NextHead(start)


해석)

전체 범위에서 "error" 문자열이 있는 곳을 다 검색


⚠︎ 반복 서치 시, SEARCH_NEXT 옵션을 주지 않으면 처음 찾은 것만 계속 나옴.


결과)


나머진 생략.

반응형

'IDA' 카테고리의 다른 글

IDA Python Search Flags 정리  (0) 2019.02.21
IDA Python Raw Data 접근  (0) 2019.02.21
IDA Python 바이너리 패턴 검색  (0) 2019.02.21
IDA Python 상호참조  (0) 2019.02.21
IDA Python 함수 타입  (0) 2019.02.21