안드로이드 앱 컴파일 - andeuloideu aeb keompail


안드로이트 앱 리버싱 하는 방법


안드로이드 앱 분석 전 설치가 필요한 프로그램
* 안드로이드 컴파일 순서 : class > dex > apk

1. JAVA 파일 : Jar파일 (1.8이상 다운 필요)

안드로이드 앱 컴파일 - andeuloideu aeb keompail

링크 : https://java.com/ko/download/

2. Dex2Jar 파일 : 앱 파일의 확장자 dex를 jar로 변환해줌. 

링크 :https://github.com/pxb1988/dex2jar 

링크2 : 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

(bat 파일로 되어 있음)

안드로이드 앱 컴파일 - andeuloideu aeb keompail

3. jd-gui : jar파일을 java파일로 바꿔서 코드를 볼수 있도록 함.

링크 : http://java-decompiler.github.io/

안드로이드 앱 컴파일 - andeuloideu aeb keompail
안드로이드 앱 컴파일 - andeuloideu aeb keompail
안드로이드 앱 컴파일 - andeuloideu aeb keompail

4. Apktool : apk를 분석하는 도구로. apk를 디컴파일 및 리패키징을 해주는 툴

링크 : https://ibotpeaches.github.io/Apktool/install/

5. Nox : apk 동적분석을 위한 안드로이드 에뮬레이터

링크 : https://kr.bignox.com/

안드로이드 앱 컴파일 - andeuloideu aeb keompail

안드로이드 앱 디컴파일(Decompile) 및 분석하는방법

1) dex2jar와 jd-gui 활용


Dex 확장자를 jar 파일로 바꾸기

1) cmd 창에서 dex2jar-2.0 경로로 간다.

cd C:\Users\user\dex2jar-2.0

2) d2j-dex2jar로 dex파일을 jar 파일로 변환하는 명령어 입력

C:\Users\user\dex2jar-2.0>d2j-dex2jar.bat dex파일 위치

☞ 그러면 dex2jar-2.0폴더 안에 .jar 파일이 생성된다.

안드로이드 앱 컴파일 - andeuloideu aeb keompail
안드로이드 앱 컴파일 - andeuloideu aeb keompail
jd-gui 
안드로이드 앱 컴파일 - andeuloideu aeb keompail

여기에 jar파일을 끌어다가 넣는다.

안드로이드 앱 컴파일 - andeuloideu aeb keompail

☞ 그러면 java코드로 변환된 결과가 보인다.

☞ 변수 같은 거는 코딩했을 때랑은 완전히 동일하지 않다.


안드로이드 앱 디컴파일(Decompile) 과 리패키징(Re-Packaging) 하는 방법

2) apktool 활용


apktool 다운받기
안드로이드 앱 컴파일 - andeuloideu aeb keompail

1) apktool.bat 파일과 apktool.jar 파일 두개가 필요.(오른쪽 버튼을 누르고 링크저장하기)

- apktool.bat는 오른쪽 버튼을 누르고 링크저장하기

- apktool.jar는 'find newest here'을 클릭

안드로이드 앱 컴파일 - andeuloideu aeb keompail

2) C://Windows 디렉터리에 두개의 파일을 넣기

안드로이드 앱 컴파일 - andeuloideu aeb keompail
안드로이드 앱 컴파일 - andeuloideu aeb keompail

3) 환경변수 설정하기

안드로이드 앱 컴파일 - andeuloideu aeb keompail
안드로이드 앱 컴파일 - andeuloideu aeb keompail

4) cmd 프롬프트로 apktool 실행하기!

안드로이드 앱 컴파일 - andeuloideu aeb keompail

1) 디컴파일 하는 방법 : 

apktool d [apk 앱 파일 이름.apk]

* d는 decode의 d

안드로이드 앱 컴파일 - andeuloideu aeb keompail
안드로이드 앱 컴파일 - andeuloideu aeb keompail

2) 리패키징 하는 방법 + signpark 를 통해서 서명을 해주어야한다.

apktool b [디컴파일한 apk 폴더 위치] -o [리패키징할 앱이름.apk]

signapk.jar certificate.pem key.pk8 [서명 전 앱 이름.apk] [서명 후 앱 이름.apk]

안드로이드 앱 컴파일 - andeuloideu aeb keompail
안드로이드 앱 컴파일 - andeuloideu aeb keompail
안드로이드 앱 컴파일 - andeuloideu aeb keompail
안드로이드 앱 컴파일 - andeuloideu aeb keompail