Skip to content

Commit

Permalink
init project
Browse files Browse the repository at this point in the history
  • Loading branch information
venshine committed Sep 3, 2017
0 parents commit a6bae4c
Show file tree
Hide file tree
Showing 80 changed files with 2,597 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
27 changes: 27 additions & 0 deletions classyshark-apk
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

# 校验参数合法性
source util.sh
check $1

# 得到新的目录
newfoldername=${foldername}"-classyshark"
rm -rf $foldername

if [ ! -d "$newfoldername" ];
then
mkdir $newfoldername
fi

# 切换到创建的目录
cd $newfoldername

# 打印该目录的路径
echo `pwd`

# 通过ClassyShark查看apk文件
echo "View the decompile file"

# 执行ClassyShark命令
#java -jar ../../tools/classyshark/ClassyShark.jar -export $absolutename
java -jar ../../tools/classyshark/ClassyShark.jar -open $absolutename
43 changes: 43 additions & 0 deletions decompile-apk
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/sh

arg=$1

function input() {
# true 显示以下信息,false不显示
if [ $1 = true ];
then
echo "You can choose the following three ways to decompile an apk file"
echo "1: using apktool/dex2jar/jd-gui to decompile apk"
echo "2: using ClassyShark to decompile apk"
echo "3: using jadx to decompile apk"
echo "q: exit"
fi

#echo "Please input your choice(1, 2, 3):"
read -p "Please input your choice(1, 2, 3):" input

case $input in
1)
## 执行jdgui-apk命令
./jdgui-apk $arg
;;
2)
## 执行classyshark-apk命令
./classyshark-apk $arg
;;
3)
## 执行jadx-apk命令
./jadx-apk $arg
;;
q)
## 退出命令
exit
;;
*)
## 输入其他字符重新选择
input false
;;
esac
}

input true
18 changes: 18 additions & 0 deletions jadx-apk
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

# 校验参数合法性
source util.sh
check $1

# 得到新的目录
newfoldername=${foldername}"-jadx"
rm -rf $newfoldername

# 通过jadx-gui查看apk文件
echo "View the decompile file"

# 执行jadx命令
#sh ../tools/jadx/bin/jadx -d $newfoldername $absolutename

# 执行jadx-gui命令
sh ../tools/jadx/bin/jadx-gui $absolutename
67 changes: 67 additions & 0 deletions jdgui-apk
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/sh

# 校验参数合法性
source util.sh
check $1

# 得到新的目录
newfoldername=$foldername
rm -rf $newfoldername

# 判断目录是否为空
function isEmptyDir(){
return `ls -A $1|wc -w`
}

# 执行apktool命令
sh ../tools/apktool/apktool d -f $absolutename

# 判断目录是否存在,不存在证明执行apktool命令出现异常
if [ ! -d "$foldername" ];
then
echo "Resource files decompile failed"
exit
fi

# 判断目录是否为空,为空证明执行apktool命令出现异常
if isEmptyDir $foldername;
then
echo "Resource files decompile failed"
exit
fi

# 执行apktool命令成功
echo "Resource files decompile successful"

# 切换到之前文件名创建的目录中
cd $foldername
echo `pwd`

# 执行dex2jar命令
sh ../../tools/dex2jar/d2j-dex2jar.sh $absolutename
suffix="-dex2jar.jar"
jarname=${foldername}${suffix}

# 判断是否生成后缀为-dex2jar.jar的文件
if [ ! -f "$jarname" ];
then
echo "Dex file decompile failed"
exit
fi

# 执行dex2jar命令成功
echo "Dex file decompile successful"

# 打印生成后缀为-dex2jar.jar的文件的路径
path=`pwd`
pathname=${path}"/"${jarname}
echo ${pathname}

# 通过jd-gui查看jar文件
echo "View the decompile file"

# 执行jd-gui命令
java -jar ../../tools/jd-gui/jd-gui.jar $jarname



77 changes: 77 additions & 0 deletions tools/apktool/apktool
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/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}"`

newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
if expr "x${newProg}" : 'x/' >/dev/null; then
prog="${newProg}"
else
progdir=`dirname "${prog}"`
prog="${progdir}/${newProg}"
fi
done
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.
#
javaOpts="-Xmx512M -Dfile.encoding=utf-8"

# 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.
while expr "x$1" : 'x-J' >/dev/null; do
opt=`expr "$1" : '-J\(.*\)'`
javaOpts="${javaOpts} -${opt}"
shift
done

if [ "$OSTYPE" = "cygwin" ] ; then
jarpath=`cygpath -w "$libdir/$jarfile"`
else
jarpath="$libdir/$jarfile"
fi

# add current location to path for aapt
PATH=$PATH:`pwd`;
export PATH;
exec java $javaOpts -Djava.awt.headless=true -jar "$jarpath" "$@"
Binary file added tools/apktool/apktool.jar
Binary file not shown.
Binary file added tools/classyshark/ClassyShark.jar
Binary file not shown.
Loading

0 comments on commit a6bae4c

Please sign in to comment.