Recently BEGAN to understand some android reverse knowledge, hope to find time to do a learning record.

1.JADX

JADX is a powerful android decompiler. The supported file types are APK, dex, JAR, zip, class, AAR files, you can see that JADX supports a lot of formats, basically compiled into Java virtual machine recognized bytecode, it can be decomcompiled. In addition to selecting a file, you can also directly drag the APK file into the Mac, because MINE is a Mac, so mainly introduces the installation notes on the Mac. Installing Jadx for Mac is simple:

mkdir jadx    Create jadx directory
git clone https://github.com/skylot/jadx.git  Clone repository to directory
cd jadx  Enter the jadx directory
./gradlew dist 
Copy the code

The last step often breaks, I started the installation with an SSL Exception, but deleted it and re-installed it (metaphysics).

Open directly to use the graphical interface, if the APK is large, you can also use the command line.

2.Apktool

Download the JAR package first, the link is as follows: Download link

Then copy the Unix script and name it apktool without the suffix:

#! /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.
#Get file name
prog="$0" 
#See if there's a soft connection and get the path, that's why I use the soft connection scheme, okay
while [ -h "${prog}" ]; do
    newProg=`/bin/ls -ld "${prog}"`

    newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
    if expr "x${newProg}" : 'x/' >/dev/null; then
        prog="${newProg}"
    else
        progdir=`dirname "${prog}"`
        prog="${progdir}/${newProg}"
    fi
done
#Get the path and open it
oldwd=`pwd`
progdir=`dirname "${prog}"`
cd "${progdir}"
progdir=`pwd`
prog="${progdir}"/`basename "${prog}"`
cd "${oldwd}"

jarfile=apktool.jar
libdir="$progdir"
if [ ! -r "$libdir/$jarfile" ]
then
    echo `basename "$prog"`": can't find $jarfile"
    exit 1
fi

javaOpts=""

# If you want DX to have more memory when executing, uncomment the following
# line and adjust the value accordingly. Use "java -X" for a list of options
# you can pass here.
# 
#Set the memory, memory can comment out
javaOpts="-Xmx512M"

# Alternatively, this will extract any parameter "-Jxxx" from the command line
# and pass them to Java (instead of to dx). This makes it possible for you to
# add a command-line parameter such as "-JXmx256M" in your ant scripts, for
# example.
#It's like setting up a cache or something. I don't understand
while expr "x$1" : 'x-J' >/dev/null; do
    opt=`expr "$1" : '-J\(.*\)'`
    javaOpts="${javaOpts} -${opt}"
    shift
done
#To judge the system, I have to be a MAC that doesn't run this code at all
if [ "$OSTYPE" = "cygwin" ] ; then
    jarpath=`cygpath -w  "$libdir/$jarfile"`
else
    jarpath="$libdir/$jarfile"
fi
#I don't know what might help
# add current location to path for aapt
PATH=$PATH:`pwd`;
export PATH;
exec java $javaOpts -Djava.awt.headless=true -jar "$jarpath" "$@"
Copy the code

You need to move the script and jar package to /usr/local/bin or use a soft link:

Ln -s The absolute path you placed /apktool /usr/local/bin/apktool chmod +x /usr/local/bin/apktoolCopy the code

Then give the script executable permissions:

Chmod +x /usr/local/bin/apktool OR chmod +x the absolute path you placed /apktoolCopy the code

Apktool –version

Two commands are commonly used:

Apktool d test. Apktool B testCopy the code

There will be a packaged apk packaged by apkTool in the target folder, but this still cannot be installed, because there is no signature.

3.keytool & jarsigner

Both tools come with the Java JDK, so you only need to have the JDK installed.

Keytool -genkey -keystore my-release-key.keystore -alias my_alias -keyalg RSA -keysize 4096 -validity 10000 # 2. Android_signed. Apk is the signed apK android. Apk is the signed apK jarsigner -sigalg MD5withRSA -Digestalg SHA1 -keystore my-release-key.keystore -signedjar android_signed.apk android.apk my_aliasCopy the code

An unsigned APK cannot be installed on an Android phone. You can use these two commands to find out if the JDK was installed successfully.

where keytool
where jarsigner
Copy the code