Reversing

IDA String이 no Xrefs로 참조 안 될 때

Tribal 2017. 11. 17. 23:40

상황 예제

- String이 분명히 바이너리에서 사용되는데 'no xrefs to'가 발생하면서 참조가 안 되는 상황



문자열 찾는 방법 1

- Alt + B를 눌러 String의 주소를 검색



문자열 찾는 방법 2

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
40
from struct import pack, unpack
import idautils
import idaapi
 
def SearchString(curser):
    #curser = here()
    b1 = (curser >> 24& 0xff
    b2 = (curser >> 16& 0xff
    b3 = (curser >> 8& 0xff
    b4 = curser & 0xff
    
    print '[+] String Address : ' + hex(curser)
    binstr = '%x %x %x %x' % (b4, b3, b2, b1)
 
    tmplist = []
    tmplist.append(FindBinary(0, SEARCH_DOWN | SEARCH_CASE, binstr, 16))
 
    iscontinue = True
    while iscontinue:
        tmp = FindBinary(0, SEARCH_DOWN | SEARCH_CASE | SEARCH_NEXT, binstr, 16)
        if tmp == -1 or tmp in tmplist:
            iscontinue = False
        else:
            tmplist.append(tmp)
 
    if len(tmplist) == 1:
        print '[+] Find Binary Address : ' + hex(tmplist[0])
    else:
        print '[+] Find Binary Address : '
        print tmplist
 
    Jump(tmplist[0])
 
    return len(tmplist)
 
def main():
    SearchString(here())
 
if __name__ == '__main__':
    main()
cs

- 이런 식으로 스크립트를 작성해서 돌리면 됨