모의해킹/안드로이드

메모리 덤프 방법론 3가지

logthink 2022. 1. 13. 23:05

#안드로이드 스튜디오에서 ADM(Android Device Monitor)방법은 제외한다.


⊙ adb를 이용한 메모리 덤프

1. adb -e shell am dumpheap 3855 /sdcard/sg.hprof

2. adb pull /sdcard/sg.hprof

3. strings.exe sg.hprof > memory.txt

- 3855 : 실행되고 있는 앱의 PID

- /sdcard/sg.hprof : 덤프 파일을 저장할 경로


⊙ ddms를 이용한 메모리 덤프

1. ddms.bat 실행

2. 분석할 앱 선택 후 hprof 파일로 저장


⊙ frida를 이용한 메모리 덤프

1. adb shell

2. /data/local/tmp/frida-server & (frida-server 실행)

3. frida-ps -U (실행되고 있는 앱의 패키지명 확인)

4. python fridump.py -U -s 패키지명 (메모리 덤프)

*fridump : https://ch4njun.tistory.com/163