안드로이드 최신 버전의 SDK에서 pm명령어 모음입니다. adb shell로 접근하여 얻을 수 있는 명령어입니다. adb shell 접근 방법은 아래에서 설명하겠습니다.
명령어를 통해 앱을 설치하거나, 삭제하고, 사용자를 추가하고, 삭제 할 수 있는 명령어도 있습니다. 현재 기본값으로 셋팅 된 설치 경로를 가져오는 get-install-location 도 있습니다. 일반적으로 [0/auto]가 설정되어 있습니다
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | usage: pm list packages [-f] [-d] [-e] [-s] [-e] [-u] [FILTER] pm list permission- groups pm list permissions [-g] [-f] [-d] [-u] [GROUP] pm list instrumentation [-f] [TARGET-PACKAGE] pm list features pm list libraries pm path PACKAGE pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] [-s] [-f] PATH pm uninstall [-k] PACKAGE pm clear PACKAGE pm enable PACKAGE_OR_COMPONENT pm disable PACKAGE_OR_COMPONENT pm disable-user PACKAGE_OR_COMPONENT pm set - install -location [0 /auto ] [1 /internal ] [2 /external ] pm get- install -location pm createUser USER_NAME pm removeUser USER_ID pm list packages: prints all packages, optionally only those whose package name contains the text in FILTER. Options: -f: see their associated file . -d: filter to only show disbled packages. -e: filter to only show enabled packages. -s: filter to only show system packages. -3: filter to only show third party packages. -u: also include uninstalled packages. pm list permission- groups : prints all known permission groups . pm list permissions: prints all known permissions, optionally only those in GROUP. Options: -g: organize by group. -f: print all information. -s: short summary. -d: only list dangerous permissions. -u: list only the permissions users will see. pm list instrumentation: use to list all test packages; optionally supply <target-package> to list the test packages for a particular application. Options: -f: list the .apk file for the test package. pm list features: prints all features of the system. pm path: print the path to the .apk of the given PACKAGE. pm install : installs a package to the system. Options: -l: install the package with FORWARD_LOCK. -r: reinstall an exisiting app, keeping its data. -t: allow test .apks to be installed. -i: specify the installer package name. -s: install package on sdcard. -f: install package on internal flash. pm uninstall: removes a package from the system. Options: -k: keep the data and cache directories around after package removal. pm clear : deletes all data associated with a package. pm enable , disable, disable-user: these commands change the enabled state of a given package or component (written as "package/class" ). pm get- install -location: returns the current install location. 0 [auto]: Let system decide the best location 1 [internal]: Install on internal device storage 2 [external]: Install on external media pm set - install -location: changes the default install location. NOTE: this is only intended for debugging; using this can cause applications to break and other undersireable behavior. 0 [auto]: Let system decide the best location 1 [internal]: Install on internal device storage 2 [external]: Install on external media < /target-package > |
이 중 가장 많이 사용하는 명령어가 앱을 강제로 SD카드로 이동하는 명령어 일 겁니다. 해당 명령어도 아래와 같이 변경되었습니다.
설치 경로의 기본 값을 가져오는 명령어와 설정하는 명령어입니다.
pm get-install-location //기본값으로 지정된 설치 경로를 불러옵니다.
pm set-install-location 0/1/2 //강제로 경로를 설정합니다.
[adb를 이용한 apk 파일 추출 및 인스톨]
c:\> adb shell
# pm list packages -f
...
package:/system/app/SettingsProvider.apk=com.android.providers.settings
package:/system/app/TtsService.apk=android.tts
package:/system/app/Mms.apk=com.android.mms << 이걸 가져오고 싶으면...
package:/system/app/MediaProvider.apk=com.android.providers.media
package:/system/app/CertInstaller.apk=com.android.certinstaller
package:/system/app/DownloadProvider.apk=com.android.providers.downloads
...
# exit
c:\>adb pull /system/app/Mms.apk .
adb pull (가져올 파일 경로/파일명.apk) (받을 경로/파일명.apk)
출처 : 코드 클리핑 (http://www.dreamy.pe.kr/zbxe/CodeClip/163974)
'Study > 안드로이드' 카테고리의 다른 글
aarch64에서 LD_PRELOAD Injection을 통한 함수후킹(실패) (0) | 2017.04.10 |
---|---|
JDB이용하여 앱 동적 분석하기 (0) | 2017.02.13 |
Drozer 기본 명령어 (0) | 2017.02.09 |
안드로이드 재서명 하기 (2) | 2016.05.08 |
안드로이드 apk서명 (0) | 2016.05.02 |