Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save critical-bug/fe9fb6da8ee711b89e6f9848335b6cd2 to your computer and use it in GitHub Desktop.
Save critical-bug/fe9fb6da8ee711b89e6f9848335b6cd2 to your computer and use it in GitHub Desktop.
% adb shell pm list packages -f
package:/data/app/com.skype.raider-1/base.apk=com.skype.raider
(…)
package:/data/app/jp.id_credit_sp2.android-1/base.apk=jp.id_credit_sp2.android
(…)
% adb pull /data/app/jp.id_credit_sp2.android-1/base.apk jp.id_credit_sp2.android-1_base.apk
% wget -P /usr/local/bin https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.1.1.jar
(I didn't know how to run it but a wrapper exists)
% cat /usr/local/bin/apktool
#!/bin/bash
#
# Copyright (C) 2007 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This script is a wrapper for smali.jar, so you can simply call "smali",
# instead of java -jar smali.jar. It is heavily based on the "dx" script
# from the Android SDK
# Set up prog to be the path of this script, including following symlinks,
# and set up progdir to be the fully-qualified pathname of its directory.
prog="$0"
while [ -h "${prog}" ]; do
newProg=`/bin/ls -ld "${prog}"`
echo ${newProg}
newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
if expr "x${newProg}" : 'x/' >/dev/null; then
prog="${newProg}"
else
(…)
% mv --backup /usr/local/bin/apktool{_2.1.1,}.jar
% apktool decode -f jp.id_credit_sp2.android-1_base.apk
I: Using Apktool 2.1.1 on jp.id_credit_sp2.android-1_base.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /home/yosi/apktool/framework/1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
Edit AndroidManifest.xml platformBuildVersionCode="23" -> "16"
Edit apktool.yml minSdkVersion: '19' -> '16'
(I didn't know what apktool calls framework nor what it is)
% apktool install-framework (cyanogenmod)/system/framework/framework-res.apk
% apktool build -v --aapt /usr/local/src/android-sdk-linux_x86/build-tools/22.0.1/aapt jp.id_credit_sp2.android-1_base >! jp.id_credit_sp2.android-1_base_apktool_framework.log 2>&1
% adb install jp.id_credit_sp2.android-1_base/dist/jp.id_credit_sp2.android-1_base.apk
4712 KB/s (6362578 bytes in 1.318s)
pkg: /data/local/tmp/jp.id_credit_sp2.android-1_base.apk
Failure [INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION]
rm failed for -f, No such file or directory
(never succeeded to install the crafted apk)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment