인프런 - 강의/루팅탐지, 탐지우회, 방어방법

5 - 디컴파일, 프로가드

개복치 개발자 2019. 11. 30. 02:55

후킹을 위해서는 디컴파일에서 소스 코드를 봐야합니다.

 

디컴파일이란 무엇일까요? 컴파일의 반댓말입니다. 컴파일된 코드를 디컴파일 하면, 원래의 소스 코드를 볼 수 있습니다.

 

일단 디컴파일 툴을 다운받습니다.

 

저 같은 경우는 맥을 기준으로 작업했습니다.

 

apk파일을 디컴파일하기 위해서 아래 다운로드

 

dex2jar - https://sourceforge.net/projects/dex2jar/

 

dex2jar

Download dex2jar for free. Tools to work with android .dex and java .class files. Mirrors: * https://bitbucket.org/pxb1988/dex2jar * https://github.com/pxb1988/dex2jar dex2jar contains following compment * dex-reader is designed to read the Dalvik Executab

sourceforge.net

그리고 디컴파일된 파일을 보기 위해

 

JD-GUI - http://java-decompiler.github.io/

 

Java Decompiler

The “Java Decompiler project” aims to develop tools in order to decompile and analyze Java 5 “byte code” and the later versions. JD-GUI is a standalone graphical utility that displays Java source codes of “.class” files. You can browse the reconstructed so

java-decompiler.github.io

 

이렇게 2개를 다운받아줍니다.

 

얘네들을 가지고 앱을 디컴파일을 할 수 있습니다.

 

이런 코드를 apk파일로 만들어서 디컴파일 해보겠습니다.

 

 

이렇게 코드를 열어서 후킹을 할 수 있는데, 코드를 열어봐도 어느 부분에서 어떻게 루팅 탐지를 하는지 모른다면, 우회가 힘들겠죠?

 

그 때문에 코드 난독화를 시켜줍니다.

 

코드 난독화에 대표적으로 proguard, dexguard 이렇게 2가지가 있는데

 

이 2가지를 이용해서 난독화가 가능합니다.

 

프로가드로 난독화하면 아래의 사진과 같이 나옵니다.

 

 

 

 

 

 

 

 

-- 참고

 

https://black-jin0427.tistory.com/89

https://chelsea-kbj.tistory.com/9