본문 바로가기

TroubleShooting/Etc

apk 파일 내용 보기

728x90

apk 파일을 풀기 위해서는 간단히 unzip 툴들(알집, 반디집, ...)로도 풀수는 있다. 그러나 AndroidManifest.xml 파일 같은 경우는 encrypt 된거 처럼 내용이 제대로 안 보인다.

 

Android Studio 로 apk 파일을 오픈하면 클래스 파일이나 xml, 리소스 파일들도 다 보이기도 하고 UI 로 사용하기에도 편하다. 그러나 Android Studio 는 개발툴이기 때문에 apk 만 확인 하는 용도로는 무거운 느낌이다.

 

이미 다른 툴들이 존재한다. 커맨드 라인 방식으로는 apktool 을 이용할 수 있다.

https://apktool.org/docs/install 에서 OS 환경에 맞춰서 apktool.jar 파일만 다운받아서 아래와 같이 명령어를 실행할 수 있다.

> java -jar C:\bin\apktool_2.6.0.jar d --no-src google_1_26_21_20230725_01.apk

java 는 8 이상을 사용해야 한다.

> java -jar C:\bin\apktool_2.6.0.jar
Apktool v2.6.0 - a tool for reengineering Android apk files
with smali v2.5.2 and baksmali v2.5.2
Copyright 2010 Ryszard Wi?niewski <brut.alll@gmail.com>
Copyright 2010 Connor Tumbleson <connor.tumbleson@gmail.com>

usage: apktool
 -advance,--advanced   prints advance information.
 -version,--version    prints the version then exits
usage: apktool if|install-framework [options] <framework.apk>
 -p,--frame-path <dir>   Stores framework files into <dir>.
 -t,--tag <tag>          Tag frameworks using <tag>.
usage: apktool d[ecode] [options] <file_apk>
 -f,--force              Force delete destination directory.
 -o,--output <dir>       The name of folder that gets written. Default is apk.out
 -p,--frame-path <dir>   Uses framework files located in <dir>.
 -r,--no-res             Do not decode resources.
 -s,--no-src             Do not decode sources.
 -t,--frame-tag <tag>    Uses framework files tagged by <tag>.
usage: apktool b[uild] [options] <app_path>
 -f,--force-all          Skip changes detection and build all files.
 -o,--output <dir>       The name of apk that gets written. Default is dist/name.apk
 -p,--frame-path <dir>   Uses framework files located in <dir>.

For additional info, see: https://ibotpeaches.github.io/Apktool/
For smali/baksmali info, see: https://github.com/JesusFreke/smali

GUI 형식은 jadx ( https://github.com/skylot/jadx ) 를 추천한다. GUI 로 간단하게 클래스만 선택해도 소스가 바로 보인다. 소스 디컴파일만 한다면 Android studio 보다는 가볍고 편한거 같다.